【Mac】 Chromedriver 存放路徑


使用Selenium時,卡在喚起Chrome,原來Chrome偷偷更新,導致版本沒對應上,正常喚起Chrome

SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 80

 

下載地址:http://chromedriver.storage.googleapis.com/index.html

解壓到 /User/XXX/download 的目錄(默認路徑)

將已解壓的 Chromedriver,移動到 /usr/bin,則可正常喚起Chrome

mac對 /usr/bin 這個路徑,有權限的限制,
root用戶也無法正常移動文件過去,需關閉 mac的SIP方法 ,參考:https://jingyan.baidu.com/article/e5c39bf5d13bf939d76033cf.html

 

A、重啟Mac,然后按住:Command+R,進入恢復模式

B、進入后打開實用工具選項-選擇終端

C、輸入csrutil disable,重啟電腦(如需恢復,進入恢復模式后,終端輸入csrutil enable

D、重啟電腦后,進入終端,輸入sudo mv chromedriver /usr/bin將ChromeDriver移動到/usr/bin

E、cd 到 /usr/bin,執行 sudo chmod a+x chromedriver修改權限(這一步我沒做,也正常)

F、重新執行 seliumn 的測試用例,可正常喚起Chrome了


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM