1

我收到此錯誤:「WebDriverException:消息:'chromedriver'可執行文件需要位於PATH中。」 只有這樣,我才得以修復是手動添加chromedriver的這樣的一個位置:我還可以在Python中使用ChromeOptions指定一個chromedriver的路徑嗎?

driver = webdriver.Chrome("/Users/anncolvin/.rvm/bin/chromedriver") 

的Chrome推出後,然後我收到此錯誤:「您使用的是不受支持的命令行標誌:--ignore-certifcate-errors。穩定性和安全性將受到影響。「

我想嘗試使用下面的代碼來解決這個新的錯誤,但我不知道如何將它與手動指定chromedriver的位置相結合?

options = webdriver.ChromeOptions() 
options.add_experimental_option("excludeSwitches", ["ignore- 
certificate-errors"]) 
browser = webdriver.Chrome(chrome_options=options) 
browser.get("http://google.com/") 

回答

0

所有你需要做的就是調用瀏覽器的webdriver像這樣,當指定位置的webdriver作爲參數:

browser = webdriver.Chrome("/Users/anncolvin/.rvm/bin/chromedriver", chrome_options=options) 
相關問題