webdriver.Chrome() 不工作 [英] webdriver.Chrome() is not working

查看:25
本文介绍了webdriver.Chrome() 不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Python 3 中使用 Selenium.我安装了 Selenium 和 Chrome Webdriver.Pip 预装了 Python 3.但是,我收到此错误消息.我昨天开始学习这门语言,所以如果错误很愚蠢,请多多包涵.

I am trying to use Selenium with Python 3. I installed Selenium and Chrome Webdriver. Pip was pre-installed with Python 3. However, i am getting this error message. I literally started learning this language yesterday, so please be kind if the error is silly.

代码

from selenium import webdriver
driver = webdriver.Chrome()
driver.get("https://www.google.com/")
driver.close()

错误信息

"C:\Users\...\PycharmProjects\untitled\venv\Scripts\python.exe" 
"C:/Users/.../.PyCharmCE2018.1/config/scratches/Hello World.py"
Traceback (most recent call last):
File "C:/Users/.../.PyCharmCE2018.1/config/scratches/Hello World.py", line 4, in <module>
driver = webdriver.Chrome()
AttributeError: module 'selenium.webdriver' has no attribute 'Chrome'
Process finished with exit code 1

任何帮助将不胜感激.谢谢.

Any help will be appreciated.Thanks.

推荐答案

为此你必须下载 Chromedriver 的稳定版本,然后它才能工作

For that you have to download the stable release of Chromedriver, Then it will work

转到此链接并下载它 - https://sites.google.com/a/chromium.org/chromedriver/home

go to this link and download it - https://sites.google.com/a/chromium.org/chromedriver/home

这篇关于webdriver.Chrome() 不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆