TA的每日心情 | 奋斗 2020-4-8 18:08 |
---|
签到天数: 723 天 连续签到: 1 天 [LV.9]测试副司令
|
本帖最后由 玲玲公主 于 2016-12-20 17:47 编辑
第二个输出标题一直显示超时、时间设置为1000也是报下面的错
public class FirstCase {
public static void main(String args[]){
WebDriver driver=new FirefoxDriver();
driver.get("http://www.baidu.com");
System.out.println("1 Page title is:"+ driver.getTitle());
WebElement element=driver.findElement(By.id("kw"));
element.sendKeys("zTree");
element.submit();
(new WebDriverWait(driver,60)).until(new ExpectedCondition<Boolean>(){
public Boolean apply(WebDriver d){
return d.getTitle().toLowerCase().endsWith("ztree");
}
});
System.out.println("2 Page title is:"+ driver.getTitle());
driver.quit();
}
}
运行结果如下:
1 Page title is:百度一下,你就知道
Exception in thread "main" org.openqa.selenium.TimeoutException: Timed out after 60 seconds waiting for webdriver.FirstCase$1@ca54312
Build info: version: '2.45.0', revision: '32a636c', time: '2015-03-05 22:01:35'
System info: host: 'WINZQ-20160505W', ip: '192.168.1.10', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_17'
Session ID: 1f2bc052-df9c-4e96-ad40-0fd11e31a607
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{platform=WINDOWS, acceptSslCerts=true, javascriptEnabled=true, cssSelectorsEnabled=true, databaseEnabled=true, browserName=firefox, handlesAlerts=true, nativeEvents=false, webStorageEnabled=true, rotatable=false, locationContextEnabled=true, applicationCacheEnabled=true, takesScreenshot=true, version=36.0}]
|
|