在Ubuntu上安装Chrome浏览器和ChromeDriver
启动脚本后报错 selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home
因为各种问题在ubuntu上chrome跑不起来,决定重装,参考别人的教程
一、安装Chrome浏览器
1、安装依赖 sudo apt-get install libxss1 libappindicator1 libindicator7
2、下载Chrome安装包 wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
3、安装 sudo dpkg -i google-chrome*.deb sudo apt-get install -f 浏览器和驱动的版本一定要对应上
查看谷歌浏览器的版本号 google-chrome --version
国内可以访问下面的地址下载chrome http://npm.taobao.org/mirrors/chromedriver/ 点开一个驱动版本有个notes.txt文件 里面有浏览器和驱动的版本对应
二、安装ChromeDriver
1、安装xvfb以便我们可以无头奔跑地运行Chrome sudo apt-get install xvfb
2、安装依赖 sudo apt-get install unzip
3、下载安装包 wget -N http://chromedriver.storage.googleapis.com/2.38/chromedriver_linux64.zip
4、解压缩+添加执行权限 unzip chromedriver_linux64.zip
5、移动 sudo mv -f chromedriver /usr/local/share/chromedriver
6、建立软连接
sudo ln -s /usr/local/share/chromedriver /usr/local/bin/chromedriver
sudo ln -s /usr/local/share/chromedriver /usr/bin/chromedriver
三、无头运行Chrome
1、安装Python依赖
pip3 install selenium
pip3 install pyvirtualdisplay
2、开干
from pyvirtualdisplay import Display
from selenium import webdriver
display = Display(visible=0, size=(800, 600)) # 初始化屏幕 display.start()
driver = webdriver.Chrome() # 初始化Chrome
driver.get('http://www.cnblogs.com/x54256/')
print(driver.title)
在Ubuntu上安装Chrome浏览器和ChromeDriver的更多相关文章
- [转]在ubuntu上安装chrome浏览器
原文链接: https://www.linuxidc.com/Linux/2013-10/91857.htm --------------------------------------------- ...
- 在Ubuntu上安装Chrome Driver和Firefox Driver
在Ubuntu上安装Chrome Driver和Firefox Driver 此文章只介绍Chrome Driver(Firefox Driver和该步骤相同) 下载链接:http://chromed ...
- Ubuntu下安装chrome浏览器步骤
进入 Ubuntu 18.04 桌面,按下 Ctrl + Alt + t 键盘组合键,启动终端. 也可以按下 Win 键(或叫 Super 键),在 Dash 的搜索框中输入 terminal 或“终 ...
- Ubuntu16.4下安装Chrome浏览器以及Chromedriver
一.Chrome浏览器的安装 对于谷歌Chrome32位版本,使用如下链接: wget https://dl.google.com/linux/direct/google-chrome-stable_ ...
- ubuntu下安装chrome浏览器和flash插件
chrome浏览器可在Ubuntu软件中心里搜索并安装 falsh插件首先去官网下载合适的包然后,按照readme安装,执行sudo cp -r usr/* /usr 和sudo cp libflas ...
- Ubuntu下安装chrome浏览器
1.在终端中,输入以下命令: sudo wget http://www.linuxidc.com/files/repo/google-chrome.list -P /etc/apt/sources.l ...
- Ubuntu 17 安装Chrome浏览器
1.进入下载文件存放目录 cd Downloads 2.下载chrome文件 2.1 32位使用如下命令 wget https://dl.google.com/linux/direct/google- ...
- 在ubuntu上安装Chrome
1.下载谷歌浏览器源文件.链接有很多,以下是64位版本的下载地址 https://dl.google.com/linux/direct/google-chrome-stable_current_amd ...
- 【转载】CentOS7 安装Chrome浏览器
本篇文章主要记录如何在CentOS7.0上安装Chrome浏览器. 方法1: Google官方源在国内可能无法正常访问,故而添加Fedora中文社区提供的镜像源: sudo wget http://r ...
随机推荐
- hive 字符集问题 报错 Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:For direct MetaStore DB connections,
学习hive 使用mysql作为元数据 hive创建数据库和切换数据库都是可以的 但是创建表就是出问题 百度之后发现 是编码问题 特别记录一下~~~ 1.报错前如图: 2.在mysql数据库中执行如 ...
- python文章的抓取
# coding = utf-8import urllibimport sysimport urllibimport jsonimport socketimport timesys.path.appe ...
- 响应式网页设计:rem、em设置网页字体大小自适应
「rem」是指根元素(root element,html)的字体大小,好开心的是,从遥远的 IE6 到版本帝 Chrome 他们都约好了,根元素默认的 font-size 都是 16px.这样一个新的 ...
- Oracle 计算两个时间的差值
有两个日期数据START_DATE,END_DATE,欲得到这两个日期的时间差(以天,小时,分钟,秒,毫秒):天:ROUND(TO_NUMBER(END_DATE - START_DATE))小时:R ...
- 运动规划(Motion Planning)
相关介绍: https://mp.weixin.qq.com/s?__biz=MzA5MDE2MjQ0OQ==&mid=2652786406&idx=1&sn=f937dd6a ...
- 多媒体开发之rtsp 打包发流---rtsp发送
http://blog.csdn.net/ttxk/article/details/5279889 http://www.cnblogs.com/haibindev/p/3434922.html rt ...
- 【BZOJ】3401: [Usaco2009 Mar]Look Up 仰望(单调栈)
http://www.lydsy.com/JudgeOnline/problem.php?id=3401 还能更裸一些吗.. 维护一个递减的单调栈 #include <cstdio> #i ...
- 蓝桥杯 第四届C/C++预赛真题(5) 前缀判断(水题)
题目标题:前缀判断 如下的代码判断 needle_start指向的串是否为haystack_start指向的串的前缀,如不是,则返回NULL. 比如:"abcd1234" 就包含了 ...
- Innodb间隙锁,细节讲解(转)
关于innodb间隙锁,网上有很多资料,在此不做赘述,我们讲解一下关于innodb的间隙锁什么情况下会产生的问题. 网上有些资料说innodb的间隙锁是为了防止幻读,这个论点真的是误人子弟.了解inn ...
- RocketMQ性能压测分析(转载)
一 机器部署 1.1 机器组成 1台nameserver 1台broker 异步刷盘 2台producer 2台consumer 1.2 硬件配置 CPU 两颗x86_64cpu,每颗 ...