启动脚本后报错 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的更多相关文章

  1. [转]在ubuntu上安装chrome浏览器

    原文链接: https://www.linuxidc.com/Linux/2013-10/91857.htm --------------------------------------------- ...

  2. 在Ubuntu上安装Chrome Driver和Firefox Driver

    在Ubuntu上安装Chrome Driver和Firefox Driver 此文章只介绍Chrome Driver(Firefox Driver和该步骤相同) 下载链接:http://chromed ...

  3. Ubuntu下安装chrome浏览器步骤

    进入 Ubuntu 18.04 桌面,按下 Ctrl + Alt + t 键盘组合键,启动终端. 也可以按下 Win 键(或叫 Super 键),在 Dash 的搜索框中输入 terminal 或“终 ...

  4. Ubuntu16.4下安装Chrome浏览器以及Chromedriver

    一.Chrome浏览器的安装 对于谷歌Chrome32位版本,使用如下链接: wget https://dl.google.com/linux/direct/google-chrome-stable_ ...

  5. ubuntu下安装chrome浏览器和flash插件

    chrome浏览器可在Ubuntu软件中心里搜索并安装 falsh插件首先去官网下载合适的包然后,按照readme安装,执行sudo cp -r usr/* /usr 和sudo cp libflas ...

  6. Ubuntu下安装chrome浏览器

    1.在终端中,输入以下命令: sudo wget http://www.linuxidc.com/files/repo/google-chrome.list -P /etc/apt/sources.l ...

  7. Ubuntu 17 安装Chrome浏览器

    1.进入下载文件存放目录 cd Downloads 2.下载chrome文件 2.1 32位使用如下命令 wget https://dl.google.com/linux/direct/google- ...

  8. 在ubuntu上安装Chrome

    1.下载谷歌浏览器源文件.链接有很多,以下是64位版本的下载地址 https://dl.google.com/linux/direct/google-chrome-stable_current_amd ...

  9. 【转载】CentOS7 安装Chrome浏览器

    本篇文章主要记录如何在CentOS7.0上安装Chrome浏览器. 方法1: Google官方源在国内可能无法正常访问,故而添加Fedora中文社区提供的镜像源: sudo wget http://r ...

随机推荐

  1. git设置忽略文件和目录

    1.登录gitbash命令端进入本地git库目录 Administrator@PC201601200946 MINGW32 /d/gitrespository/crmweb (master) 2.创建 ...

  2. Batch Normailzation

    转自:http://blog.csdn.net/malefactor/article/details/51476961

  3. JavaScript 严格模式(use strict)

    前言: "use strict" 指令在 JavaScript 1.8.5 (ECMAScript5) 中新增. 它不是一条语句,但是是一个字面量表达式,在 JavaScript ...

  4. 《linux系统及其编程》实验课记录(二)

    实验 2:获取对使用命令的帮助 实验环境: 安装了 Red Hat Enterprise Linux 6.0 可运行系统,并且是成功验证系统.有另外一个无特权用户 student,密码 student ...

  5. C++三大函数(The Big Three)

    本文用Markdown编辑,这里对Markdown的支持不完善,更好的阅读体验请移步:我的Markdown文本 C++三大函数: 析构函数 复制构造函数 operator= 析构函数 函数模样:~S( ...

  6. poj 2752 Seek the Name, Seek the Fame (KMP纯模版)

    Seek the Name, Seek the Fame Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 13840   Ac ...

  7. 关于在ubuntu平台下使用apt-get命令下载速度太慢的问题解决

    1. 进入设置,从哪进都一样找到就行. 2.选择软件与更新(Software and updates,英语估计是这个把) 点击下载自:这个下拉框,选中其它站点,选择镜像 选择阿里的或者搜狐的镜像,然后 ...

  8. Android开发:《Gradle Recipes for Android》阅读笔记(翻译)4.4——自定义代码集合

    问题: 你想要在项目中使用非标准的代码目录. 解决方案: 在gradle的build配置里面使用sourceSets属性. 讨论: Android分发的samples里面使用多个代码目录,使得通用的文 ...

  9. 同时调整lv分区的大小(减少一个,增加另一个)

    author:headsen chen date: 2018-04-20  16:48:06 1.查看分区:/home 为67G,太大了,/ 是50g,太小了. [root@localhost ~]# ...

  10. 【BZOJ4388】JOI2012 invitation 堆+线段树+并查集(模拟Prim)

    [BZOJ4388]JOI2012 invitation Description 澳洲猴举办了一场宴会,他想要邀请A个男生和B个女生参加,这A个男生从1到A编号,女生也从1到B编号.现在澳洲猴知道n组 ...