I have an windows application. It have an three button and randomly one button will be visible other two hidden. here I want to click visible button
May be a easy way, you can use three try catch activities and try to click the three buttons in each one of them , which one will work where you need to use the If condition to check if the first button is clicked, you need to skip the remaining two and so on.
but I need a better way…
You can you use
Get Attribute ("Visibility") to check the element is visible or not.
If it’s visible you can click. But using the try catch block takes long time.
how to check the element is visible or not…
pls give if condition for this…
@Ajith_143 Do you use the element exists activity?
You can check if the button is there and put it in the if condition as boolean.
thank you @ruh_hastasi77
Its work but element exist takes Long time…
Get Attribute Activity, this will tell you the element is visible or not.
Maybe you can also put all 3 click activities with ContinueOnError = True ?
I know that this will be the bad way but maybe for your purpose its okay
Edit: You should also change the TimeOut Value maybe to 800 instead of 30000 (default)
@kuppu_samy I did with get Attribute. What I do next?
@Ajith_143 It will return either
False. Do the
if condition for every button, if the
Get Attribute returns
true, then click the button. else don’t do anything.
IsVisible is a Boolean type?
@kuppu_samy IsVisible is a Variable?
Yes, you can use data type as Generic Type. It maybe 0 or 1. Also check your selector whether you selected the button properly else you won’t get the proper values. @Ajith_143
Thank you buddy @kuppu_samy
Thanks @Ajith_143, Please mark it as the solution if you got the solution. Cheers
@kuppu_samy it always return 0 even the button is visible.
@Ajith_143 please select the element correctly, if you select child element, it may goes different.
Okay, let’s do some analysis, watch the selector of element while visible and invisible. Sure you will find some selector value changes. The we can
Get Attribute Activity accordingly.