在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 ...
随机推荐
- Linux增加用户并赋予权限
1.添加用户,首先用adduser命令添加一个普通用户,命令如下: #adduser tommy //添加一个名为tommy的用户#passwd tommy //修改密码Changing pass ...
- 【转】Oracle Sys和system用户、sysdba 和sysoper系统权
一:最重要的区别,存储的数据的重要性不同 [sys]所有oracle的数据字典的基表和视图都存放在sys用户中,这些基表和视图对于oracle的运行是至关重要的,由数据库自己维护,任何用户都不能手动更 ...
- C语言 百炼成钢27
/* 题目63:编写C++程序完成以下功能: (1)声明一个纯虚函数类Shape(形状),其中包含来计算面积.计算周长的方法: (2)从Shape派生两个类矩形和圆形: (3)从矩形派生正方形: (4 ...
- TempData,跳转后的提醒
TempData与ViewData用法一样,不同的是ViewData是当前action与对应的view中存在,TempData在下个action还有效,再往后就无效了.只是我的浅薄理解,希望不会误人子 ...
- websphere web.xml
解决WAS更新web.xml文件不生效的问题(web_merged.xml是罪魁祸首) 问题原因分析 近日碰到更新web.xml文件到WAS服务器(WebSphere Application Se ...
- 【python】计算器
from __future__ import division import sys from math import * from PyQt4.QtCore import * from PyQt4. ...
- ASP.NET中Dictionary基本用法实例分析
本文实例讲述了ASP.NET中Dictionary基本用法.分享给大家供大家参考,具体如下: //Dictionary位于System.Collections.Generic命名空间之下 /* * ...
- Material design之Views and Shadows
Views and Shadows: elevation是构成控件阴影的基本属性.通过设置较高的Z值可以接受更大的阴影,阴影只能投射到Z=0的平面上. View Elevation 控件的Z值,是由两 ...
- python3----函数、匿名函数
本节将学习如何用Python定义函数,调用函数,以及学习匿名函数的使用 1.定义函数 Python中定义函数用关键字def,如下例所示,func为函数名 def func(): print( &quo ...
- python中WSGI是什么
uswgi学习文档 http://uwsgi-docs-cn.readthedocs.io/zh_CN/latest/WSGIquickstart.html WSGI是什么? WSGI,全称 Web ...