Page 1 of 1

Dynamic wait for webElements

Posted: Thu Apr 07, 2016 1:21 pm
by satishmohan
I am not from coding background. How do i wait for a element dynamically which loads with different time everytime. I need to do it through recording option (solution needed in record option and not through code)

Re: Dynamic wait for webElements

Posted: Thu Apr 07, 2016 1:27 pm
by odklizec
Hi,

There is no way to add dynamic wait during recording a test case. However, you can add such action manually.

What you are looking for is WaitFor Exist/NotExists action. Simply open the recording of your choice, then add WaitFor action (from Add New Action combo) to recording table (at appropriate place). Eventually, you can select an element from repository, drag&drop it to action table and from the appeared menu select "Wait For" action.

Hope this helps?

Re: Dynamic wait for webElements

Posted: Fri Apr 08, 2016 10:48 am
by satishmohan
Hi. Thank you. But this action do not work. The wait for action executes before the element is actually present. As a result the wait command is executed successfully and moves to next command but the required action is not present. In my case i am putting a wait to click on a button which loads dynamically but the click action is performed even before the button is available for click... surprisingly ranorex shows it has waited for element successfully and moves on to click-command

Re: Dynamic wait for webElements

Posted: Fri Apr 08, 2016 12:44 pm
by odklizec
Hi,

I'm afraid, It's hard to say what's wrong without seeing a sample app or at least a Ranorex snapshot of the web app before the button is actually available. And another snapshot, taken after the button appearance. Also I would need to see the xpath you are using for the problematic button in repository.

If the WaitFor Exists finishes before the button is actually available/visible, then my guess is that the xpath behind the element used with WaitFor action is already available in GUI? In other words, the button's xpath is either not unique or the button is already available, just not visible on page?

Try to add @visible='true' to the button xpath (in repo). And before you run the test, try the xpath with Ranorex spy. Just to check if the xpath is unique and if it correctly detects the button when available. It should not detect the button if it's not actually visible.

Re: Dynamic wait for webElements

Posted: Mon Apr 18, 2016 12:23 pm
by satishmohan
Hi. Sorry for the delay. PFA doc describing the actions required. Also attempted visible=True but do not work as required.

Re: Dynamic wait for webElements

Posted: Mon Apr 18, 2016 12:30 pm
by satishmohan
PFA

Re: Dynamic wait for webElements

Posted: Mon Apr 18, 2016 12:50 pm
by odklizec
Hi,

Thanks for the document describing your issue. Now please post also the Ranorex Snapshot of your web page, ideally before and after the appearance of the element you want to wait for.

However, looking at the document you've posted, I probably see the cause of your problem.

If I'm not mistaken, the element you are clicking (action row 23) and the one you want to wait for (action row 28) lies in the same CanvasTag2DCanves, which is an image? And there most probably lies your problem! Apparently, the clicked and waited-for elements are not identifiable as separate elements? Which means your only hope is to use Image-based automation/validation. Unfortunately, this is not 100% reliable method, but it's probably the best you can do.

I would suggest you to start with this screencast:
http://www.ranorex.com/support/screencasts.html#c2529

And Image-Based Automation chapter in user guide:
http://www.ranorex.com/support/user-gui ... ation.html