cancel
Showing results for 
Search instead for 
Did you mean: 

How to select web text element that it's color could change over time

KerlousYaakoub
Level 2
hello,

I'm super new to BP and I have a situation here where I'm spying a web element text that's its color is changing overtime, meaning when the word in yellow means something, and also when the very same word in red means something else, noting that the word is in the same place and there is no difference in the xpath for the text ( it is in the same place)

I was wondering if there is a way where I can use the color of the words I'm spying on the website to provide different meanings?

thank you in advance

------------------------------
Kerlous Yaakoub
------------------------------
5 REPLIES 5

John__Carter
Staff
Staff
Hi Kerlous - welcome.

Where you have an element that can have different states (like a checkbox) then one method is to create multiple elements and spy the element in each state (eg checked and unchecked). Then you can use a wait stage with multiple 'check exists' conditions to show you which element is present. Another technique is to have an element with a dynamic attribute, so you can provide a parameter to decide the state of the element (eg checked=true or checked=false).

However, because the colour of a web element might be available in the element attributes, these techniques may not be suitable. It might be worth trying a CSS Selector, which is a little like an XPath (the BP University has some information on these)


------------------------------
John Carter
Professional Services
Blue Prism
------------------------------

hi John,

actually yes, I'm doing the wait stage thing but currently I'm stuck in identifying the color of the element to do the "check exists" step, because every time it reads that the element is there, which is correct the element is there but with different color (Red) which means for example false,, if it is in yellow it means (true)


I've tried to use the CSS Selector but still facing the same issue, any other suggestions?



------------------------------
Kerlous Yaakoub
------------------------------

Hi Kerlous,

Can you share the values you're inputting into your CSS selector field and the elements it comes from?

Alternatively, why are you looking at just the colour of the text, how is the text created and what else does it impact? E.g. when it is red there is no file available vs green the file is available.


------------------------------
Ronan Considine
Senior Business Analyst
Blue Prism
------------------------------
Ronan Considine Senior Business Analyst Blue Prism

diane.sanzone
Level 7
Hi Kerlous,

I recommend tying the CSS selector as the other posters have suggested because it sounds like it will be your most efficient and effective route to success.  I've personally never used it (just learned about it in this post!) but it sounds very interesting and direct.
I jump in to offer an alternative solution. It's not pretty and it's not fast, but if you can't get it to work any other way, perhaps you can try using surface automation?  Assuming the word never changes, only the color does, you can spy the word in both colors as 2 separate elements, then set your Colour Tolerance on the attributes to be 0, meaning that the color must be exact to match that item.  Then you again do the double wait - look for the work in both red and yellow and follow the path of the matched attribute.
If you haven't built anything yet with surface automation, I highly recommend you go through the advanced guides that BP provided to learn some of the techniques before starting.  Again, it's a terrible alternative and I'm sure everyone cringed when they read my suggestion.  In my opinion, a slow bot developed using the last possible option is better than no bot at all!

Good luck and I hope you're able to resolve this soon.

------------------------------
Diane Sanzone
------------------------------

I'm super new to BP and I have a situation here where I'm spying a web element text that's its color is changing overtime, meaning when the word in yellow means something, and also when the very same word in red means something else, noting that the word is in the same place and there is no difference in the xpath for the text  it is in the same place.

------------------------------
Urbach Roofing, Inc.
------------------------------