开发者

Selenium RC test: error when Run as JUnit Test, no error when Debug as JUnit Test

I have a problem: when I try to run a JUnit TestCase through Eclipse, in debug mode (using Debug as JUnit Test), it runs perfectly well (I step over each statement), but if I run it normally, not in debug mode (using Run as JUnit Test), the TestCase runs until some point and then fails when trying to find some html element in the page using xpath, i.e. div, td. I check to see if the element is present in the page using Xpath Checker and it's present.

What could be the possible reason for this? Di开发者_如何学编程d anyone confront something like this?


This sounds like the test is running faster than the application under test. You need to make sure that you use waitForPageToLoad wherever a page load occurs. Also, if your application uses AJAX at all you may have to use something like waitForCondition to ensure that the element exists before attempting to access it.

In future, Selenium may implicitly wait for elements to exist rather than immediately throwing the 'element not found' error but for the time being these waits must be explicit.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜