from selenium.webdriver.firefox.webdriver import WebDriver from selenium.webdriver.common.action_chains import ActionChains import time import os import selenium success = True desired_caps = {} desired_caps['browserName'] = 'iOS' desired_caps['platform'] = 'Mac' desired_caps['version'] = '6.1' desired_caps['device'] = 'iPad' desired_caps['app'] = os.path.abspath('/Users/marshall/Library/Developer/Xcode/DerivedData/TestAutomation-empzzpwyyxctxidnwdsrtlssueqi/Build/Products/Debug-iphonesimulator/TestAutomation.app') wd = selenium.webdriver.Remote('http://0.0.0.0:4723/wd/hub', desired_caps) wd.implicitly_wait(60) def is_alert_present(wd): try: wd.switch_to_alert().text return True except: return False try: wd.find_element_by_name("First").click() wd.find_element_by_name("Second").click() finally: wd.quit() if not success: raise Exception("Test failed.") |