【问题标题】:Firefox window is opened but the URL is not placed in the address barFirefox 窗口已打开,但 URL 未放在地址栏中
【发布时间】: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/…
  • 是的。降级后,它工作正常。谢谢

标签: selenium webdriver


【解决方案1】:

当我将 Firefox 版本从最新版本降级到 FF 22.0 后问题解决了

【讨论】:

    【解决方案2】:

    这似乎是您的 firefox 和 selenium 版本之间的不兼容。尝试使用最新的 selenium-java(2.45 版)。

    另请注意,您必须在 get-call 中指定协议:

    test.get("http://www.google.com"); 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-26
      • 1970-01-01
      • 1970-01-01
      • 2014-07-28
      • 1970-01-01
      相关资源
      最近更新 更多