启动脚本后报错 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版本管理之git-ssh 配置和使用

    1.设置用户名和邮箱 $ git config --global user.name "gsx-gh" $ git config --global user.email " ...

  2. jquery Fancybox使用教程

    Fancybox是一款基于jquery的对图片展示播放的插件,当然,它html文本.flash动画.iframe以及ajax也予以支持.还可以通过css自定义外观,阴影效果超级赞! 演示效果:http ...

  3. easyui 扩展 之 Tree的simpleData加载

    实例化.这里增加了三个属性,可以指定idFiled,textFiled和parentField.所以这里的simpleData可以不严格转换成tree的数据格式. $(function(){ $('# ...

  4. python笔记5:装饰器、内置函数、json

    装饰器 装饰器本质上是一个Python函数,它可以让其他函数在不需要做任何代码变动的前提下增加额外功能,装饰器的返回值也是一个函数对象. 先看简单例子: def run(): time.sleep(1 ...

  5. 【c语言】将正数变成相应的负数,将负数变成相应的正数

    <pre name="code" class="cpp">// 将正数变成相应的负数,将负数变成相应的正数 #include <stdio.h ...

  6. 【VBA】合并多个excel文件

    From http://www.zhihu.com/question/20366713 VBA代码如下: Sub 工作薄间工作表合并() Dim FileOpen Dim X As Integer A ...

  7. DIV高度设置全屏

    <div class="full"></div> .full{ height:100%; position:fixed; } 使用position的fixe ...

  8. iOS-本地沙盒路径

    沙盒几个路径: 沙盒里的文件夹包括Documents.Library.tmp.这三个文件夹的作用请点击这里.接下来我们来讲解如何获取Documents.Library.tmp的路径. 获取沙盒根目录 ...

  9. [Go语言]从Docker源码学习Go——init()方法和identifier首字母大小写区分

    init()方法 如果想在一个go文件里,进行一些初始化的工作,可以把代码放到init()方法中. init()方法先被执行. func init() { // initialization of p ...

  10. Codevs (3657括号序列 )

    题目链接:传送门 题目大意:中文题,略 题目思路:区间DP 这个题是问需要添加多少个括号使之成为合法括号序列,那么我们可以先求有多少合法的括号匹配,然后用字符串长度减去匹配的括号数就行 状态转移方程主 ...