This is a migrated thread and some comments may be shown as answers.

Browser object does not contain HTML content after AJAX call

1 Answer 34 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 02 Aug 2013, 07:53 PM
Hello,

I am trying to figure out how to update the Browser object so that the div that is being filled on success of an AJAX call, is valid and accessible. 

Here is the order of events in a test case I am writing.

1.) Navigate to Page A.
2.) Perform Click on a particular html object
3.) After the click event, there is an AJAX call made to populate a div 
4.) We attempt to access something in that div, "Here the exception is being thrown because it does not exist in the Browser".

So I have tried RefreshDomTree() and it seems to have no effect. 

This web application is running ASP.NET MVC 4.5 and the Telerik Testing Framework v 2012.2 in a Windows 8 Pro 64bit enviornment with VS2012.

Any help on this would be greatly appreciated. 

1 Answer, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 07 Aug 2013, 05:09 PM
Hello Robert,

In cases like these we recommend adding a WaitForElement after the click, but before trying to access the element. You do this using code like this:

ActiveBrowser.WaitForElement(new HtmlFindExpression("id=abc"), 30000, false);

As soon as the framework recognizes that the element is present, execution will immediately resume with the next line of code. If it's not there after the timeout specified (30 seconds in my example) the framework will throw an exception which will cause the test to abort.

I hope this helps.

Regards,
Cody
Telerik
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Tags
General Discussions
Asked by
Robert
Top achievements
Rank 1
Answers by
Cody
Telerik team
Share this question
or