1. 程式人生 > >Mac下用selenium啟動Chrome瀏覽器問題解決

Mac下用selenium啟動Chrome瀏覽器問題解決

chrome瀏覽器 mac sele 解決方法 之前 med from nbsp bdr

之前在mac的Python shell中,無法通過driver=webdriver.Chrome()啟動谷歌瀏覽器。現解決方法如下:

(前提:Chromedriver在/usr/local/bin/目錄下)

from selenium import webdriver
browser = webdriver.Chrome(executable_path="/usr/local/bin/chromedriver")

或:

from selenium import webdriver
path = "/usr/local/bin/chromedriver"
driver = webdriver.Chrome(path)

或:

from selenium import webdriver
driver = webdriver.Chrome("/usr/local/bin/chromedriver")

Mac下用selenium啟動Chrome瀏覽器問題解決