In uipath, how to click on a button by it's color for multiple times until the color changes?
Initially the color of the button is red and I want to click on it until it turned to green.
In uipath, how to click on a button by it's color for multiple times until the color changes?
Initially the color of the button is red and I want to click on it until it turned to green.
It totally depends on your website. You have 3 possibilities:
Use the style attribute. You could as example do it in this way:
Sadly there is no known way to me to directly access the styles without inline styling. So to solve this you would need to write your own C# code to achieve that.
Alternatively to the solutions presented by others, you may also use the "Image Exists" activity and configure it with the image of the green button. Finally, all you have to do is create a while loop, which clicks on the button until the output of the "Image Exists" activity is True.
To sum up:
exists
;exists
in the condition;NOTE: Instead of the "Do While" activity, you may also use the "Retry Scope" activity to prevent an infinite loop solution (configure with a limited number of retries).
Similar to what @Kwoxer said above
You could get the selector for the green button eg
<ctrl name='my button' colour='green' />
then get a generic selector that is independent of colour and will work for the button all of the time
<ctrl name='my button' colour='*' />
then you would do
while (not element exists(<ctrl name='my button' colour='green' />))
click(<ctrl name='my button' colour='*' />)
that way, while the green button doesn't exist it will keep on pressing the button