【问题标题】:Issue invoking firefox 51.0.1 with Selenium 3.0.1 on Eclipse Neon在 Eclipse Neon 上使用 Selenium 3.0.1 调用 firefox 51.0.1 的问题
【发布时间】:2017-07-28 00:16:11
【问题描述】:

在 Firefox 51.0.1 上使用 Selenium 3.0.1 在 Firefox 浏览器上打开 URL 时遇到问题

环境:

MAC Sierra
Eclipse Neon.2
Firefox 51.0.1

我收到以下异常:

org.openqa.selenium.firefox.NotConnectedException:无法连接 45000 毫秒后在端口 7055 上托管 127.0.0.1。火狐控制台 输出:“错误。还附上了快照。

这是我的代码:

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class JavaScriptExecutor {

public static void main(String[] args) {
    System.setProperty("webdriver.firefox.marionette", "/Users/saraddhungel/Downloads/geckodriver");
    WebDriver driver = new FirefoxDriver();
    driver.get("www.google.com");
}[error message][1]
}

谢谢

【问题讨论】:

    标签: firefox selenium3


    【解决方案1】:
    1. 更改你的类名,因为 Selenium 已经有预定义的接口,所以你可以使用这个名字作为你的类名

    2. 使用以下代码设置属性

      System.setProperty("webdriver.gecko.driver", "drive_path//geckodriver.exe");
      WebDriver driver = new FirefoxDriver();
      driver.get("http://www.google.com");
      
    3. 使用带有httphttps 的完整网址

    【讨论】:

    • 我确实更改了类名,但仍然收到错误。我收到新错误。请参见下文: org.openqa.selenium.os.UnixProcess.(UnixProcess.java:52) 处 org.openqa.selenium.os.UnixProcess.(UnixProcess.java:52) 处的线程“main”中的异常 java.lang.NoClassDefFoundError: org/apache/commons/exec/DaemonExecutor .selenium.os.CommandLine.(CommandLine.java:47)
    • 请确保您已下载所有必需的 jar 文件
    猜你喜欢
    • 1970-01-01
    • 2017-06-18
    • 2017-06-30
    • 1970-01-01
    • 2017-05-14
    • 2018-12-31
    • 2012-07-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多