【问题标题】:webdriver keeps throwing IOException and reconnectingwebdriver不断抛出IOException并重新连接
【发布时间】:2010-08-18 07:57:42
【问题描述】:

我正在使用 webdriver api (Selenium),当我尝试测试网站(我可以在浏览器中正常查看和浏览)时,我一遍又一遍地收到以下消息。

INFO: I/O exception (java.net.ConnectException) caught when processing request: Connection timed out: connect
18-Aug-2010 12:36:08 AM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry

为什么我总是收到这个错误?

【问题讨论】:

  • 请添加更多信息:测试的源代码、Selenium 的版本、测试从哪里运行?

标签: java selenium webdriver


【解决方案1】:

看来您必须配置代理。如果没有配置,我会得到同样的错误。

如果你使用HtmlUnitDriver(你必须使用WebDriver的具体实现来访问setProxy方法:

HtmlUnitDriver d = new HtmlUnitDriver();
d.setProxy("your.proxy.here", proxyPort);

如果您使用FirefoxDriver

FirefoxProfile firefoxProfile = new FirefoxProfile();
Proxy proxy = new Proxy();
proxy.setHttpProxy("your.proxy.here:proxyPort");
firefoxProfile.setProxyPreferences(proxy);
WebDriver driver = new FirefoxDriver(firefoxProfile);

【讨论】:

  • 嗨,我不明白为什么我需要代理,因为我正在尝试在我的应用程序上运行测试并且我的计算机 IP 没有被阻止。
  • 那么请给我们更多的信息。请参阅顶部的评论。
  • 我现在明白了。我意识到该应用程序正在加载滞后的广告。我是否总是必须为每个实例指定一个 firefox 配置文件?如果我想运行多个 firefox 实例,我可以使用相同的配置文件吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-07-10
  • 2020-09-20
  • 1970-01-01
  • 2017-02-17
  • 2023-03-17
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多