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

Click() on HtmlAncor timeout

4 Answers 77 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Tina Christiansen
Top achievements
Rank 1
Tina Christiansen asked on 06 May 2011, 07:43 AM
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

4 Answers, 1 is accepted

Sort by
0
Stoich
Telerik team
answered on 06 May 2011, 01:42 PM
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!
0
Tina Christiansen
Top achievements
Rank 1
answered on 09 May 2011, 01:32 PM
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.
0
Accepted
Stoich
Telerik team
answered on 09 May 2011, 01:59 PM
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!
0
Tina Christiansen
Top achievements
Rank 1
answered on 09 May 2011, 02:41 PM
Hi

Thanks the ActiveBrowser.WaitForElement helped.
Tags
General Discussions
Asked by
Tina Christiansen
Top achievements
Rank 1
Answers by
Stoich
Telerik team
Tina Christiansen
Top achievements
Rank 1
Share this question
or