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. 学习Struts2的第一个应用步骤

    ---恢复内容开始--- 一.在官网 http://struts.apache.org/下载struts-2.3.31-all 1.  打开struts-2.3.31-all,将struts-2.3. ...

  2. C#事务

    看了很多关于事务的概念,还是觉得维基百科上说的最好: 数据库事务(简称:事务)是数据库管理系统执行过程中的一个逻辑单位,由一个有限的数据库操作序列构成. 一个数据库事务通常包含了一个序列的对数据库的读 ...

  3. EF增删库查

    public async Task<bool> Add(fu_ocrresult model) { using (var db = new GENEModel()) { //1.将实体对象 ...

  4. Resource leak: 'context' is never closed

    from: http://stackoverflow.com/questions/14184059/spring-applicationcontext-resource-leak-context-is ...

  5. Dictionary

    命名空间:System.Collections.Generic(程序集:mscorlib) Dictionary<TKey, TValue> 类   一般用法:通过key获取value,k ...

  6. Linux可信计算机制模块详细分析之核心文件分析(8)tpm.c核心代码注释(中)

    /*设置TPM命令格式*/ ssize_t tpm_getcap(struct device *dev, __be32 subcap_id, cap_t *cap, const char *desc) ...

  7. Web Service简要概念,学习记录!

    Web Service平台需要一套协议来实现分布式应用程序的创建.任何平台都有它的数据表示方法和类型系统.要实现互操作性,Web Service平台必须提供一套标准的类型系统,用于沟通不同平台.编程语 ...

  8. [DUBBO]Dubbo控制台查看方法

    1.dubbo控制台安装方法网上较多,例如转载http://dtbuluo.com/blog/archives/37 2.dubbo控制台查看 由于我们组是开发安装的dubbo.zookeeper等等 ...

  9. C3P0连接池配置和实现详解

    一.配置 <c3p0-config> <default-config> <!--当连接池中的连接耗尽的时候c3p0一次同时获取的连接数.Default: 3 --> ...

  10. SharePoint "System.Data.SqlClient.SqlException (0x80131904): Parameter '@someColumn' was supplied multiple times.“

    最近在处理SharePoint Office365的相关开发的时候发现了这样一个奇怪的现象: 无法通过API更新Editor field,只要已更新就会throw Exception,由于是Offic ...