I am getting an exception running the WebTestingAutomationSample in the Ranorex Studio.
I have also tried running the code within Visual Studio 2008 ( after copying and converting to a VS2008 project) and I get the same exception at the same point.
It fails on running the ToString() method of the InnerHtml property of the WebElement.
If I debug in VS2008 I am able to call the ToString() method without an exception.
If I remove the ToString() method from the InnderHTML property and run the sample, I no longer get the exception, but the InnerHTML property doesn't return anything to the logger, even though it is supposed to return a string.
Can you help?
Object Reference Exception in WebTestingAutomationSample
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Perhaps this is some timing issue. Could you please insert the following line
for testing purposes?
Insert the code right before these two lines:
Regards,
Alex
Ranorex Support Team
Code: Select all
System.Threading.Thread.Sleep(5000);
Insert the code right before these two lines:
Code: Select all
WebElement ajaxOutput = exampleDoc.FindDiv("ajax_out");
Logger.Info("Ajax content read successfully: " + ajaxOutput.InnerHtml.ToString());
Alex
Ranorex Support Team
It works when I add the thread sleep as per your instructions.
I then tried reducing the sleep time and found that
System.Threading.Thread.Sleep(140);
works
but
System.Threading.Thread.Sleep(135);
fails
I also tried changing the wait value in the line just prior but that did not work, see below.
// Wait for loading ajax content...
exampleDoc.WaitForDocumentLoaded(5000);//<<<<< this didn't work
I then tried reducing the sleep time and found that
System.Threading.Thread.Sleep(140);
works
but
System.Threading.Thread.Sleep(135);
fails
I also tried changing the wait value in the line just prior but that did not work, see below.
// Wait for loading ajax content...
exampleDoc.WaitForDocumentLoaded(5000);//<<<<< this didn't work
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact: