If else condition according to colour link button

I have two color code red and blue in one link name Deductible as mentioned in attachment

if color red then do different functionality if color blue then different I try image exist but not work for me

1 Like

Hi @Aditya10989

Use get attribute activity and based on the condition and do the manipulations



@AshwinS2 get attribute will work on different color because text both color is same ie deductible and in get attribute showing two property Attribute and result


1 Like

could you try with add css selector in ui element?/



@sandeep13 sorry no idea about css selector

1 Like


Use Ui Explore to get more selector attribute

you can use class tag also
may be differnet class used for differennt color


this is only way to achieve this…? any other easy method…?

this is the only thing come in my mind when I saw your question

@Lahiru.Fernando @lakshman guys …have you any other idea on this



@sandeep13 there is any activity from where I can got text color. according to this I can apply condition

no such activity from where you can get color.
as i said you use get attribute activity to het tag/selector from ui element then used it as per requirement

1 Like


If attribute is not different for red & blue colors.
You can Use Get Color Detector activities, which is a custom package in UIPath.
You can install it through Manage Packages & using OCR, Get Position activities you can get the color of the text from the screen.


@ronak_94 I download this activity two option are there color from image color from screen I download colordetector v1.1.3 and I also use OCR but option not available

Please go through below link:-

with the assumption, that your dealing with a website/webapplication you may give a try to following approach:

  • make use of inject js activity and
  • make benefit from getComputedStyle function like example below

getComputedStyle(document.getElementsByTagName(“h2”)[1], null)[“color”]

The color information is calculated within the Dom/Css and mybe not retrievable on uielement attributes or class names.

Feel Free to ask for more details if you need more help

@ronak_94 I used the activity it is showing me color white in both cases

@ppr yes I am dealing with website I am new in UI path I did’t understand how to achieve this inject js…?


Principial Flow: Screenshot 1
Analyzed Element: Screenshot 2

Function: “function (){ return getComputedStyle(document.getElementsByTagName(‘a’)[2], null)[‘color’]; }”
Selector: Against the Browser
Output: color info

So initial this approach could be an option. Enhancements should be done via giving link identification (DOM Syntax) over js inject arguments

1 Like


While running the code, there must be a buffering icon appearing on the screen,
Please make sure that the buffering icon is hovering on your text.

@ppr thanks for help getting [SyntaxError: Invalid or unexpected token]