Selenium and Python 3 on Ubuntu

You need to install the selenium library for Python. Don’t use the version from the Ubuntu repository, install it instead using pip.

So first, we install pip and upgrade it in the process.

sudo apt-get install python3-pip
pip3 install --upgrade pip

Then we install selenium

 pip3 install -U selenium

We also need to install the geckodriver. Choose the version for your platform and unzip it in a directory.

Set the PATH to point to the geckodriver.

 export PATH=/home/dom/Programs/geckodriver:$PATH

(It may be a good idea to set this in your startup or environment script.)

Follow the examples in the Selenium Python documentation pages. Some examples may need some fine tuning.

If you have both Python 2.x and Python 3.x on your system, please make sure to choose the correct one when running your scripts.

Leave a Reply