[英]Start Chrome browser in webdriver
Sorry for stupid question, but how to start Chrome browser in webdriver? 抱歉,您有愚蠢的问题,但是如何在webdriver中启动Chrome浏览器? I know that I have to specify the path to chromedriver.exe.
我知道我必须指定chromedriver.exe的路径。 Problem is I unable to download chromedriver.exe it is depricated.
问题是我无法下载chromedriver.exe,它已被删除。 Also files that I found doesn't have .exe extension.
我发现的文件也没有.exe扩展名。 I am using eclipse, Java.
我正在使用Eclipse,Java。 Please help!
请帮忙! I did everything step by step as suggested but its doesn't work.
我按照建议的步骤进行了所有操作,但是没有用。 Here is my code:
这是我的代码:
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.Test;
public class chrome {
@Test public void test(){
System.setProperty("webdriver.chrome.driver", "C:\\chromedriver_win32(2)\\chromedriver");
ChromeDriver driver = new ChromeDriver();
driver.get("http:\\yahoo.com");
}
}
And here is the error: 这是错误:
FAILED: test java.lang.IllegalStateException: The driver executable does not exist: C:\\chromedriver_win32(2)\\chromedriver 失败:测试java.lang.IllegalStateException:驱动程序可执行文件不存在:C:\\ chromedriver_win32(2)\\ chromedriver
Download update version of chrome driver(in below code example E://chromedriver.exe) from http://code.google.com/p/chromedriver/downloads/list 从http://code.google.com/p/chromedriver/downloads/list下载chrome驱动程序的更新版本(在下面的代码示例E://chromedriver.exe中)
public class ChromeTest {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "E://chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("http://www.test.com");
}
}
Read here for links and the getting started doc. 在此处阅读链接和入门文档。 When you download, you get a zip file, extract contents which has the exe.
下载时,您将获得一个zip文件,请提取包含exe的内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.