我尝试使用ChromeDrive,但出现错误或无法正常运行。
我用于测试的简单Java代码是:
@Test
public void testGoogleSearch() {
System.setProperty("webdriver.chrome.driver", "lib\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("http://www.google.com/xhtml");
Thread.sleep(5000); // Let the user actually see something!
WebElement searchBox = driver.findElement(By.name("q"));
searchBox.sendKeys("ChromeDriver");
searchBox.submit();
Thread.sleep(5000); // Let the user actually see something!
driver.quit();
}
遵循本教程:https : //sites.google.com/a/chromium.org/chromedriver/getting-started
解决了
我需要更新ChromeDrive并替换以前的ChromeDrive。在我的项目目录/ lib下
在此处下载:https : //sites.google.com/a/chromium.org/chromedriver/downloads
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句