I am trying to run the command (it is in a python script functional_tests.py):
from selenium import webdriver
I am running Ubuntu and here is a list of how I set up my python environment:
2 sudo apt-get upgrade
3 sudo apt-get update --fix-missing
4 sudo apt-get upgrade -y
5 sudo apt update
6 sudo apt install software-properties-common
9 sudo add-apt-repository ppa:deadsnakes/ppa
10 sudo apt install python3.6
14 mkdir python-tdd-book
15 cd python-tdd-book/
24 sudo apt install python3.6-venv
25 sudo apt install python3.6
28 python3.6 -m venv virtualenv
33 source virtualenv/bin/activate
34 which python
37 pip install "django<1.12" "selenium<4"
46 python -m pip install -U selenium
I did not get any errors when I ran #37 in history (#46 was an attempt to solve it using another solution). I had no errors - all seemed good (except wanting to upgrade version of pip).
This is the output:
(virtualenv) ubuntu@ubuntu2004:~/Documents/python-tdd-book$ python ./functional_tests.py
Traceback (most recent call last):
File "./functional_tests.py", line 1, in <module>
from selenium import webdriver
ModuleNotFoundError: No module named 'selenium'
According to this command I have installed selenium:
(virtualenv) ubuntu@ubuntu2004:~/Documents/python-tdd-book$ pip list
Package Version
---------- -------
Django 1.11.29
pip 18.1
pytz 2022.1
selenium 3.141.0
setuptools 40.6.2
urllib3 1.26.10
You are using pip version 18.1, however version 21.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Not sure why it is NOT seeing the selenium module.