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