gpt4 book ai didi

java - 无法在 Eclipse Oxygen 上设置 Selenium 3

转载 作者:太空宇宙 更新时间:2023-11-04 10:23:27 25 4
gpt4 key购买 nike

代码片段 -

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: Failed to connect to localhost/127.0.0.1:38558 Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T15:15:03.216Z' System info: host: 'MPL-CJ08HM2', ip: '192.168.56.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '9.0.4' Driver info: driver.version: FirefoxDriver

最佳答案

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

关于java - 无法在 Eclipse Oxygen 上设置 Selenium 3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50835234/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com