在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 ...
随机推荐
- centos7.4 update git
1. 查看 yum 源仓库的 Git 信息: yum info git 输入如下内容: Available Packages Name : git Arch : x86_64 Version : 1. ...
- Java 还是 C++?
Java 特别象 C++:由此很自然地会得出一个结论:C++似乎会被Java 取代.但我对这个逻辑存有一些疑问. 无论如何,C++仍有一些特性是Java 没有的.而且尽管已有大量保证,声称Java有一 ...
- 蓝桥杯 第三届C/C++预赛真题(2) 古堡算式(数学题)
福尔摩斯到某古堡探险,看到门上写着一个奇怪的算式: ABCDE * ? = EDCBA 他对华生说:“ABCDE应该代表不同的数字,问号也代表某个数字!” 华生:“我猜也是!” 于是,两人沉默了好久, ...
- iOS #import和@class 区别
@class和#import相似. 1.@class用于 forward-class declaration,只能使用@class, @class class2 @interface class1 { ...
- grid++report中篇
QQ:1187362408 欢迎技术交流和学习 grid++report中篇(grid++report): TODO: 1.grid++report:简单介绍( Grid++Report 是一款高性能 ...
- iOS-iOS9.Plist插入网络安全xml
//iOS9 设置网络 Plist文件 <key>NSAppTransportSecurity</key> <dict> <key>NSAllowsAr ...
- 【BZOJ2212】[Poi2011]Tree Rotations 线段树合并
[BZOJ2212][Poi2011]Tree Rotations Description Byteasar the gardener is growing a rare tree called Ro ...
- [Vue warn]: Missing required prop: "title"
在写vue项目中,在子组件中通过props传值的时候,在父组件中没有定义的话就会看到类似的报错, 这个意思是calendar这个组件中通过props传递一个title属性给父组件,并且title属性是 ...
- lookcss在深夜23:32开通
CSS在深夜23:32开通 话说 哥也耐不住寂寞搞个网站玩玩.顺便记录一些生活和学习和工作和思想和神马的点点滴滴~ 好吧 ~本来想起个名字叫涉趣.谁知道百度了一下,已经有人叫这个名字了,杯具,貌似还是 ...
- MySQL 1067
今天在云服务器上装mysql的时候,启动突然报了一个“1067 进程意外终止”的错误,这个错误之前是遇到过的,之前因为my.ini配置basedir路径的时候没有正确配置导致了这个错误,但是今天又出现 ...