Click() on HtmlAncor timeout

5 posts, 1 answers
  1. Tina Christiansen
    Tina Christiansen avatar
    2 posts
    Member since:
    Mar 2010

    Posted 06 May 2011 Link to this post

    Hi

    Im new to Test Studio and have run into a problem.

    Im in code activating a click on a HtmlAncor object. The page is wery slow to respond and sometims i get an timeout exception on the click. If I create a Click which is not a codestep or in a codestep its posible to set the WaitOnElementsTimeout but how do I do that in the code? I have tried the HtmlAncor object.Wait.Timeout but i still gets a timeout.

    Tina
  2. Stoich
    Admin
    Stoich avatar
    1 posts

    Posted 06 May 2011 Link to this post

    Hello Tina,
       you don't need to resort to code in order to set the timeout for an element. Check out this KB article:
    http://www.telerik.com/automated-testing-tools/support/kb/setting-ample-timeouts-in-your-test.aspx

    Let me know if you require any additional assistance.

    All the best,
    Stoich
    the Telerik team
    Do you think you know all the new features coming out in Test Studio R1 2011? Think again - we have some surprises and will share them with you in the What's New in Test Studio R1 2011 Webinar on May 12th.
    Register Today!
  3. Tina Christiansen
    Tina Christiansen avatar
    2 posts
    Member since:
    Mar 2010

    Posted 09 May 2011 Link to this post

    Hi

    The click is part of a codet step, i have not resorted to code in order to set the timeout for an element. There is no WaitOnElementsTimeout in the properties on a coded step.

    I have a coded step which runs trough a GridView and tests a link button in each row, but the page after click on the link button is too slow so i get a timeout.
  4. Answer
    Stoich
    Admin
    Stoich avatar
    1 posts

    Posted 09 May 2011 Link to this post

    Hello Tina,
        I apologize - I hadn't read your original post closely enough.

    There are a couple of ways to implement WaitForExists style timeouts for your elements in a coded step.
    Let's say you have an the following elment: HtmlAnchor a;
    One way to wait for it so to do this:
    a.Wait.ForExists();
    This will wait for 10 seconds. It's possible to pass it the desired timeout as a parameter in miliseconds but currently there's a minor bug which causes this statements to always wait for 10 second. So for instance:
    a.Wait.ForExists(30000);
    will still wait only 10 seconds. We have this logged so we will fix it in the near future.

    Here's a better way to define a Wait in code:
    ActiveBrowser.WaitForElement(new HtmlFindExpression("href=http://www.w3schools.com/HTML/html_links.asp"), 30000, false);
    Here new HtmlFindExpression("href=http://www.w3schools.com/HTML/html_links.asp") creates a new Find Expression for the desired element. If you don't know about Find Expression check out this tutorial:
    http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/telerik-testing-framework/intermediate-topics/element-identification/find-expressions.aspx
    30000 is the timeout in milliseconds and it will be respected. The third parameter is a boolean value - just leave it at false.

    I hope this helps.

    Greetings,
    Stoich
    the Telerik team
    Do you think you know all the new features coming out in Test Studio R1 2011? Think again - we have some surprises and will share them with you in the What's New in Test Studio R1 2011 Webinar on May 12th.
    Register Today!
  5. Tina Christiansen
    Tina Christiansen avatar
    2 posts
    Member since:
    Mar 2010

    Posted 09 May 2011 Link to this post

    Hi

    Thanks the ActiveBrowser.WaitForElement helped.
Back to Top
  Cast Your Vote at DevPro Connections! Cast Your Vote at  Win IT Pro Connections!