Mac下安装Chromedriver.exe

时间:2016-03-07 13:48:13   收藏:0   阅读:3102

Step 1: 打开https://sites.google.com/a/chromium.org/chromedriver/downloads,找到最新版本的chromedriver.exe;

Step 2: Mac下只有chromedriver_mac32.zip,无论是32的Mac还是64的Mac都下这个版本就行;

Step 3: 解压包,并添加后缀.exe;

Step 4: 打开Finder,在Go menu选择Go To Folder,输入/usr/bin以打开该路径;

Step 5: 将chromedriver.exe放在/usr/bin下面即可.

 

如果使用Chromedriver还报如下异常:

java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver. The latest version can be downloaded from http://chromedriver.storage.googleapis.com/index.html

那需要在Java程序中添加:

System.setProperty("webdriver.chrome.driver","/usr/bin/chromedriver.exe");
WebDriver driver = new ChromeDriver();

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!