|
25 | 25 | import static org.openqa.selenium.testing.drivers.Browser.IE;
|
26 | 26 | import static org.openqa.selenium.testing.drivers.Browser.SAFARI;
|
27 | 27 |
|
| 28 | +import java.time.Duration; |
| 29 | +import java.time.temporal.ChronoUnit; |
28 | 30 | import org.junit.jupiter.api.AfterEach;
|
29 | 31 | import org.junit.jupiter.api.BeforeEach;
|
30 | 32 | import org.junit.jupiter.api.Test;
|
31 | 33 | import org.openqa.selenium.Alert;
|
32 | 34 | import org.openqa.selenium.By;
|
33 | 35 | import org.openqa.selenium.TimeoutException;
|
34 | 36 | import org.openqa.selenium.UsernameAndPassword;
|
| 37 | +import org.openqa.selenium.WebDriverException; |
35 | 38 | import org.openqa.selenium.bidi.Network;
|
36 | 39 | import org.openqa.selenium.environment.webserver.AppServer;
|
37 | 40 | import org.openqa.selenium.environment.webserver.NettyAppServer;
|
@@ -136,6 +139,23 @@ void canCancelAuth() {
|
136 | 139 | }
|
137 | 140 | }
|
138 | 141 |
|
| 142 | + @Test |
| 143 | + @NotYetImplemented(SAFARI) |
| 144 | + @NotYetImplemented(IE) |
| 145 | + @NotYetImplemented(EDGE) |
| 146 | + @NotYetImplemented(FIREFOX) |
| 147 | + void canFailRequest() { |
| 148 | + try (Network network = new Network(driver)) { |
| 149 | + network.addIntercept(new AddInterceptParameters(InterceptPhase.BEFORE_REQUEST_SENT)); |
| 150 | + network.onBeforeRequestSent( |
| 151 | + responseDetails -> network.failRequest(responseDetails.getRequest().getRequestId())); |
| 152 | + page = server.whereIs("basicAuth"); |
| 153 | + driver.manage().timeouts().pageLoadTimeout(Duration.of(5, ChronoUnit.SECONDS)); |
| 154 | + |
| 155 | + assertThatThrownBy(() -> driver.get(page)).isInstanceOf(WebDriverException.class); |
| 156 | + } |
| 157 | + } |
| 158 | + |
139 | 159 | @AfterEach
|
140 | 160 | public void quitDriver() {
|
141 | 161 | if (driver != null) {
|
|
0 commit comments