3

I'm trying to get a headless webscraper going using firefox and geckodriver and I'm trying to get the paths using webdriver_manager.

I've run

pip install webdriver_manager

and I'm trying to use this to open the browser

from selenium import webdriver
from webdriver_manager.firefox import GeckoDriverManager

browser = webdriver.Firefox(executable_path=GeckoDriverManager().install())

However, I keep getting a runtime error

ModuleNotFoundError: No module named 'webdriver_manager'

I've already added the library to the python interpreter in PyCharm, but I just can't get it to work.

4 Answers4

3

I found another solution. Go to Python Packages at the bottom panel, search for "webdriver-manager" and install it manually

1

I had a similar problem for a long while and I found a solution that actually worked for me:

python3 -m pip install webdriver_manager

All of my research told me in one form or another to run the following that never worked for me:

pip install webdriver_manager

Running the first command instead for whatever reason actually allowed me to utilize the module.

Dharman
  • 30,962
  • 25
  • 85
  • 135
1

First of all - do you use virtualenv or global env? It's better to use virtualenv. To create venv and activate it use this in your project directory

python3 -m venv .venv
source .venv/bin/activate (for macOS/linux)
.venv/bin/activate.bat (for Windows)
pip3 install webdriver_manager

In Pycharm then:

  1. Open Pycharm "Settings" (for MacOS "Preferences")
  2. Project->Python Interpreter
  3. Select wheel->Add
  4. Choose existing interpreter in .venv in your project directory

Cheers! Pycharm now sees the webdriver_manager imports.

gore
  • 551
  • 2
  • 20
0

I also had the same error and weirdly the problem was VCS and me pulling this project from Git. If there are no other options at all, you could try this:

  • close PyCharm
  • delete the .idea/ folder of that project
  • restart PyCharm and configure interpreter again

Somehow this .idea folder messed up the project. aber deleting everything came to normal for me.

Kami
  • 164
  • 11