Skip to content

Instantly share code, notes, and snippets.

@yaph
Forked from tristandostaler/InstallSelenium.sh
Created November 1, 2016 19:24
Show Gist options
  • Save yaph/92a7c38249bc56efc0382ec8e5c06a8b to your computer and use it in GitHub Desktop.
Save yaph/92a7c38249bc56efc0382ec8e5c06a8b to your computer and use it in GitHub Desktop.
How to install correctly python Selenium (tested on ubuntu gnome)
apt-get install ipython
apt-get install python-pip
pip install selenium
mkdir /root/bin
cd /root/bin
wget https://github.com/mozilla/geckodriver/releases/download/v0.9.0/geckodriver-v0.9.0-linux64.tar.gz
tar -xvzf geckodriver-v0.9.0-linux64.tar.gz
rm geckodriver-v0.9.0-linux64.tar.gz
chmod +x geckodriver
cp geckodriver wires
export PATH=$PATH:/root/bin/wires
export PATH=$PATH:/root/bin/geckodriver
: '
ipython
%cpaste
## Paste the whole following content:
browser = None
def StartSelenium():
import selenium
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
import binascii
import hashlib
firefox_capabilities = DesiredCapabilities.FIREFOX
firefox_capabilities['marionette'] = True
firefox_capabilities['binary'] = '/usr/bin/firefox'
global browser
browser = webdriver.Firefox(capabilities=firefox_capabilities)
browser.get('https://www.google.com')
--
##End of paste
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment