mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-06-06 16:38:55 +00:00
26 lines
779 B
Python
26 lines
779 B
Python
import os
|
|
import sys
|
|
import unittest
|
|
|
|
sys.path.insert(1, os.path.abspath(os.path.join(__file__, "../..")))
|
|
import base_test
|
|
from webdriver import exceptions, wait
|
|
|
|
|
|
class AlertsQuitTest(base_test.WebDriverBaseTest):
|
|
def setUp(self):
|
|
self.wait = wait.WebDriverWait(self.driver, 5, ignored_exceptions=[exceptions.NoSuchAlertException])
|
|
self.driver.get(self.webserver.where_is('modal/res/alerts.html'))
|
|
|
|
def test_can_quit_when_an_alert_is_present(self):
|
|
self.driver.find_element_by_css('#alert').click()
|
|
alert = self.wait.until(lambda x: x.switch_to_alert())
|
|
self.driver.quit()
|
|
with self.assertRaises(Exception):
|
|
alert.accept()
|
|
AlertsQuitTest.driver = None
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|