Skip to content

Commit 53142a2

Browse files
authored
Merge branch 'trunk' into netty-4.2
2 parents 200cf40 + a603bed commit 53142a2

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

java/test/org/openqa/selenium/bidi/browsingcontext/BrowsingContextInspectorTest.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,4 +254,29 @@ void canListenToDownloadWillBeginEvent()
254254
assertThat(downloadInfo.getSuggestedFilename()).isEqualTo("file_1.txt");
255255
}
256256
}
257+
258+
@Test
259+
@NeedsFreshDriver
260+
@NotYetImplemented(FIREFOX)
261+
void canListenToNavigationFailedEvent()
262+
throws ExecutionException, InterruptedException, TimeoutException {
263+
try (BrowsingContextInspector inspector = new BrowsingContextInspector(driver)) {
264+
CompletableFuture<NavigationInfo> future = new CompletableFuture<>();
265+
266+
inspector.onNavigationFailed(future::complete);
267+
268+
BrowsingContext context = new BrowsingContext(driver, driver.getWindowHandle());
269+
try {
270+
context.navigate(
271+
"http://invalid-domain-that-does-not-exist.test/", ReadinessState.COMPLETE);
272+
} catch (Exception e) {
273+
// Expect an exception due to navigation failure
274+
}
275+
276+
NavigationInfo navigationInfo = future.get(5, TimeUnit.SECONDS);
277+
assertThat(navigationInfo.getBrowsingContextId()).isEqualTo(context.getId());
278+
assertThat(navigationInfo.getUrl())
279+
.isEqualTo("http://invalid-domain-that-does-not-exist.test/");
280+
}
281+
}
257282
}

0 commit comments

Comments
 (0)