def tearDown(self): if Alert().exists(): # We need to call .accept() instead of .dismiss() here to work # around ChromeDriver bug 764: # https://code.google.com/p/chromedriver/issues/detail?id=764 Alert().accept() super(AlertAT, self).tearDown()
def test_alert_dismiss(self): Alert().dismiss() self._expect_result(self.get_expected_alert_dismissed_result())
def test_alert_accept(self): Alert().accept() self._expect_result(self.get_expected_alert_accepted_result())
def test_alert_text(self): self.assertEqual(self.get_expected_alert_text(), Alert().text)
def test_alert_text_not_exists(self): self.assertFalse(Alert('Wrong text').exists())
def test_alert_text_exists(self): self.assertTrue(Alert(self.get_expected_alert_text()).exists())
def test_alert_exists(self): self.assertTrue(Alert().exists())
def setUp(self): super(AlertAT, self).setUp() click(self.get_link_to_open_alert()) wait_until(Alert().exists)
def test_write_into_non_existent_alert(self): with TemporaryAttrValue(Config, 'implicit_wait_secs', 1): with self.assertRaises(LookupError): write("8", into=Alert("Non-existent"))
def test_write_into_labelled_alert(self): write("8", into=Alert(self.get_expected_alert_text())) Alert().accept() self._expect_result("Value entered: 8")
def test_write_into_alert(self): write("7", into=Alert()) Alert().accept() self._expect_result("Value entered: 7")
def test_write_value(self): write("1") Alert().accept() self._expect_result('Value entered: 1')