网页从上到下加载。
1) <html ...
2) <head ...
3) <body ...
etc
我需要我的 WebDriver 明确地等到<title
标签可见。然后阅读标题内容,不用等待整个页面加载完毕,继续做其他动作!!!.
WebDriver driver = new ChromeDriver();
driver.get("http://");
WebDriverWait wait = new WebDriverWait(driver, 0) // This line is probably the one to be transformed in order to correspond to my requirements
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//title")));
// The problem is that the following commands do not start off until the whole page is loaded
if(driver.getTitle().equals("whatever")) {
driver.get("http://");
}
else {
...
}