当运行webdriver.Chrome(),出现如下错误:
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary
原因是没有找到chrome运行路径,也就是说你的chrome不是默认安装地址
修改如下:
增加binary_options:
options = webdriver.ChromeOptions() options.binary_location = binary_location #谷歌地址 #driver地址 brower = webdriver.Chrome(chrome_driver_binary,chrome_options=options)
运行时出现如下错误:
selenium.common.exceptions.WebDriverException: Message: 'Python36' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
奇怪,我的chromedriver已经有了,并放到python36安装目录,难道多此一举,不应该写driver目录,实验一下,把
brower = webdriver.Chrome(chrome_driver_binary,chrome_options=options)修改为
brower = webdriver.Chrome(chrome_options=options),去掉driver目录,运行成功