Page 1 of 1

Handling jQuery BlockUI Plugin

Posted: Fri Apr 18, 2014 11:34 am
by brgibb
Does anyone have any experience in how to handle the effects jQuery BlockUI Plugin in a web GUI?

(http://malsup.com/jquery/block)

When this is used and the page is blocked, Ranorex can often find the element on screen (say a button) but cannot press it because the GUI is locked....and thus excepts.

I do not want to inject a number of arbitrary delays in my code. Can anyone tell me how to wait for the "unblock" before trying to do something with an element?

Re: Handling jQuery BlockUI Plugin

Posted: Mon Apr 21, 2014 2:10 pm
by krstcs
There is a "Wait For (Exist/Not Exist)" action that can be used to wait UP TO a set amount of time for an element to either exist or not exist.

You would need to add the overlay that is being created by the jQuery blocker to your repository and then add the Wait For (Not Exist) action on that element to your scripts.

I have a specific module called "_WAIT_FOR_PAGE_RELOAD" that is similar in idea to what you are wanting. It uses this action to wait for the page and scripts to finish loading before the test will continue. This module is then placed anywhere that you would expect a page load/refresh in the test suite. It allows you to set and adjust the timing in one module so you don't have to go into each module and change it.

Of course this also requires that you break all of your modules down into the smallest action sets possible so that you can mix-and-match them in the suites/cases the way you want. But this is the best way to use Ranorex in my opinion. Make the modules "modular" and use the suites/cases to hold the business logic (as in, when stuff should happen in the script).

Re: Handling jQuery BlockUI Plugin

Posted: Tue Apr 22, 2014 3:15 pm
by brgibb
Thanks for the information krstcs - In the meantime I have hand-crafted something very similar to what you outline using a while loop and checking for the presence of and the class value of the unblock elements (there are at least 2 elements I have found I had to deal with)

Wasn't aware of the Wait For (Exist/Not Exist) action - it might be better of course.

Thanks,