gpt4 book ai didi

java - Selenium Webdriver 和 Firefox Server Not Found 错误

转载 作者:行者123 更新时间:2023-12-02 05:47:25 24 4
gpt4 key购买 nike

我使用的是 Win 7 64、Selenium IDE 2.5.0、WebDriver 2.42 和 Eclipse Kepler SR2。我尝试使用 driver.get 启动浏览器,但无论我输入什么 URL,我都会打开浏览器,但出现“找不到服务器”错误。这让我发疯。看起来它打开了一个 Firefox 实例,它看起来不像我用来浏览互联网的那个,它没有我的书签和插件,也没有连接到互联网。有什么帮助吗?谢谢。

这是我正在使用的代码:

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa
public class NavigateToAUrl {
public static void main (String[] args) {
WebDriver driver = new FirefoxDriver () ;
driver.get("https://www.google.com");
}

}

最佳答案

尝试使用以下代码:

System.setProperty("webdriver.firefox.profile", "default");
FirefoxDriver driver = new FirefoxDriver();
driver.get("http://google.com/");

关于java - Selenium Webdriver 和 Firefox Server Not Found 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23921149/

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