Page 1 of 1

How can I make the difference between a timeout and an instant error while waiting for a web page?

Posted: Mon Apr 06, 2020 9:29 am
by YvesL
Hi,

My problem looks simple but I don't know how to deal with it in a simple way.

When I click on any link or button in my web application that leads me on another page,
I do a "Wait for" and expect the target page to load before the timeout.
Like:
Wait for pageurl = $targeturl
Wait for exists (a control on the target page)

When the Wait for fails it can be that:
- the target page failed to load before the "wait for" timeout: the target page is still loading
- the target page failed to load before its timeout: I get an error page like "The service is unavailable. Please contact the helpdesk"
- the target page IMMEDIATELY fails to load: I get the same error page like "The service is unavailable. Please contact the helpdesk"

Our dev team is asking me to be able to report whether the page failed to load immediately or only after a timeout,
KNOWING that at the expiration of the wait for delay, the error page displayed might be the same.


Any idea ?
Thanks in advance,
Yves

Re: How can I make the difference between a timeout and an instant error while waiting for a web page?

Posted: Mon Apr 06, 2020 9:10 pm
by mayo
Hello,

If I understand correctly you simply need to validate if the page fails to load and how long it took before it failed because as of right now a wait for action may reach the timeout and fail before the page actually loads and displays an error. Is this correct?

Cheers,

Re: How can I make the difference between a timeout and an instant error while waiting for a web page?

Posted: Wed May 27, 2020 2:03 pm
by YvesL
Hello,

Thanks for your reply. This is indeed what I intend to do.

In web apps, you press buttons and then wait for the target pages to load using a "wait for <item> exist" action.
Then resume the scripts.

If the waitfor fails, it can be that:
- the page is still loading or got a timeout error by the end of the waitfor delay
- the page immediately failed to load due to a technical error.

I would like to be able to detect when the failure happened immediately and report it as a defect.

One way to do this is to look at the screenshot or the video, but I'm trying to detect this in the script itself.

How can I do this ?

Re: How can I make the difference between a timeout and an instant error while waiting for a web page?

Posted: Fri May 29, 2020 9:36 am
by RobinHood42
Hey,

if there is an error message when the technical error occurs, you can check if the error message exists. Set the parameter continue on fail to true (or exceptionOnFail in user code to false) and ranorex will contiune if the technical error doesn't occur.

Validate.Exists(argument1,"",false);

Cheers,
Robin