Python3 + selenium + Chrome浏览器

Error:
  selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH.Please see https://sites.google.com/a/chromium.org/chromedriver/home

这是因为调用 webdriver.Chrome() 需要设置参数 executable_path,而executable_path 为chromedriver.exe所在地址。

chromedriver.exe的下载地址为 http://chromedriver.storage.googleapis.com/index.html

首先需要确定本机的Chrome浏览器的版本,在Chrome浏览器里输入"chrome://version"即可,如下图,Google Chrome冒号后面即为对应版本。本机的Chrome版本为75.0.3770.142,下载地址中并无完全吻合的版本,最后下载了75.0.3770.142版本对应的亦可兼容本机。

这是下载地址界面:

然后我们转到对应版本界面,选择对应系统的zip文件下载并解压。

得到chromedriver.exe文件后,给 webdriver.Chrome() 添加参数 executable_path = 'path/chromedriver.exe'(path为chromedriver.exe所在的目录)

之后我的代码就运行成功了

Python3 + selenium + Chrome浏览器(webdriver.Chrome()报错)的更多相关文章

  1. 音频播放器在chrome浏览器,play报错

    这个问题是谷歌浏览器的问题:https://www.oschina.net/news/96168/chrome-remove-the-autoplay-policy,可以查看这篇文章 如果你的版本没有 ...

  2. 关于浏览器访问iLO报错ERR_SSL_BAD_RECORD_MAC_ALERT

    公司有几台HP DL380 G7服务器,ilo版本是ilo3(Integrated Lights-Out 3),ilo口配置好后,无法正常打开ilo页面 ping ilo口是通的,并且telnet 8 ...

  3. python3+selenium使用浏览器IE的时候,无法打开IE浏览器,老是报错: Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones

    python3+selenium使用浏览器IE的时候,老是报错: Unexpected error launching Internet Explorer. Protected Mode settin ...

  4. python2.7运行selenium webdriver api报错Unable to find a matching set of capabilities

    在火狐浏览器33版本,python2.7运行selenium webdriver api报错:SessionNotCreatedException: Message: Unable to find a ...

  5. selenium + PhantomJS使用时 PhantomJS报错解决

    selenium + PhantomJS使用时 PhantomJS报错解决 在做动态网页爬虫时用到了selenium + PhantomJS,安装好之后运行时报错: UserWarning: Sele ...

  6. 【Selenium+Python Webdriver】报错之:TypeError: user_login() missing 1 required positional argument: 'self'

    先贴一下源码: base.py文件如下: from selenium import webdriver class Page(object): ''' 页面基础类,用于所有页面的继承 ''' rb_u ...

  7. paycharm导入webdriver包报错:module 'selenium.webdriver' has no attribute 'Firefox'

    首先:试试看在cmd中试试输入from selenium import webdriver,看是否报错,看一看是不是pycharm的原因.经过确认,在dos窗口中输入导入包的命令并没有报错.最后我重现 ...

  8. Selenium多浏览器处理 (Chrome/Firefox/IE)

    测试用例文件:test_selenium/test_hogwarts.py 使用pytest框架 定义一个变量,通过外部传入变量,确定使用哪个浏览器 browser = os.getenv(" ...

  9. 打开了chrome审查元素 发现报错 Uncaught SyntaxError: Unexpected token )

    这个错误并不影响业务处理,但是看到有报错,心里总是不爽. 经过几番查找,发现了原因. <a href="javascript:void()" oncick="onS ...

  10. uirecorder 启动webdriver服务报错

    在安装好uirecorder后,执行起来是各种错误. 不是少这个就是缺那个,也是因为自己对自动化测试知识太匮乏. 导致刚开始走自动化测试绕了很多弯路,报个错都不知所措.后来才知道要多看ERROR后面的 ...

随机推荐

  1. linux中如何修改最大文件句柄数

    1.使用ulimit -a可以查看,其中的open files后面的数就是最大文件句柄数 2.临时方法:使用ulimit -n size修改最大文件句柄数(这种方法只针对当前进程有效) 3.永久方法: ...

  2. 记录下我用Jenkins打包碰到的坑

    使用Andorid Studio 打包都是正常的,但是使用Jenkins自动打包一直报错,尝试过网上的各种方案,依然都不行,报错如下. FAILURE: Build failed with an ex ...

  3. php-fpm脚本

    #! /bin/sh ### BEGIN INIT INFO # Provides: php-fpm # Required-Start: $remote_fs $network # Required- ...

  4. ICEM—三分之一风扇

    原视频下载地址:https://yunpan.cn/cSwYBI6sb9vHS  访问密码 9059

  5. arcgis python 随机取部分数据

    # -*- coding: cp936 -*- import arcpy import os import ylpy import random def main(): num=ylpy.getCou ...

  6. java多线程面试题整理及答案(2019年)

    1) 什么是线程? 线程是操作系统能够进行运算调度的最小单位,它被包含在进程之中,是进程中的实际运作单位.程序员可以通过它进行多处理器编程,你可以使用多线程对 运算密集型任务提速.比如,如果一个线程完 ...

  7. ForkJoinPool 源码分析

    ForkJoinPool ForkJoinPool 是一个运行 ForkJoinTask 任务.支持工作窃取和并行计算的线程池 核心参数+创建实例 // 工作者线程驻留任务队列索引位 static f ...

  8. 树莓派根分区扩展至整张sd卡

    第一步,安装raspi-config sudo apt-get install raspi-config 第二步,运行raspi-config sudo raspi-config 界面选择,Expan ...

  9. centos7.4出现yum command not found

    购买的云服务器运行yum命令出现yum command not found. 通过将云主机自带的yum和python卸载掉,并且同时需要关注/usr/bin/yum文件的首行解释.我定义其为" ...

  10. 阶段5 3.微服务项目【学成在线】_day04 页面静态化_02-freemarker介绍