最近在研究基于python的selenium自动化,结果一开始就死在了环境搭建上,前前后后整了N天,终于搞出来了,像中奖了

  按部就班的参照网上安装步骤,安装完成后,写了个简单的自动化脚本  #-*- coding: utf-8 -*-

  from selenium import webdriver  from selenium.webdriver.firefox.firefox_binary import FirefoxBinary

  browser = webdriver.Firefox()  browser.get("http://www.baidu.com")  browser.find_element_by_id("kw").send_keys("selenium")  browser.find_element_by_id("su").click()  browser.quit()

  程序一跑,中奖报错了:selenium.common.exceptions.WebDriverException: Message: Failed to start browser:省略不计了  百度一下吧,搜索结果大致是说selenium和火狐的版本不兼容导致,索性重新搞吧:
  1、selenium版本:selenium-2.45.0  2、火狐浏览器版本:36.0重新再跑下程序,OK搞定了,一块心病终于治好了

话外题:我机器火狐未安装到默认路径,结果运行还是会报错:

      后来在代码中添加一句:

                 from selenium.webdriver.firefox.firefox_binary import FirefoxBinary

    搞定!!!

 

转载于:https://www.cnblogs.com/get-up/p/6090253.html

selenium.common.exceptions.WebDriverException: Message: Failed to start browser:搞哭了相关推荐

  1. selenium.common.exceptions.WebDriverException: Message: ‘chromedriver‘ executable needs to bein PATH

    使用Selenium模拟浏览器访问淘宝首页,出现报警 from selenium import webdriver import timebrowser = webdriver.Chrome() br ...

  2. selenium.common.exceptions.WebDriverException: Message: ‘chromedriver’解决

    selenium.common.exceptions.WebDriverException: Message: 'chromedriver'解决: https://blog.csdn.net/weix ...

  3. 已解决selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary

    已解决selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary ...

  4. selenium.common.exceptions.WebDriverException: Message: unable to set

    本人使用的版本是 python3.7 selenium3.14.1 macOS10.13.3 另外是在谷歌浏览器做的实验 下面看代码: 我想要添加一个name为MUSIC_U的cookie,运行后出现 ...

  5. WebDriverException( selenium.common.exceptions.WebDriverException: Message: ‘chromedriver‘ executabl

    WebDriverException( selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executabl ...

  6. 【解决报错问题:selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurr】

    运行Appium报错: selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occ ...

  7. 报错解决:selenium.common.exceptions.WebDriverException: Message: An unknown server-side error

    报错代码 from appium import webdriver from selenium.webdriver.support.ui import WebDriverWaitdesired_cap ...

  8. 在进行天猫商品数据爬虫时遇到selenium.common.exceptions.WebDriverException: Message: 'chromedriver.exe'

    selenium.common.exceptions.WebDriverException: Message: 'chromedriver.exe' executable needs to be in ...

  9. selenium.common.exceptions.WebDriverException: Message: Unable to find a matching set of capabilitie

    selenium.common.exceptions.WebDriverException: Message: Unable to find a matching set of capabilitie ...

  10. 使用selenium时遇到的报错selenium.common.exceptions.WebDriverException: Message: Service xxxxstaus:1详解及解决方法详解

    在开始之前,分享一下使用selenium常遇到的几个问题和报错: 1.首先就是版本问题的报错:selenium.common.exceptions.NoSuchWindowException: Mes ...

最新文章

  1. Hbuilder实用技巧
  2. 公益性岗位计算机考试内容,公益性岗位公共基础知识:计算机概述-计算机硬件系统(1)...
  3. 计算机专业专业课代号408,计算机专业考研你一定要知道的事情!
  4. JUnit-4.11使用报java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing错误
  5. QT每日一练day19:设计一个记事本
  6. IPSec隧道配置案例(手动模式)
  7. 企业级微服务框架 NutzBoot 2.3.0.v20190220 发布
  8. mysql查找数据库中是否已经存在某张表
  9. SRS:软件需求规格说明书
  10. 虚幻引擎和实时3D技术人才的需求已达到空前高度
  11. kt条件例题运筹学_运筹学讲解习题
  12. K2P路由器刷机和拨号上网
  13. 基于激光刻划技术的石墨烯器件
  14. 巧用CSS文件愚人节恶搞
  15. python吃内存吗_python – 为什么泡菜吃内存?
  16. Innodb存储引擎-idb文件格式解析
  17. docker创建容器相关命令【详细版】
  18. yolov5的detect.py代码详解
  19. win7 ads出现Unhandled exception:c0000005
  20. golang 网络心跳包设置

热门文章

  1. 设计模式学习总结7 - 行为型2 - Command命令模式
  2. Java基础——泛型
  3. static关键字作用总结
  4. Quartz的job中注入的services接口为空的解决办法
  5. Cors 跨域 共享
  6. SpringRMI解析2-RmiServiceExporter逻辑脉络
  7. Spring + MyBatis配置整合
  8. PHP-redis中文帮助手册_set相关
  9. TVS ESD 二极管介绍与应用
  10. 让hammer完美支持Pixi.js - 2D webG库