You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -460,9 +460,9 @@ What if your test makes an alert pop up in your browser? No problem. You need to
460
460
Ex:
461
461
462
462
```python
463
-
self.driver.switch_to_alert().accept()
463
+
self.wait_for_and_accept_alert()
464
464
465
-
self.driver.switch_to_alert().dismiss()
465
+
self.wait_for_and_dismiss_alert()
466
466
```
467
467
468
468
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