【问题标题】:Not able to setup Selenium 3 on Eclipse Oxygen无法在 Eclipse Oxygen 上设置 Selenium 3
【发布时间】:2018-11-22 22:01:41
【问题描述】:

代码片段 -

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxDriverLogLevel;
import org.openqa.selenium.firefox.FirefoxOptions;
import org.openqa.selenium.remote.DesiredCapabilities;
public class SeleniumClientClass {
    public static void main(String[] args) {
        System.setProperty("webdriver.gecko.driver","D:\\YoutubeVideos\\Selenium\\geckodriver.exe");

/*      DesiredCapabilities capability = DesiredCapabilities.firefox();
        capability.setCapability("marionette", true); */

        try {
        FirefoxOptions opts = new FirefoxOptions().setLogLevel(FirefoxDriverLogLevel.TRACE);
        WebDriver driver = new FirefoxDriver(opts);
        driver.get("http://www.google.com");

        Thread.sleep(10);
        System.out.println("Application title is ============>>>>>>> "+driver.getTitle());
        driver.quit();
        } catch(Exception e) {
            System.out.println(e);
        }       
    }

}

我得到的错误:

org.openqa.selenium.WebDriverException: java.net.ConnectException:无法连接到 localhost/127.0.0.1:38558 构建信息:版本:'3.12.0',修订: '7c6e0b3',时间:'2018-05-08T15:15:03.216Z' 系统信息:主机: 'MPL-CJ08HM2',ip:'192.168.56.1',os.name:'Windows 10',os.arch: 'amd64', os.version: '10.0', java.version: '9.0.4' 驱动信息: driver.version: FirefoxDriver

【问题讨论】:

    标签: java eclipse selenium-webdriver gecko


    【解决方案1】:

    我通过使用最新版本的 geckodriver.exe (v0.20.1) 解决了这个问题,因为我之前使用的是旧版本的 geckodriver(v0.9.0)...

    【讨论】:

      猜你喜欢
      • 2018-08-31
      • 2022-01-08
      • 2018-09-01
      • 1970-01-01
      • 1970-01-01
      • 2018-07-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多