I have installed all the file and packages like python, pip, selenium and i am running a python code in PyCharm, but it is still showing me this error whenever i run my code.
Error showing while running python file.
Traceback (most recent call last): File "C:/Users/aman.k/PycharmProjects/SeleniumScripts/MyFirstSeleniumScript.py", line 3, in import webdriver ModuleNotFoundError: No module named 'webdriver'
Code running environment:
Here is my code which i am trying to run.
The Python "ModuleNotFoundError: No module named 'selenium'" occurs when we forget to install the selenium module before importing it or install it in an incorrect environment. To solve the error, install the module by running the pip install selenium command.
To install the Selenium bindings in our system, run the command: pip install selenium. As this is done, a folder called Selenium should get created within the Python folder. To update the existing version of Selenium, run the command: pip install –U selenium.
From your screenshot, I can see that selenium is not installed. Please follow the next step:
1st solution:
File -> Settings -> Inside your project's name -> Project Interpreter -> click on "+" button -> search for selenium (current version 3.141.0) -> click on install -> restart PyCharm.
2nd solution:
Or click on the selenium word from the first line (from the import) and wait until a solution will be shown. The solution will say install selenium package. Press on it and you are done.
Screenshot for solution 2:
3rd solution:
If you have already installed the selenium then you need to install webdirver. Follow the following screenshot to solve it.
Screenshot for 3rd solution:
Pychram can use more than one environment for running your project. I guess you are using a different environment in which you have installed tools. Change the env by going
File > Settings > Prefrences > Project Interpreter.
Either change that to the local env or click + button below the window and add that package to current env.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With