(self)
| 4 | |
| 5 | class HandleAlertTests(BaseCase): |
| 6 | def test_alerts(self): |
| 7 | self.goto("about:blank") |
| 8 | self.execute_script('window.alert("ALERT!!!");') |
| 9 | self.sleep(1) # Not needed (Lets you see the alert pop up) |
| 10 | self.assert_true(self.is_alert_present()) |
| 11 | self.accept_alert() |
| 12 | self.sleep(1) # Not needed (Lets you see the alert go away) |
| 13 | self.execute_script('window.prompt("My Prompt","defaultText");') |
| 14 | self.sleep(1) # Not needed (Lets you see the alert pop up) |
| 15 | alert = self.switch_to_alert() |
| 16 | self.assert_equal(alert.text, "My Prompt") # Not input field |
| 17 | self.dismiss_alert() |
| 18 | self.sleep(1) # Not needed (Lets you see the alert go away) |
| 19 | self.assert_false(self.is_alert_present()) |
| 20 | if self.browser == "safari" and self._reuse_session: |
| 21 | # Alerts can freeze Safari if reusing the browser session |
| 22 | self.driver.quit() |
nothing calls this directly
no test coverage detected