java - Selenium Webdriver 和 Firefox Server Not Found 错误

标签 java firefox selenium-webdriver

我使用的是 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/

相关文章:

Firefox 上的 jQuery 动画缩放

testing - Sikuli 与 Selenium WebDriver 的集成

firefox - 配置系统范围的代理设置

python - selenium.common.exceptions.SessionNotCreatedException : Message: Unable to find a matching set of capabilities with Firefox 46 through Selenium

java - 当我非常靠近地点击图片时,文本被识别。它甚至无法识别名片上的文字

java - 违反 Google 政策通过 PayPal 按钮捐款?

java - 如何检索文本字段内的文本

python - 将现有的 Webdriver 对象传递给机器人框架的自定义 Python 库

java - 应用程序 -> 数据库调用有多昂贵? (即 Java JDBC -> Oracle)?

java - 使用 Spring Hibernate Sessionfactory 从数据库中选择单个项目