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. 第二次博客作业: 函数+进制转换器v1.0beta

    一:运行截图  二:介绍函数 1, int panduan1(int n,char a[],int count,int sign)//判断用户是否输入了除数字和a-f范围外的字符 { int i; ; ...

  2. python 调用父类方法, 重写父类构造方法, 不显式调用,会报错

    子类不显式调用父类的构造方法,而父类构造函数初始化了一些属性,就会出现问题 如果子类和父类都有构造函数,子类其实是重写了父类的构造函数,如果不显式调用父类构造函数,父类的构造函数就不会被执行,导致子类 ...

  3. 非局部模块(Non Local module)

    Efficient Coarse-to-Fine Non-Local Module for the Detection of Small Objects 何恺明提出了非局部神经网络(Non-local ...

  4. 启动elasticsearch的时候报出Exception in thread "main" SettingsException[Failed to load settings from /usr/local/elasticsearch/config/elasticsearch.yml]; nested: MarkedYAMLException[while scanning a simple ke

    故障现象: [elasticsearch@tiantianml- ~]$ /usr/local/elasticsearch/bin/elasticsearch Exception in thread ...

  5. (翻译) Poor misunderstood 'var'

    It seems most programmers coming to JavaScript from C, C++, Java, and the like equate the var statem ...

  6. 阶段5 3.微服务项目【学成在线】_day03 CMS页面管理开发_18-异常处理-不可预知异常处理

    框架抛出来的或者一些第三方的组件抛出来的异常.我们根本不知道它所对应的错误代码的信息,所以我们也没有办法给用户返回具体的错误代码和错误信息. 我们先在Map中定义有一些不可预知的异常,定义错误代码和错 ...

  7. VS自定义代码块Code Snippet

    一  .简述 我们在开发当中,避免不了一些重复的开发工作,在你漫长的开发以及学习当中,你会发现有这么一部分代码是你时常会使用到的.我想这个工具也是针对这个原因出来的吧,它就是预先把你需要的这部分代码的 ...

  8. iOS-意见反馈UITextView的使用+不能输入字符输入

    @interface DMFeedbackViewController ()<UITextViewDelegate,UIAlertViewDelegate>@property (nonat ...

  9. Docker二

    Docker生成镜像的两种方式 有时候从Docker镜像仓库中下载的镜像不能满足要求,我们可以基于一个基础镜像构建一个自己的镜像 两种方式: 更新镜像:使用docker commit命令 构建镜像:使 ...

  10. Windows安装zabbix-agent4.0

    1.在Windows系统中的C盘,新建一个zabbix目录C:/zabbix2.先下载zabbix-agent的安装包https://assets.zabbix.com/downloads/4.0.1 ...