23. Multi-Tab Navigation & Native Dialog Handling

Handling New Tabs & Native Dialogs

Page newTab = page.waitForPage(() -> {
    page.getByRole(AriaRole.LINK, new Page.GetByRoleOptions().setName("Terms of Service")).click();
});

page.onDialog(dialog -> {
dialog.accept();
});

Task

  • Implement acceptNextDialog:
  • 1. Accept Page page.
  • 2. Register page.onDialog(dialog -> dialog.accept()).
πŸ’‘Common doubts
Did you like the problem?
Lesson 23 of 38
Java
Loading code editor…
Next