Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[java][bidi]: add test for onNavigationFailed #16241

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
navin772 merged 4 commits into SeleniumHQ:trunk from navin772:java-onNavigationFailed-test
Sep 4, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -254,4 +254,29 @@ void canListenToDownloadWillBeginEvent()
assertThat(downloadInfo.getSuggestedFilename()).isEqualTo("file_1.txt");
}
}

@Test
@NeedsFreshDriver
@NotYetImplemented(FIREFOX)
void canListenToNavigationFailedEvent()
throws ExecutionException, InterruptedException, TimeoutException {
try (BrowsingContextInspector inspector = new BrowsingContextInspector(driver)) {
CompletableFuture<NavigationInfo> future = new CompletableFuture<>();

inspector.onNavigationFailed(future::complete);

BrowsingContext context = new BrowsingContext(driver, driver.getWindowHandle());
try {
context.navigate(
"http://invalid-domain-that-does-not-exist.test/", ReadinessState.COMPLETE);
} catch (Exception e) {
// Expect an exception due to navigation failure
}

NavigationInfo navigationInfo = future.get(5, TimeUnit.SECONDS);
assertThat(navigationInfo.getBrowsingContextId()).isEqualTo(context.getId());
assertThat(navigationInfo.getUrl())
.isEqualTo("http://invalid-domain-that-does-not-exist.test/");
}
}
}
Loading

AltStyle によって変換されたページ (->オリジナル) /