简体   繁体   English

ImportError: cannot import name 'webdriver' from 'selenium' error using Selenium and WebDriver through Python

[英]ImportError: cannot import name 'webdriver' from 'selenium' error using Selenium and WebDriver through Python

I wanted to code a program with selenium, so I wanted to test it but:我想用 selenium 编写一个程序,所以我想测试它,但是:

from selenium import webdriver

When Im running this program, it says:当我运行这个程序时,它说:

ImportError: cannot import name 'webdriver' from 'selenium'

This error message...此错误消息...

ImportError: cannot import name 'webdriver' from 'selenium'

...implies that there was an ImportError when you tried to import webdriver from the selenium module. ...暗示当您尝试从selenium模块导入webdriver时出现ImportError


Reason原因

This ImportError is observed when you try to execute the line:当您尝试执行该行时,会观察到此ImportError

from selenium import webdriver

without installing Selenium .无需安装Selenium


Solution解决方案

The very first step to use Selenium will be to install Selenium Python bindings using the following command:使用 Selenium 的第一步是使用以下命令安装Selenium Python 绑定

pip install -U selenium

or upgrade Selenium Python bindings using the following command:或使用以下命令升级Selenium Python 绑定

pip install -U selenium

Reference参考

You can find a couple of relevant discussions in:您可以在以下位置找到一些相关的讨论:

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ImportError: cannot import name 'Chromedriver' from 'selenium' error using ChromeDriver and Chrome through Selenium - ImportError: cannot import name 'Chromedriver' from 'selenium' error using ChromeDriver and Chrome through Selenium NameError: name 'close' is not defined error using Selenium Webdriver through Python - NameError: name 'close' is not defined error using Selenium Webdriver through Python ImportError:无法从“selenium.webdriver.chrome”导入名称“remote_connection” - ImportError: cannot import name 'remote_connection' from 'selenium.webdriver.chrome' 导入错误:无法从“selenium.webdriver.support.ui”导入名称“expected_conditions” - ImportError: cannot import name 'expected_conditions' from 'selenium.webdriver.support.ui' 从selenium导入webdriver使用Python时 - when using from selenium import webdriver Python 使用 Python Selenium WebDriver 时出现错误“name 'by' is not defined” - Error "name 'by' is not defined" using Python Selenium WebDriver selenium 无法在 ubuntu 中导入名称 webdriver - selenium cannot import name webdriver in ubuntu 导入错误:无法导入名称“webdriver” - ImportError: cannot import name 'webdriver' ImportError:无法导入名称“ webdriver” - ImportError: Cannot import name 'webdriver'' Python 代码返回“无法从‘selenium.webdriver.common.keys’导入名称‘keys’” - Python code returns "cannot import name 'keys' from 'selenium.webdriver.common.keys'"
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM