Nathaniel Lin
Nathaniel Lin

Reputation: 11

ModuleNotFoundError: No module named 'webdriver_manager' error using Webdriver Manager for Selenium Python

I am creating a project to automatically open a page, I installed Selenium, but it says that there:

no such module as webdriver_manager 

and the directory "C:\Users\Nina\chromedriver.exe" is not valid.

Here's my code:

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
import webdriver_manager as manager
from selenium.webdriver.common.by import By

s=Service(manager.ChromeDriverManager().install())
driver = webdriver.Chrome(service=s)
driver.maximize_window()
driver.get('https://cms.instructure.com/courses/500236/pages/week-14-november-22-23')

I've been working on this for 2 hours already, so can someone help me debug these errors?

Upvotes: 1

Views: 5983

Answers (1)

undetected Selenium
undetected Selenium

Reputation: 193108

This error message...

ModuleNotFoundError: No module named 'webdriver_manager' 

...implies that the webdriver_manager wasn't properly installed.


Reasons

Possibly you installed webdrivermanager as:

pip install webdrivermanager

Or you have installed webdriver-manager as:

pip install webdriver-manager

Hence you see the error.


Solution

Instead of those, you need to install webdriver_manager as:

pip3 install webdriver_manager

Update your code as:

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager

s=Service(ChromeDriverManager().install())
driver = webdriver.Chrome(service=s)
driver.maximize_window()
driver.get('https://cms.instructure.com/courses/500236/pages/week-14-november-22-23')

References

You can find a couple of relevant detailed discussion in:

Upvotes: 3

Related Questions