Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (19.7k points)

I'm trying to write a script to check a website. It's the first time I'm using selenium. I'm trying to run the script on an OSX system. Although I checked in /Library/Python/2.7/site-packages and selenium-2.46.0-py2.7.egg is present when I run the script it keeps telling me that there is no selenium module to import.

This is the log that I get when I run my code:

Traceback (most recent call last):

  File "/Users/GiulioColleluori/Desktop/Class_Checker.py", line 10, in <module>

    from selenium import webdriver

ImportError: No module named 'selenium'

1 Answer

0 votes
by (62.9k points)

If you have pip installed you can install selenium by executing the following command on the CLI.

pip install selenium

or depending on your permissions you may use:

sudo pip install selenium

pip is a more reliable package installer than easy_install as it was built to improve easy_install.

I would also suggest that when creating new projects you do so in virtual environments, even in a simple Selenium project. You can read more about virtual environments here. In fact, pip is included out of the box with virtualenv(virtualenv is a tool to create isolated Python environments. Since Python 3.3, a subset of it has been integrated into the standard library under the venv module.)

If you want to Learn What is Selenium visit this Selenium Interview Questions by Intellipaat.

If you are interested to learn Selenium on a much deeper level and want to become a professional in the testing domain, check out Intellipaat’s automation testing course!

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories

...