Installing Selenium and ChromeDriver on Ubuntu
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的更多相关文章
- Pyinstaller打包selenium去除chromedriver黑框问题解决!!!
Pyinstaller打包selenium去除chromedriver黑框问题解决!!! 问题描述 [1123/101706.932:ERROR:gpu_process_transport_f ...
- 爬虫进阶之Selenium和chromedriver,动态网页(Ajax)数据抓取
什么是Ajax: Ajax(Asynchronouse JavaScript And XML)异步JavaScript和XML.过在后台与服务器进行少量数据交换,Ajax 可以使网页实现异步更新.这意 ...
- 爬虫--selenium之 chromedriver与chrome版本映射表(最新至v2.46版本chromedriver)
本文主要整理了selenium的chromedriver与chrome版本映射表,并且持续更新中..... 1.selenium之 chromedriver与chrome版本映射表(最新至v2.46版 ...
- Centos7安 装python3+Selenium+chrome+chromedriver
Centos7安装python3+Selenium+chrome+chromedriver详细python2和python3共存,Selenium错误的处理更新Centos源 wget -O /etc ...
- ubuntu下的python请求库的安装——Selenium,ChromeDriver,GeckoDriver,PhantomJS,aiohttp
Selenium安装: pip3 install selenium ChromeDriver安装: 在这链接下载对应版本:https://chromedriver.storage.googleapis ...
- python Selenium启动chromedriver
从网上下载对应版本的chromedriver之后,里面的内容仅为一个.exe文件, 将其解压在chrome的安装目录下(C:\Program Files (x86)\Google\Chrome\App ...
- selenium缺少chromedriver解决方法
1.安装好selenium,运行一段测试代码: from selenium import webdriver brower = webdriver.Chrome() brower.get('www.b ...
- python使用selenium安装chromedriver的问题
环境 win64位,python3.6, 问题与解决 说来也巧,今天无意中解决了两个多月前的问题,即用selenium调用chrome浏览器报错的问题:起因是在知乎中看到了一篇12306抢票的文章,用 ...
- 安装selenium和chromedriver
网上找的算法,在运行爬虫代码时,需要Selenium+Phantomjs实现,我改成了用Selenium+Chrome:针对指定网址,自动打开浏览器,输入关键词搜索,并保存搜索的内容. 1. 安装se ...
随机推荐
- BZOJ 3676: [Apio2014]回文串
3676: [Apio2014]回文串 Time Limit: 20 Sec Memory Limit: 128 MBSubmit: 2013 Solved: 863[Submit][Status ...
- 【hihocoder#1413】Rikka with String 后缀自动机 + 差分
搞了一上午+接近一下午这个题,然后被屠了个稀烂,默默仰慕一晚上学会SAM的以及半天4道SAM的hxy大爷. 题目链接:http://hihocoder.com/problemset/problem/1 ...
- Linux安装库文件(环境变量和makefile)
CFLAGS 表示用于 C 编译器的选项,CXXFLAGS 表示用于 C++ 编译器的选项.这两个变量实际上涵盖了编译和汇编两个步骤. CFLAGS/CPPFLAGS: 指定头文件(.h文件)的路径, ...
- HTML组成与语法
http://blog.csdn.net/niushitang/article/details/8230014 <HTML> <HEAD> <TITLE& ...
- Linux下Steam中支持中文的办法
搜索过好几个解决方案,诸如添加skin等等,在我的ARCH机器上似乎都不行然后在搜索linux steam cjk时, 发现一个链接中有解决DOTA2显示中文不正确的问题,感觉可能有用,就参考着搞定了 ...
- TeXstudio 编写Latex论文的若干问题
TeXstudio 编写Latex论文的若干问题解决方案总结 问题1: 如何安装TeXstudio 以及 Texstudio当中的中文字体使用问题. 一.如何安装TeXstudio 很 ...
- 美团HD(4)-二级联动效果
DJNavDropView.m #import "DJNavDropView.h" #import "DJCategory.h" #import "D ...
- telnet报“Unable to connect to remote host:Connection refused”错误
Linux下面telnet ip 端口号 报错误"Unable to connect to remote host:Connection refused"的时候,大部分是目标机的端 ...
- SQL汉字转拼音函数-支持首字母、全拼
SQL汉字转拼音函数-支持首字母.全拼 FROM :http://my.oschina.net/ind/blog/191659 作者不详 --方法一sqlserver汉字转拼音首字母 --调用方法 s ...
- fedora配置163为yum的源
一种方法: 1.下载 http://mirrors.163.com/.help/fedora-163.repo 和 http://mirrors.163.com/.help/fedora-updat ...