MachinePublishers / jBrowserDriver

A programmable, embeddable web browser driver compatible with the Selenium WebDriver spec -- headless, WebKit-based, pure Java
Other
809 stars 143 forks source link

java.io.IOException: The target server failed to respond: [IMAGE PATH] #259

Closed Markvandersteen closed 7 years ago

Markvandersteen commented 7 years ago

Hello,

First let me start of thanking you for the browser! Now I do have the following issue, when retrieving a page, sometimes a image does not load. And I get a java.io.IOException saying it could not get that image and it failed to respond.

I'd like to catch these errors yet when I set an error handler for the JbrowserDriver. I'm not logging anything.

I did the following:

JBrowserDriver jBrowserDriver = new JBrowserDriver(Settings.builder().ajaxWait(2000).build()); jBrowserDriver.setErrorHandler(new JbrowserErrorHandler()); jBrowserDriver.init();

I already put a ajaxWait in it, but even then, sometimes an image failes to respond. Is there any way I can catch these exceptions.

Thanks in advance!

hollingsworthd commented 7 years ago

JBrowserDriver extends RemoteWebDriver which defines setErrorHandler. I think that API is intended to handle errors in the JSON wire protocol, and this driver doesn't use the protocol and is not structured like most other RemoteWebDrivers.

Right now there isn't a way to set a handler for http-related exceptions like this. I think that #149 and #55 would cover the use case here.

Thanks for bringing this up!