为什么我不能使用 Selenium Chrome 驱动程序
Why I cannot use Selenium Chrome Driver
我尝试使用 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
已解决
我需要更新 ChromeDriver 并替换之前的。
在我的项目目录/lib
下
在此处下载:https://sites.google.com/a/chromium.org/chromedriver/downloads
是的,我建议你可以这样提C:\Users\mona\Downloads\chromedriver_win32\chromedriver.exe
我尝试使用 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
已解决
我需要更新 ChromeDriver 并替换之前的。 在我的项目目录/lib
下在此处下载:https://sites.google.com/a/chromium.org/chromedriver/downloads
是的,我建议你可以这样提C:\Users\mona\Downloads\chromedriver_win32\chromedriver.exe