AJAX & WaitForDocumentLoaded = Webdocument invalid error

Ask general questions here.
Posts: 54
Joined: Thu Feb 27, 2014 7:33 pm

AJAX & WaitForDocumentLoaded = Webdocument invalid error

Post by dhale » Wed May 30, 2018 7:35 pm

Periodically, we get the following error thrown, and cant really peg down a solution.
Wondering if anyone has any thoughts?
Error thrown is: "WebDocument has become invalid while waiting for WebDocument to be loaded."

We do use ajax, and I'm guessing that's mostly the issue but not sure exactly how to work around this?

Code: Select all

WebDocument webPage = Host.Local.FindSingle(webPageInfo.AbsolutePath, 30000);
webPage.WaitForDocumentLoaded(30000); //<-- this is where it sometimes fails 

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

Re: AJAX & WaitForDocumentLoaded = Webdocument invalid error

Post by odklizec » Wed May 30, 2018 8:16 pm


I’m afraid, waitfordocumentloaded does not work well with Ajax-based webs. There is an old support reply regarding this issue, which I believe is still valid. https://www.ranorex.com/forum/wait-for- ... tml#p12619
Check also this AJAX-handling sample in help:
https://www.ranorex.com/help/latest/web ... lingofAJAX
It does not provide a direct solution of your problem, but it may help too?
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