为了账号安全,请及时绑定邮箱和手机立即绑定

appium 用automator2定位toast提示,报错

appium 用automator2定位toast提示,报错

# coding=utf-8# toast提示必须安卓5.0以上from appium import webdriverfrom selenium.webdriver.support.ui import WebDriverWaitfrom selenium.webdriver.support import expected_conditions as ECimport timedef get_driver(): capabilities={ "platformName": "Android", "automationName":"UiAutomator2", "deviceName": "127.0.0.1:21503", "app": "E:\\apptest\\appium_test\\apk\\imoc.apk", # 注意这里的appActivity "appWaitActivity":"com.imooc.component.imoocmain.splash.GuideActivity", "noReset":"False" } driver=webdriver.Remote("http://127.0.0.1:4723/wd/hub",capabilities) time.sleep(10) return driverdef get_tost(): time.sleep(2) # toast是不是需要时间等待 tost_element=("xpath","//*[contains(@text,'登录密码错误')]") time.sleep(2) print WebDriverWait(driver,10).until(EC.presence_of_element_located(tost_element))driver = get_driver()Traceback (most recent call last):  File "E:\apptest\appium_test\testcase\case\toast_test.py", line 118, in <module>    get_tost()  File "E:\apptest\appium_test\testcase\case\toast_test.py", line 108, in get_tost    print WebDriverWait(driver,10).until(EC.presence_of_element_located(tost_element))  File "E:\cx\Python27\lib\site-packages\selenium-3.141.0-py2.7.egg\selenium\webdriver\support\wait.py", line 80, in until    raise TimeoutException(message, screen, stacktrace)selenium.common.exceptions.TimeoutException: Message: [Finished in 64.9s]
查看完整描述

2 回答

  • 2 回答
  • 0 关注
  • 1811 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信