开发者

webdriver keeps throwing IOException and reconnecting

I am using webdriver api (Selenium) and when I am trying to test a site (which I can view and browse normally in my browsers), I get the following message over and over.

INFO: I/O exception (java.net.ConnectException) caught when processing request: Connection timed out: c开发者_高级运维onnect
18-Aug-2010 12:36:08 AM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry

Why do I keep getting this error ?


It looks like you have to configure a proxy. I get the same error if none is configured.

If you use the HtmlUnitDriver (You have to use the concrete implementation of WebDriver to access the setProxy method:

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

If you use the FirefoxDriver:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜