|
17 | 17 |
|
18 | 18 | package org.openqa.selenium.htmlunit;
|
19 | 19 |
|
| 20 | +import static org.openqa.selenium.remote.CapabilityType.SUPPORTS_FINDING_BY_CSS; |
| 21 | + |
20 | 22 | import com.google.common.collect.Collections2;
|
21 | 23 | import com.google.common.collect.ImmutableSet;
|
22 | 24 | import com.google.common.collect.Maps;
|
|
29 | 31 | import com.gargoylesoftware.htmlunit.ProxyConfig;
|
30 | 32 | import com.gargoylesoftware.htmlunit.ScriptResult;
|
31 | 33 | import com.gargoylesoftware.htmlunit.SgmlPage;
|
| 34 | +import com.gargoylesoftware.htmlunit.StringWebResponse; |
32 | 35 | import com.gargoylesoftware.htmlunit.TopLevelWindow;
|
| 36 | +import com.gargoylesoftware.htmlunit.UnexpectedPage; |
33 | 37 | import com.gargoylesoftware.htmlunit.WaitingRefreshHandler;
|
34 | 38 | import com.gargoylesoftware.htmlunit.WebClient;
|
35 | 39 | import com.gargoylesoftware.htmlunit.WebClientOptions;
|
|
116 | 120 | import java.util.concurrent.Callable;
|
117 | 121 | import java.util.concurrent.TimeUnit;
|
118 | 122 |
|
119 |
| -import static org.openqa.selenium.remote.CapabilityType.SUPPORTS_FINDING_BY_CSS; |
120 |
| - |
121 | 123 | public class HtmlUnitDriver implements WebDriver, JavascriptExecutor,
|
122 | 124 | FindsById, FindsByLinkText, FindsByXPath, FindsByName, FindsByCssSelector,
|
123 | 125 | FindsByTagName, FindsByClassName, HasCapabilities, HasInputDevices {
|
@@ -476,7 +478,10 @@ protected void get(URL fullUrl) {
|
476 | 478 | // A "get" works over the entire page
|
477 | 479 | currentWindow = getCurrentWindow().getTopWindow();
|
478 | 480 | } catch (UnknownHostException e) {
|
479 |
| - // This should be fine |
| 481 | + getCurrentWindow().getTopWindow().setEnclosedPage(new UnexpectedPage( |
| 482 | + new StringWebResponse("Unknown host", fullUrl), |
| 483 | + getCurrentWindow().getTopWindow() |
| 484 | + )); |
480 | 485 | } catch (ConnectException e) {
|
481 | 486 | // This might be expected
|
482 | 487 | } catch (SocketTimeoutException e) {
|
|
0 commit comments