启动脚本后报错 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. js 控制按钮点击后不可用

    <input type="button" id="btn" value="免费获取验证码" /> <script type ...

  2. GET 还是 POST?

    GET 还是 POST? 与 POST 相比,GET 更简单也更快,并且在大部分情况下都能用. 然而,在以下情况中,请使用 POST 请求: 无法使用缓存文件(更新服务器上的文件或数据库) 向服务器发 ...

  3. vue-cli 打包(npm run build) 出现 ERROR in xx..js from UglifyJs Unexpected token: punc (()

    之前打包还没问题,这次就报错了,后来发现原来是少了 .babelrc 文件, 网上找了好多方法都不行,后来看了之前的项目,原来是少了 .babelrc  文件, 只要在根目录下建立这个文件, 文件内容 ...

  4. 使用Beautifulsoup去除特定标签

    使用Beautifulsoup去除特定标签 试用了Beautifulsoup,的确是个神器. 在抓取到网页时,会出现很多不想要的内容,例如<script>标签,利用beautifulsou ...

  5. IOS学习笔记28—SQLite3第三方库之FMDB

    本文转载至 http://blog.csdn.net/happyrabbit456/article/details/11609451 SQLite是一种小型的轻量级的关系型数据库,在移动设备上使用是非 ...

  6. git +vs2017 操作手册+目前工作流程图

    分支名称介绍及命名规则: 测试分支:master 线上稳定分支:master-发布分支 功能分支:命名命名规则:V版本号-开发者姓名-功能名. 紧急修复分支:命名规则:fixbug-版本号-具体问题名 ...

  7. iOS ipad archives 时候 不显示icon

    设置一下 plist文件

  8. spring定时器的cronexpression表达式

    转自:https://www.cnblogs.com/yaowen/p/3779284.html 相关配置: import com.alibaba.dubbo.config.annotation.Se ...

  9. Delphi xe---FIREDAC

    delphi  xe 10.2 完成FireDAC支持NoSQL MongoDB数据库,包括新FireDAC MongoDB,包括新FireDAC MongoDB的驱动.

  10. Tunneling protocol

    w https://en.wikipedia.org/wiki/Tunneling_protocol