Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ModuleNotFoundError: No module named 'selenium'

I get an error while running this selenium script. Please suggest what can be done to fix this: Script:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import re
import csv
import time
driver = webdriver.chrome("<webdriver path>")

driver.get("https://www.google.com/")
driver.find_element_by_xpath('//*[@title="Search"]')
send_keys('abc')
driver.find_element_by_xpath('//*[@class="sbico _wtf _Qtf"]').click()
time.sleep(5)
driver.find_element_by_xpath('//[@id="rso"]/div[1]/div/div[1]/div/div/h3/a')
print(var)

Error:

Traceback (most recent call last): File "C:/Users/admin/Desktop/test2.py", line 2, in from selenium import webdriver ModuleNotFoundError: No module named 'selenium'

I have installed Python 3.6 on win 7 Professional 32 bit. I have Selenium Standalone Server version 3.4.0(link)

like image 200
Google User Avatar asked May 05 '17 05:05

Google User


2 Answers

Try installing selenium using pip. Use the following command.

python -m pip install -U selenium
like image 76
shahin Avatar answered Nov 10 '22 09:11

shahin


Seems like you have not run the installation command for webdriver_manager.

Use the following command:

pip install webdriver_manager

But before this, make sure you have properly installed selenium as well. If not, use the following command to install selenium:

pip install selenium
like image 30
NAVNEET CHANDAN Avatar answered Nov 10 '22 09:11

NAVNEET CHANDAN