问题描述
我在从 python 中的 selenium 获取 Chrome 浏览器实例时遇到问题.我使用的是 Windows 8.我已经下载了 chromedriver 二进制文件并将其添加到我的路径中,但在 Python 中出现以下错误:
I am having issues getting an instance of a Chrome browser from selenium in python. I'm using Windows 8. I have downloaded the chromedriver binary and added it to my path but I get the following error in Python:
selenium.common.exceptions.WebDriverException: Message: 'ChromeDriver executable needs to be available in the path.
以下行出现此错误:
driver = webdriver.Chrome(executable_path='path ochromedriver_win32_2.0')
推荐答案
两种设置方式,你搞混了.
Two ways to set it, you somehow mixed up.
将
chromedriver.exe的路径放入PATH(在 Windows 上),这样您的PATH设置是正确的,但是你需要调用默认构造函数.
Put the
chromedriver.exe's path intoPATH(on Windows), so yourPATHsetting is correct, but you need to call the default constructor.
driver = webdriver.Chrome()
在 webdriver.Chrome(executable_path='some path') 中指定路径.这里需要的是可执行文件的完整路径,而不是目录.
Specify the path in webdriver.Chrome(executable_path='some path'). Here you need the full path to the executable, not the directory.
webdriver.Chrome(executable_path=r'C:UsersHaranKumarDownloadschromedriver_win32_2.0chromedriver.exe')
选择你想要的任何一个.
Choose either one you want.
这篇关于让 Chrome 通过 Selenium 启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)