本文介绍了Selenium 2.53.1在FireFox 48上不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用硒来测试我们的网站。当我构建项目时,有一个例外: -
$ b



  IWebDriver driver = new FirefoxDriver(); 

任何人都知道如何解决这个问题?

/ QA / Marionette / WebDriverrel =nofollow noreferrer> Mozilla 已经发布了一个可以与浏览器一起运行的可执行文件。



可以从下载最新的可执行geckodriver。



将下载的可执行文件geckodriver添加到系统路径中。

Selenium客户端绑定将尝试从系统路径中找到geckodriver(或wires)可执行文件。您需要将包含可执行文件的目录添加到系统路径中。
$ b


  • 在Unix系统上,您可以执行如果您使用兼容bash的shell,请将以下内容附加到您系统的搜索路径:

      export PATH = $ PATH:/ path / to / directory / of / executable / downloaded / in / previous / step 

  • 在Windows上,您需要更新Path系统变量以将完整的目录路径添加到可执行的geckodriver。原理与Unix相同。


    毕竟以上的东西需要初始化 FireFoxDriver 如下所示: -

      var driver = new FirefoxDriver(new FirefoxOptions()); 

    注意: - 以解决与其他编程语言有关的问题。


    I am using selenium to test our websites. When I build the project, there is an Exception :-

    IWebDriver driver = new FirefoxDriver();
    

    Anybody knows how to solve this problem?

    解决方案

    Just like the other drivers available to Selenium from other browser vendors, Mozilla has released an executable that will run alongside the browser.

    You can download the latest executable geckodriver from here

    Add downloaded executable geckodriver to system path

    The Selenium client bindings will try to locate the geckodriver (or wires) executable from the system path. You will need to add the directory containing the executable to the system path.

    • On Unix systems you can do the following to append it to your system’s search path, if you’re using a bash-compatible shell:

      export PATH=$PATH:/path/to/directory/of/executable/downloaded/in/previous/step
      

    • On Windows you need to update the Path system variable to add the full directory path to the executable geckodriver. The principle is the same as on Unix.

    After all above stuff you need to Initialize FireFoxDriver as below :-

    var driver = new FirefoxDriver(new FirefoxOptions());
    

    Note :- Follow this link for the solution of this problem with other programming language.

    这篇关于Selenium 2.53.1在FireFox 48上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 22:28