Background Color of an HTML element

So, I’m trying to use the GetAttribute activity to retrieve the background-color of a button on a website but the result keeps coming back as an empty string. i tried with other attributes and it works on some but not on some others like colors in general.

Am I doing it wrong in the sense that GetAttribute can’t retrieve colors?

To test this I’m using any button I can find on w3schools website using a selector made by aaname, tag and class (in case anyone wants to try)

Any kind of help is welcome :slight_smile:

You could try getting the outterhtml attribute instead, that way you’d be able to get any in-line css for the button.

1 Like

The activity returns this when I try to fetch its outerhtml:

<button class="btn-view pull-right ng-scope" ng-if="includeTransactions && rangeSelectionIndex === 0" data-translate="" ng-click="exportReport();" ng-class="{disabled: (loading==true || invalidExportSelections)}" uipath_custom_id="6"> Download

Hi @Daniele_Bossi

Although I don’t have any example on hand, you could try Inject JS Script Activity with some basic code to get the value out of the particular element you want (if the Get Attribute activity doesn’t work).

@loginerror Thanks, I’ll try and let you know!

@loginerror yup, it worked. The code I “injected” was taken by this post on Stack Overflow. Thanks for the help!

1 Like

I’m glad it worked out :slight_smile:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.