ModuleNotFoundError:尽管下载了硒,但没有名为“ selenium”消息的模块

时间:2019-02-26 10:09:38

标签: python-3.x

我试图在PyCharm社区版2018.8.2中导入硒,这给了我这个错误:

这是我的代码:

from selenium import webdriver
from getpass import getpass
usr = input('Enter your username or email : ')
pwd = getpass("Enter your password : ")
driver = webdriver.Chrome()
driver.get('https://twitter.com/login')
usr_box = driver.find_element_by_class_name('js-username-field')
usr_box.send_keys(usr)
pwd_box = driver.find_element_by_class_name('js-username-field')
pwd_box.send_keys(pwd)
login_button = driver.find_element_by_css_selector('button.submit.EdgeButton.EdgeButton-- 
    primary.EdgeButtom--medium')
login_button.submit()

1 个答案:

答案 0 :(得分:0)

使用以下方法检查是否已安装硒:

sudo pip3 install selenium #for python3

或者:

sudo pip install selenium #for python2