Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I still specify a path to chromedriver using ChromeOptions in Python?

I received this error: "WebDriverException: Message: 'chromedriver' executable needs to be in PATH." The only way I was able to fix it was to manually add one of the locations of chromedriver like this:

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

After Chrome launched, I then received this error: "You are using an unsupported command-line flag: --ignore-certifcate-errors. Stability and security will suffer."

I'd like to try using the following code to address this new error but I don't know how/if I can combine it with manually specifying chromedriver's location?

options = webdriver.ChromeOptions()
options.add_experimental_option("excludeSwitches", ["ignore-
certificate-errors"])
browser = webdriver.Chrome(chrome_options=options)
browser.get("http://google.com/")
like image 584
Ann Colvin Avatar asked Apr 13 '17 02:04

Ann Colvin


1 Answers

All you have to do is specify the webdriver location as an argument when calling the Chrome webdriver like so:

chrome_path = r"/Users/anncolvin/.rvm/bin/chromedriver"
browser = webdriver.Chrome(chrome_path, chrome_options=options)
like image 121
kurczynski Avatar answered Sep 17 '22 19:09

kurczynski