它已经很长一段时间:-)硒RC的getTitle方法
我还是用我的硒RC的学习,我使用www.irishtimes.com作为我测试的应用程序。
我有一个包含这些步骤一个非常小的测试案例:
硒硒;
public void setUp() throws Exception {
super.setUp();
selenium = new DefaultSelenium("localhost",
SELENIUM_PORT,
"*firefox",
"http://www.irishtimes.com/");
setUp("http://www.irishtimes.com/", "*firefox");
}
public void testTCNewspapers() throws Exception {
selenium.start();
selenium.open("http://www.irishtimes.com/");
selenium.waitForPageToLoad("30000");
selenium.click("link=Life");
//Doesn't work
//verifyEquals("The Irish Times - Life", sel.getTitle());
}
当执行verifyEquals我得到这个错误:
java.lang.AssertionError: java.lang.AssertionError: Expected "The Irish Times - Life" but saw "The Irish Times – Irish News, Business News, Sports News & Ireland Weather Online" instead
在com.thoughtworks.selenium.SeleneseTestBase.fail(SeleneseTestBase.java:356)
我不明白为什么会发生这种情况,因为页面的标题是“爱尔兰时报 - 生活”
从源头HTML文件:
<title>The Irish Times - Life</title>
上解决这个任何帮助吗?谢谢;-)
感谢。由于DefaultSelenium类中没有clickAndWait方法,因此我使用了waitPageToLoad(“30000”)方法 – Panacea 2010-12-13 16:38:32