I recently got Selenium, Google Chrome, and Chromedriver installed and working on a Digitalocean instance running 64-bit U Buntu 14.04. Here's how:
First, install Google Chrome for Debian/ubuntu:
sudo apt-get install libxss1 libappindicator1 libindicator7wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.debsudo dpkg -i google-chrome*.debsudo apt-get install -f
Now, let's install so xvfb
we can run Chrome headlessly:
sudo apt-get install xvfb
Install chromedriver:1
sudo apt-get install unzipwget -N http://chromedriver.storage.googleapis.com/2.20/chromedriver_linux64.zipunzip chromedriver_linux64.zipchmod +x chromedriversudo mv -f chromedriver /usr/local/share/chromedriversudo ln -s /usr/local/share/chromedriver /usr/local/bin/chromedriversudo ln -s /usr/local/share/chromedriver /usr/bin/chromedriver
Install some Python dependencies for Selenium:
sudo apt-get install python-pip## (Optional) Create and enter a virtual environment:# sudo apt-get install python-virtualenv# virtualenv env# source env/bin/activatepip install pyvirtualdisplay selenium
Now, we can do stuff like this with Selenium in Python:
FromPyvirtualdisplayImportDisplayFromSeleniumImportwebdriverdisplay = display (visible=0size=< Span class= "P" > (800600 Display. Start () driver = webdriver.chrome () driver. Get ( ' http://christopher.su ' ) print driver. Title
Footnotes
1:you can find all the chromedriver releases here. If you ' re using a 32-bit system or a non-linux OS, the Chromedriver download used above won ' t work.
Installing Selenium and Chromedriver on Ubuntu