Handling jQuery BlockUI Plugin

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
brgibb
Posts: 39
Joined: Wed Jun 05, 2013 2:15 pm

Handling jQuery BlockUI Plugin

Post by brgibb » Fri Apr 18, 2014 11:34 am

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?

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Handling jQuery BlockUI Plugin

Post by krstcs » Mon Apr 21, 2014 2:10 pm

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).
Shortcuts usually aren't...

brgibb
Posts: 39
Joined: Wed Jun 05, 2013 2:15 pm

Re: Handling jQuery BlockUI Plugin

Post by brgibb » Tue Apr 22, 2014 3:15 pm

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,