写了个 python 实现的 appium 脚本,抓取 toast 信息的,但是总是提示错误,各位大侠帮忙看看
脚本如下:
class BACK_UP_APP_TestCase(unittest.TestCase):
def setUp(self):
unittest.TestCase.setUp(self)
desired_caps = {}
desired_caps['automationName'] = 'Selendroid'
desired_caps['device'] = 'android'
desired_caps['platformName'] = 'Android'
desired_caps['platformVersion'] = '4.4.2'
desired_caps['deviceName'] = '192.168.128.117'+':5555'
desired_caps['app'] = 'e:\\SC\\ConferenceControl.apk'
desired_caps['appPackage'] = 'com.grandstream.confctrol'
desired_caps['appActivity'] = '.activity.ConnectActivity'
self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
self.extend = Appium_Extend(self.driver)
self.driver.implicitly_wait(20) #设置全局最大等待时间
def test_c0001(self):
self.driver.find_element_by_link_text("Internet").click()
self.driver.find_element_by_link_text("OK").click()
a = find_toast(u"Password can not be empty", 20, 0.5, self.driver)
调用的查找 toast 函数
def find_toast(message, timeout, poll_frequency, driver):
element = WebDriverWait(driver, timeout, poll_frequency).until(expected_conditions.presence_of_element_located((By.PARTIAL_LINK_TEXT, message)))
错误信息:
Error
Traceback (most recent call last):
File "D:\python_test\SIP\TestSuit_Backup.py", line 278, in test_c0005_cancel_backup
a = find_toast(u"Password can not be empty", 20, 0.5, self.driver)
File "D:\python_test\SIP\TestSuit_Backup.py", line 24, in find_toast
element = WebDriverWait(driver, timeout, poll_frequency).until(expected_conditions.presence_of_element_located((By.PARTIAL_LINK_TEXT, message)))
File "C:\Python27\lib\site-packages\selenium\webdriver\support\wait.py", line 80, in until
raise TimeoutException(message, screen, stacktrace)
TimeoutException: Message: