python Selenium in Ubuntu 16.04
Selenium is a web browser automation software. In Ubuntu 16.04 it doesn't work out of the box, and external components should be installed. In this post I note how to install them locally without affecting the system.
First, I create a virtual environment named selenium:
$ mkdir ~/opt
$ cd ~/opt
$ virtualenv selenium
$ cd selenium
$ source bin/activate
Note that the command prompt is changed from "$" to "(selenium) $".
Second, install selenium using pip.
(selenium) $ pip install selenium
Third, download the driver from https://github.com/mozilla/geckodriver/releases, unpack it and move to the virtual environment bin directory, in which selenium will find the driver.
(selenium) $ tar zxf ..../geckodriver-vX.XX.X-linux64.tar.gz
(selenium) $ mv geckodriver bin/
Installation is complete. Check that a sample program works: http://selenium-python.readthedocs.io/getting-started.html.
Finally, make an usability improvement by providing a shortcut to selenium:
$ mkdir ~/bin # if not already created $ ln -s ~/opt/selenium/bin/activate ~/bin/activate-selenium
Now selenium environment can be activated from anywhere:
$ source activate-selenium (selenium) $