【发布时间】:2015-06-22 21:37:09
【问题描述】:
我是Webdriver的初学者。
我从 firefox IDE 导出到 webdriver 的脚本运行成功,但问题是我编写了非常简单的脚本来加载 google 主页。
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class sample {
public static void main(String[] args) {
WebDriver test = new FirefoxDriver();
test.get("www.google.com");
}
}
发生的情况是 Firefox 网络浏览器正在打开,但 URL 未发送到地址栏。结果我收到如下所示的错误:
错误
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms.
提前致谢
【问题讨论】:
-
请出示您的完整剧本!
-
导入 org.openqa.selenium.WebDriver;导入 org.openqa.selenium.firefox.FirefoxDriver;公共类示例 { public static void main(String[] args) { WebDriver test = new FirefoxDriver(); test.get("www.google.com"); } }
-
您是在猜脚本中的问题吗?我从 Firefox 的 selenium IDE 导出的脚本没有收到任何错误。
-
尝试降级您的 Firefox。 stackoverflow.com/questions/16352775/…
-
是的。降级后,它工作正常。谢谢