Wait for Screenshot

Ranorex Studio, Spy, Recorder, and Driver.
d629039
Posts: 3
Joined: Fri Mar 16, 2018 11:21 am

Wait for Screenshot

Post by d629039 » Fri Jul 13, 2018 9:28 am

Hello !

I have a problem when I want to take a screenshot.

I have a scenario that runs on Internet Explorer, Firefox and Google Chrome. I have to take a screenshot of the final screen at the end of the scenario. Before taking the screenshot, I do a "Wait for" on the URL, then I do a "Validation" on the URL and then I take the screenshot. But sometimes the page is not fully loaded and the screenshot is blank or even on the previous screen.I read everywhere in the forum that I should use "Wait for" (which I already do) or use "WaitForDocumentLoaded()", but apparently it's not recommended.

How can I fix this problem ?

Thank you.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Wait for Screenshot

Post by odklizec » Fri Jul 13, 2018 9:38 am

Hi,

In contrary, WaitForDocumentLoaded is very useful and I don't see a reason, why not to use it? The only problem could be with ajax-based apps (and similar dynamically loaded pages), where the WaitForDocumentLoaded could fail to wait.

Another possibility is to add @state='complete' to the DOMs xpath.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

User avatar
Stub
Posts: 515
Joined: Fri Jul 15, 2016 1:35 pm

Re: Wait for Screenshot

Post by Stub » Fri Jul 13, 2018 2:54 pm

I use WaitForDocumentLoaded() myself. Today I learned that I can also add a condition to my repository item for the DOM I'm loading, "and @state='complete'" which I had not previously known about. I tweaked all my browser based repository items to include that little extra condition.