Skip to content

Commit d31705b

Browse files
committed
Use the updated alert code in the ReadMe for test reliability
1 parent ab390ab commit d31705b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,9 +460,9 @@ What if your test makes an alert pop up in your browser? No problem. You need to
460460
Ex:
461461

462462
```python
463-
self.driver.switch_to_alert().accept()
463+
self.wait_for_and_accept_alert()
464464

465-
self.driver.switch_to_alert().dismiss()
465+
self.wait_for_and_dismiss_alert()
466466
```
467467

468468
If you're not sure whether there's an alert before trying to accept or dismiss it, one way to handle that is to wrap your alert-handling code in a try/except block. Other methods such as .text and .send_keys() will also work with alerts.

0 commit comments

Comments
 (0)