Install Chrome
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
dpkg -i google-chrome-stable_current_amd64.deb
apt-get update
apt-get install -f
Install pip
apt-get install python-pip
Install Selenium
export LC_ALL=C
pip install selenium
Install Xvfb
apt-get install xvfbDownload ChromeDriver
wget https://chromedriver.storage.googleapis.com/2.34/chromedriver_linux64.zip
unzip chromedriver_linux64.zip
Run Xvfb
Xvfb :22
Test selenium
attention: google chrome will crash if running under root user. Switch user first if your are root.
export DISPLAY=:22
python
from selenium import webdriver
driver = webdrvier.Chrome("./chromedriver")
driver.get("http://www.baidu.com")
#should return https protocl url
driver.execute_script("return window.location")
#should return an element
driver.execute_script("return document.getElementById('kw')")