网络驱动程序.Chrome() 不工作



我正在尝试将Selenium与Python 3一起使用。我安装了Selenium和Chrome Webdriver。Pip 预装在 Python 3 中。但是,我收到此错误消息。我昨天真的开始学习这门语言,所以如果错误很愚蠢,请善待。

法典

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

错误信息

"C:Users...PycharmProjectsuntitledvenvScriptspython.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

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

为此,您必须下载Chromedriver的稳定版本,然后它将起作用

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

from selenium import webdriver
url = 'https://mail.protonmail.com/create/new?language=en'
driver.get(url)

它应该有效。它对我有用:)