Page 1 of 1

AJAX & WaitForDocumentLoaded = Webdocument invalid error

Posted: Wed May 30, 2018 7:35 pm
by dhale
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.EnsureVisible();
webPage.Focus();
webPage.WaitForDocumentLoaded(30000); //<-- this is where it sometimes fails 

Re: AJAX & WaitForDocumentLoaded = Webdocument invalid error

Posted: Wed May 30, 2018 8:16 pm
by odklizec
Hi,

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?