Browser object does not contain HTML content after AJAX call

2 posts, 0 answers
  1. Robert
    Robert avatar
    2 posts
    Member since:
    Nov 2012

    Posted 02 Aug 2013 Link to this post


    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. 
  2. Cody
    Cody avatar
    3354 posts

    Posted 07 Aug 2013 Link to this post

    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.

    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
Back to Top