Skip to content

Commit 2066fc0

Browse files
authored
Update WorkingWithBrowserModals.md
Add more implementation details
1 parent a2327f7 commit 2066fc0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

docs/WorkingWithBrowserModals.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,13 @@ public class ExamplePage extends Page implements DetectsLoadCompletion {
8282
}
8383
```
8484

85+
The preceeding example shows how to incorporate **AlertHandler** into a page class that models a page with associated browser modals. Pay attention to the notes in the code comments, as these provide important information to keep in mind when creating your own implementation. To maintain solid synchronization between your automation and the system under test, it's critical to implement the **DetectsLoadCompletion** interface in landing page classes, instances of which are returned by alert methods like **`accept`**. The example above only shows a definition for the **`accept`** function, but you'll need to implement all three of the abstract method declared by **AlertHandler**, even if the page being modeled doesn't require the associated function. For unneeded methods, a simple solution is just to throw **UnsupportedOperationException** with a meaningful message.
86+
8587
Here are some of the advantages of using **AlertHandler** in your page model classes:
8688
* The **AlertHandler** base class switches the driver to the alert for you, removing this concern from your own implementation.
8789
* Routing calls to alert functions through page object methods maintains control of transition synchronization and page object life cycle.
8890
* Your code never has to deal with **NoAlertPresentException** just to check for the presence of an alert or to wait for one to appear.
8991

9092

9193

92-
> Written with [StackEdit](https://stackedit.io/).
94+
> Written with [StackEdit](https://stackedit.io/).

0 commit comments

Comments
 (0)