I recently got Selenium, Google Chrome, and ChromeDriver installed and working on a DigitalOcean instance running 64-bit Ubuntu 14.04. Here’s how:

First, install Google Chrome for Debian/Ubuntu:

sudo apt-get install libxss1 libappindicator1 libindicator7
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb sudo dpkg -i google-chrome*.deb
sudo apt-get install -f

Now, let’s install xvfb so we can run Chrome headlessly:

sudo apt-get install xvfb

Install ChromeDriver:1

sudo apt-get install unzip

wget -N http://chromedriver.storage.googleapis.com/2.20/chromedriver_linux64.zip
unzip chromedriver_linux64.zip
chmod +x chromedriver sudo mv -f chromedriver /usr/local/share/chromedriver
sudo ln -s /usr/local/share/chromedriver /usr/local/bin/chromedriver
sudo 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/activate pip install pyvirtualdisplay selenium

Now, we can do stuff like this with Selenium in Python:

from pyvirtualdisplay import Display
from selenium import webdriver display = Display(visible=0, size=(800, 600))
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的更多相关文章

  1. Pyinstaller打包selenium去除chromedriver黑框问题解决!!!

    Pyinstaller打包selenium去除chromedriver黑框问题解决!!!     问题描述 [1123/101706.932:ERROR:gpu_process_transport_f ...

  2. 爬虫进阶之Selenium和chromedriver,动态网页(Ajax)数据抓取

    什么是Ajax: Ajax(Asynchronouse JavaScript And XML)异步JavaScript和XML.过在后台与服务器进行少量数据交换,Ajax 可以使网页实现异步更新.这意 ...

  3. 爬虫--selenium之 chromedriver与chrome版本映射表(最新至v2.46版本chromedriver)

    本文主要整理了selenium的chromedriver与chrome版本映射表,并且持续更新中..... 1.selenium之 chromedriver与chrome版本映射表(最新至v2.46版 ...

  4. Centos7安 装python3+Selenium+chrome+chromedriver

    Centos7安装python3+Selenium+chrome+chromedriver详细python2和python3共存,Selenium错误的处理更新Centos源 wget -O /etc ...

  5. ubuntu下的python请求库的安装——Selenium,ChromeDriver,GeckoDriver,PhantomJS,aiohttp

    Selenium安装: pip3 install selenium ChromeDriver安装: 在这链接下载对应版本:https://chromedriver.storage.googleapis ...

  6. python Selenium启动chromedriver

    从网上下载对应版本的chromedriver之后,里面的内容仅为一个.exe文件, 将其解压在chrome的安装目录下(C:\Program Files (x86)\Google\Chrome\App ...

  7. selenium缺少chromedriver解决方法

    1.安装好selenium,运行一段测试代码: from selenium import webdriver brower = webdriver.Chrome() brower.get('www.b ...

  8. python使用selenium安装chromedriver的问题

    环境 win64位,python3.6, 问题与解决 说来也巧,今天无意中解决了两个多月前的问题,即用selenium调用chrome浏览器报错的问题:起因是在知乎中看到了一篇12306抢票的文章,用 ...

  9. 安装selenium和chromedriver

    网上找的算法,在运行爬虫代码时,需要Selenium+Phantomjs实现,我改成了用Selenium+Chrome:针对指定网址,自动打开浏览器,输入关键词搜索,并保存搜索的内容. 1. 安装se ...

随机推荐

  1. Redis 常用操作

    import org.junit.Before;import org.junit.Test;import redis.clients.jedis.Jedis;import java.util.Set; ...

  2. ssh key生成

    Mac电脑用终端生成SSH key 访问自己的Github 字数684 阅读427 评论4 喜欢15 前言:最近有不少刚刚使用github管理代码的开发者或者新手码农在网上 问我如何关联自己的gith ...

  3. Android——WebView

    WebView用途 通过Intent调用系统浏览器: 引言: Uri uri = Uri.parse(url);//url为你要链接的地址 Intent intent = new Intent(Int ...

  4. 调戏OpenShift:一个免费能干的云平台

    一.前因后果 以前为了搞微信的公众号,在新浪sae那里申请了一个服务器,一开始还挺好的 ,有免费的云豆送,但是一直运行应用也要消费云豆,搞得云豆也所剩无几了.作为一名屌丝,日常吃土,就单纯想玩一玩微信 ...

  5. thinkphp访问不存在的模块或者方法跳转到404页面

    使用的thinkphp 版本是3.2.0, 在config.php中配置 404地址,即可: 'TMPL_EXCEPTION_FILE' => './Application/Home/View/ ...

  6. 机器学习——支持向量机(SVM)之Platt SMO算法

    Platt SMO算法是通过一个外循环来选择第一个alpha值的,并且其选择过程会在两种方式之间进行交替: 一种方式是在所有数据集上进行单遍扫描,另一种方式则是在非边界alpha中实现单遍扫描. 所谓 ...

  7. express源码剖析1

    在通读源码之前,先把一些比较难理解的代码吃透: 1.EventEmitter.prototype mixin(app, EventEmitter.prototype, false); app为一个函数 ...

  8. Struts2 更改校验配置文件位置

    @(Java)[Struts|Interceptor] Struts2 更改校验配置文件位置 在Struts2中提供的拦截器校验ValidationInterceptor,该校验器中默认的配置文件位于 ...

  9. vim vi Ubuntu

    在vi编辑模式下按退格键不能删除内容,按方向键不能上下左右移动?如果是则:1. 在vi里非编辑模式下按冒号进入到末行命令模式,然后输入set nocompatible,回车,然后在进入vi编辑模式,看 ...

  10. Linux各个目录的作用及内容

    1)根目录“/”    根目录位于目录结构的最顶层,用斜线(/)表示,类似于Windows操作系统的“C:\“,包含Fedora操作系统中所有的目录和文件. 2)/bin    /bin 目录又称为二 ...