我尝试使用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
答案 0 :(得分:0)
<强>解决强>
我需要更新ChromeDrive并替换之前的ChromeDrive。 在我的项目目录/ lib
下在此处下载:https://sites.google.com/a/chromium.org/chromedriver/downloads
答案 1 :(得分:0)
是的,我建议你可以这样提及C:\\Users\\mona\\Downloads\\chromedriver_win32\\chromedriver.exe