Search code examples
pythonpython-3.xseleniumselenium-webdriverpycharm

ImportError: No module named 'selenium' in PyCharm


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:

  • Windows OS 8.1
  • Python 3.7.2
  • pip 19.0.2

Here is my code which i am trying to run.

enter image description here


Solution

  • 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:

    enter image description here

    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:

    enter image description here