一、Chrome浏览器的安装

  1. 对于谷歌Chrome32位版本,使用如下链接:

    wget https://dl.google.com/linux/direct/google-chrome-stable_current_i386.deb

    对于64位版本可以使用如下链接下载:

    wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
    下载完后,运行如下命令安装。

sudo dpkg -i google-chrome*.deb
sudo apt-get install -f
  • 1
  • 2
     安装好之后可以直接搜索Chrome启动,并右击进行固定到左边
  • 1

二、Chromedriver的安装

1.安装xvfb以便我们可以无头奔跑地运行Chrome

sudo apt-get install xvfb
  • 1

2 安装依赖

sudo apt-get install unzip
  • 1

3 下载安装包

wget -N http://chromedriver.storage.googleapis.com/2.26/chromedriver_linux64.zip
  • 1

4 解压缩+添加权限

unzip chromedriver_linux64.zip
  • 1

5 移动

sudo mv -f chromedriver /usr/local/share/chromedriver
  • 1

6 建立软连接

sudo ln -s /usr/local/share/chromedriver /usr/local/bin/chromedriver
sudo ln -s /usr/local/share/chromedriver /usr/bin/chromedriver
  • 1
  • 2

三、执行python脚本,打开百度,进行搜索

from selenium import webdriver
driver = webdriver.Chrome()
driver.get('http://www.baidu.com')
driver.find_element_by_id("kw").send_keys("吴磊")
driver.find_element_by_id("su").click()
  • 1
  • 2
  • 3
  • 4
  • 5

运行之后可看到Chrome浏览器打开并进行搜索

http://chromedriver.storage.googleapis.com/index.html

--------------------- 本文来自 WuLei06 的CSDN 博客 ,全文地址请点击:https://blog.csdn.net/qq_34374753/article/details/81607052?utm_source=copy

Ubuntu16.4下安装Chrome浏览器以及Chromedriver的更多相关文章

  1. CentOS7下安装chrome浏览器

    在CentOS 7环境下安装chrome浏览器 1.修改yum源 在/etc/yum.repos.d/目录下新建文件google-chrome.repo,向其中添加如下内容: [google-chro ...

  2. 在Ubuntu上安装Chrome浏览器和ChromeDriver

    启动脚本后报错 selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable may have w ...

  3. CentOS 7下安装Chrome浏览器

    1. cd /etc/yum.repos.d/ 2. vim google-chrome.repo 在该文件中输入: [google-chrome]name=google-chromebaseurl= ...

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

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

  5. ubuntu16.04下安装chrome

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

  6. Ubuntu16.04下安装Chrome出现“未安装软件包 libappindicator1”问题的解决办法

    1. 强制安装chrome sudo dpkg -i google-chrome-stable_current_i386.deb --force 2. 补齐依赖 sudo apt-get instal ...

  7. Ubuntu下安装chrome浏览器

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

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

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

  9. Ubuntu12.04 下安装Chrome浏览器

    第一步 下载. 32位:https://dl.google.com/linux/direct/google-chrome-stable_current_i386.deb 64位:https://dl. ...

随机推荐

  1. php把字符串指定字符分割成数组

    <?php $str="1|2|3|4|5|"; $var=explode("|",$str); print_r($var); ?> $var=ex ...

  2. node.js抓取网上图片保存到本地

    用到两个模块,http和fs var http = require("http");var fs = require("fs"); var server = h ...

  3. linux应用之yum命令的软件源的更换(centos)

    [1] 首先备份/etc/yum.repos.d/CentOS-Base.repo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/Cent ...

  4. Java8中聚合操作collect、reduce方法详解

    Stream的基本概念 Stream和集合的区别: Stream不会自己存储元素.元素储存在底层集合或者根据需要产生.Stream操作符不会改变源对象.相反,它会返回一个持有结果的新的Stream.3 ...

  5. js 定义hash类

    // JavaScript Documentfunction HashTable(){    this._hash={};    this._count=0;            /**    *添 ...

  6. 关于VS中包含库、附加包含库、

    转载:https://blog.csdn.net/qing101hua/article/details/53841827 VS中C++的包含目录.附加包含目录和库目录和附加库目录的区别 对Visual ...

  7. Activity间数据传输

    当对Android有一些了解后,不难发现,Android程序UI框架接近于Web页面的概念.每一个用于呈现页面的组件,Activity,都是彼此独立的,它们通过系统核心来调度整合,彼此之间的通过Int ...

  8. [转]_int64、long long 的区别

    大学生程序代写 C++的64位整数[原]by 赤兔 http://baike.baidu.com/view/1235293.htm 在做ACM题时,经常都会遇到一些比较大的整数.而常用的内置整数类型常 ...

  9. Mybatis学习--Mapper XML文件

    学习笔记,选自Mybatis官方中文文档:http://www.mybatis.org/mybatis-3/zh/sqlmap-xml.html#insert_update_and_delete My ...

  10. 使用WindowsAPI获取录音音频的方法

    这篇文章主要介绍了使用WindowsAPI获取录音音频的方法,非常实用的功能,需要的朋友可以参考下 本文实例介绍了使用winmm.h进行音频流的获取的方法,具体步骤如下: 一.首先需要包含以下引用对象 ...