When Recovery Scenario will wait for the Exist method timeout

For long operations if, after calling like:

Window(‘Some_Window’).Exists(20)

the error message box appears, then the associated pop-up window Recovery Scenario does not work immediately, but waits until the Exist method timeout, which slows down the test.

This scenario is by design, because in the test first is the Exist(20) and then the error is raised so the script will wait for the Exist method to finish and then the pop-up window Recovery Scenario will activate.

A way to overcome that situation is by using custom function that will overwrite the default Exist method. Below is the function:

Function exist1(obj,arg)

For i = 1 To arg

If Parameter("Param1")=1 Then

Exit For

else

ex=obj.Exist(1)

End If

Next

End Function

RegisterUserFunc "Window","Exist","exist1"

The script is based on a loop that will repeat same steps depending of the argument in the Exist method. The If statement is used in order to control when the loop can stop.

This is controlled via Input parameter “Param1” and the default value of the parameter is 0, the value is changed from the function called within the Recovery Scenario – so when the recovery scenario is activated that will change the value of the parameter to 1 and this will force the Exist function to stop and continue with the test.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s