How can I click a button only if it is visible on the page ?

Ask general questions here.
rastek
Posts: 185
Joined: Wed Aug 06, 2014 12:00 pm

How can I click a button only if it is visible on the page ?

Post by rastek » Wed Aug 20, 2014 12:12 pm

Hi,

I can use if-else statements inside user code but what I need is to accomplish this task without any coding. I need to use if statement in recording level, Write now only "if" statement is enough for me.

For example I want to click a button only if it is visible on the page.

There was something for this purpose in QTP; for example OptionalStep that means that step will be run if only the object exists on the page.

I hope there is some similar structure in Ranorex.

Thanks,
Rastek.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: How can I click a button only if it is visible on the page ?

Post by Support Team » Fri Aug 22, 2014 12:32 pm

Hi rastek,

Unfortunately there is no possibility to use an if statement in the recording level. But you can set optional actions in your recording module.

If you want to set an optional action, just right click on the desired action and select “Enable Continue on fail”.
EnableContinueOnFail.png
If the desired element is not found, the test will continue without exception, but the following message will be added to the report:
Report_OptionalAction.png
Regards,
Markus (S)
You do not have the required permissions to view the files attached to this post.