一、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. 算法(Algorithms)第4版 练习 1.3.41

    方法实现: //1.3.41 public Queue(Queue<Item> q) { Queue<Item> result = new Queue<Item>( ...

  2. Codeforces Round #335 (Div. 2) C. Sorting Railway Cars

    C. Sorting Railway Cars time limit per test 2 seconds memory limit per test 256 megabytes input stan ...

  3. Sobel边缘检测

    Sobel算子:[-1  0  1 -2  0  2 -1  0  1] 用此算子与原图像做卷积,可以检测出垂直方向的边缘.算子作用在图像的第二列,结果是:200,200,200:作用在第三列,结果是 ...

  4. JavaScript中call、apply个人理解

    JavaScript中call.apply个人理解 一句话即通俗的说:call.apply 是为了改变this的状态而存在的 }; } function personInfo(name,age){ t ...

  5. HDU 4123 Bob's Race:树的直径 + 单调队列 + st表

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4123 题意: 给你一棵树,n个节点,每条边有长度. 然后有m个询问,每个询问给定一个q值. 设dis[ ...

  6. ajax实现聊天室功能

    需求如下: 先死后活. 需求分析,分析思路如图所示: 1.创建数据库 create database chat; create table messages( id int unsigned prim ...

  7. 我对java的理解(二)——反射是小偷的万能钥匙

    在我们生活中,车上或者路上有时候会遇到一种很讨厌的人——“小偷”,趁我们不注意或者疏忽的时候拿走属于我们的东西.更有甚者,趁我们不在家的时候,手持一把万能钥匙,打开我们的房门,悠闲的查看房间的布置,翻 ...

  8. 理解SetCapture()和ReleaseCapture()及GetCapture()作用

    正常情况下,鼠标指针位于哪个窗口区域内,鼠标消息就自动发给哪个窗口.如果调用了SetCapture,之后无论鼠标的位置在哪,鼠标消息都发给指定的这个窗口,直到调用ReleaseCapture或者调用S ...

  9. PostgreSQL正则及模糊查询优化

    1.带前缀的模糊查询  ~'^abc' 可以使用btree索引优化 create index idx_info on table_name(info) 2.带后缀的模糊查询  ~'abc$' 可以使用 ...

  10. Java进阶07 嵌套类

    到现在为止,我们都是在Java文件中直接定义类.这样的类出现在包(package)的级别上.Java允许类的嵌套定义. 这里将讲解如何在一个类中嵌套定义另一个类. 嵌套 内部类 Java允许我们在类的 ...