0

Currently I am in process of building an automation tool for testing webpages. Already aware of selenium tool but will not be using that currently as our framework has already been built and requires minor changes to make it reliable. While testing this framework with test pages (html and javascript only) I encounter issues such as webpage takes a lot if time to load(happens like 1 out of 20 times). And when you try to find the co-ordinate and click the button or try to find the element in the webpage and click it sometimes it fails as button doesn't even exists at that point of time.

Currently using Thread.sleep or retry n number of times. Are there any better solutions to remove this flaky behavior?

Cœur
  • 37,241
  • 25
  • 195
  • 267
StackOverflowVeryHelpful
  • 2,347
  • 8
  • 34
  • 46

2 Answers2

2

look into WebDriverWait class. There is a respective binding for c# as well. Also, I have discussed the WebDriverWait here.

Community
  • 1
  • 1
Erki M.
  • 5,022
  • 1
  • 48
  • 74
  • I feel bad upvoting because your rep is `404 (rep not found)`, but `WebDriverWait` is a good solution.. :| – ddavison Oct 28 '13 at 14:28
  • Thanks for your answer. Currently trying this solution. I also feel this question can have many solutions. So i will wait for some more possible solutions before there is an accepted answer – StackOverflowVeryHelpful Oct 28 '13 at 18:21
0

You can try to use Implicit waits Read about it here http://www.seleniumhq.org/docs/04_webdriver_advanced.jsp

Basically you set it once per session. If you can't find an element, selenium waits the amount of time you set before throwing the exception.

user2932876
  • 332
  • 5
  • 15