Mac下手動安裝Chromedriver.exe
阿新 • • 發佈:2019-01-05
Step 1: 開啟https://sites.google.com/a/chromium.org/chromedriver/downloads,找到最新版本的chromedriver.exe;
Step 2: Mac下只有chromedriver_mac32.zip,無論是32的Mac還是64的Mac都下這個版本就行;<現在有mac64的了>
Step 3: 解壓包,並新增字尾.exe;
Step 4: 開啟Finder,在Go menu選擇Go To Folder,輸入/usr/bin以開啟該路徑;
Step 5: 將chromedriver.exe放在/usr/bin下面即可.
如果使用Chromedriver還報如下異常:
1 | 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程式中新增:
12 | System.setProperty( "webdriver.chrome.driver" , "/usr/bin/chromedriver.exe" ); WebDriver driver = new ChromeDriver(); |
如果遇到以下異常,可以先更新最新版的chromedriver.exe看看:
1 | SessionNotCreatedError |