-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Closed as not planned
Closed as not planned
Copy link
Labels
A-needs-triagingA Selenium member will evaluate this soon!A Selenium member will evaluate this soon!B-devtoolsIncludes everything BiDi or Chrome DevTools relatedIncludes everything BiDi or Chrome DevTools relatedC-javaJava BindingsJava BindingsI-enhancementSomething could be betterSomething could be betterJ-awaiting answerQuestion asked of user; a reply moves it to triage againQuestion asked of user; a reply moves it to triage again
Description
Description
I'm currently enabling WebDriver BiDi because of its advantages, but things get complicated when it comes to dialog (like alert, model, and prompt). I have to add a lot of code compared to the Legacy protocol to work with alert
WebDriver BiDi:
DevTools devTools = ((ChromeDriver) webDriver).getDevTools();
devTools.createSession();
// Listen for JavaScript dialogs (alerts, confirms, prompts)
devTools.send(Page.enable());
devTools.addListener(Page.javascriptDialogOpening(), dialog -> {
System.out.println("Alert Text: " + dialog.getMessage());
devTools.send(Page.handleJavaScriptDialog(true, null)); // Accept the alert
});
Legacy:
webDriver.switchTo().alert();
It would be nice to have a more user-friendly way to handle alerts, as it is heavily used in almost every project.
Have you considered any alternatives or workarounds?
I'm currently turning off BiDi on tests that contain alerts.
Metadata
Metadata
Assignees
Labels
A-needs-triagingA Selenium member will evaluate this soon!A Selenium member will evaluate this soon!B-devtoolsIncludes everything BiDi or Chrome DevTools relatedIncludes everything BiDi or Chrome DevTools relatedC-javaJava BindingsJava BindingsI-enhancementSomething could be betterSomething could be betterJ-awaiting answerQuestion asked of user; a reply moves it to triage againQuestion asked of user; a reply moves it to triage again