【发布时间】:2014-05-30 08:15:23
【问题描述】:
我想用 Java 中的 Selenium 设置一个 FirefoxDriver。我尝试如下:
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("network.proxy.http", "proxy");
profile.setPreference("network.proxy.http_port", "1234");
WebDriver driver = new FirefoxDriver(profile);
driver.get("http://www.stackoverflow.com");
但它总是给我错误:
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
谷歌后发现这是常见问题,但我没有找到任何解决方案! 我正在使用 selenium-server-standalone-2.41.0.jar 和 Firefox 29.0 有人可以帮帮我吗?!
【问题讨论】:
-
您的代码看起来不错。我没有观察到您遇到的问题。
-
selenium-server-standalone-2.41.0.jar 和 Firefox 29.0.1 适合我。我建议你重新安装其他版本的 Firefox。
-
不幸的是,即使使用较旧的 FF 版本(推荐 27.0.1),它也不适合我:(
-
我发现这在另一个系统上运行良好。奇怪。
标签: java selenium selenium-webdriver selenium-firefoxdriver