开发者

Xpath does not work running (in eclipse) but working on Debug mode as well as Selenium IDE

selenium.type("search-query", "case");
selenium.click("//div[@id='advanced-search-box']/a[1]");
selenium.click("//table[@id='search-results-tab开发者_StackOverflow社区le']/tbody/tr[*]/td[2]/a[@class='result-name']");
selenium.waitForPageToLoad("30000");
assertTrue(selenium.isTextPresent("case"));

Result:

com.thoughtworks.selenium.SeleniumException: ERROR: Element //table[@id='search-results-table']/tbody/tr[*]/td[2]/a[@class='result-name'] not found


What does

selenium.click("//div[@id='advanced-search-box']/a[1]");

do as you are not waiting for a new page to load, or any ajax to happend. If something is happening then you need to wait for it. The reason it would work in debug mode is because you are slowly stepping over each step (and thus there is enough time for anything to happen). It would also work in Selenium IDE because it is not as faster as the JUnit runner.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜