zoukankan      html  css  js  c++  java
  • python selenium模块使用出错解决,geckodriver executable needs to be in PATH

    在使用unittest创建基于python的selenimu的测试脚本时

    #coding:utf-8
    import unittest
    from selenium import webdriver
     
    class SearchTest(unittest.TestCase):
        def setUp(self):
            #create a new Firefox session
            self.driver = webdriver.Firefox()
            self.driver.implicitly_wait(30)
            self.driver.maximize_window()

    出现了如下错误:

    问题原因:调起浏览器驱动失败
    解决方案:安装浏览器驱动

    Windows系统解决办法如下:
    1、下载geckodriver.exe:
    下载地址:mozilla/geckodriver
    请根据系统版本选择下载;(如Windows 64位系统)
    2、下载解压后将getckodriver.exe复制到python安装目录下:D:Python27
    3、再次运行代码即可

    ubuntu16.04环境下 解决方法:
    1、下载 geckodriverckod 地址:mozilla/geckodriver
    2、解压后将geckodriverckod 存放至 /usr/local/bin/ 路径下即可
    这样就可以解决了,同理对于IE和Chrome浏览器,IEDriverServer,chromedriver也是相同的解决方法

  • 相关阅读:
    Balanced Binary Tree
    Swap Nodes in Pairs
    Reverse Nodes in k-Group
    Reverse Linked List II
    Remove Nth Node From End of List
    Remove Duplicates from Sorted List II
    Remove Duplicates from Sorted List
    Partition List
    Merge Two Sorted Lists
    【Yii2.0】1.2 Apache检查配置文件语法
  • 原文地址:https://www.cnblogs.com/susanhonly/p/10636078.html
Copyright © 2011-2022 走看看