Appium处理弹框


 

 1 from appium import  webdriver
 2 from selenium .webdriver.support import expected_conditions 
 3 from selenium .webdriver.support.ui import WebDriverWait
 4 
 5 处理弹框并点击  以后再说
 6 
 7 def talke_later(driver):
 8     '''
 9     1、传入driver
10     2、range(5)    判断弹窗次数
11     3、Webdriverwait里面0.5s判断一次是否有弹框,1s超时
12     '''
13     for i in range(5):
14         loc=("xpath","//*[@text='以后再说']")
15         try:
16             e=WebDriverWait(driver,1,0.5).until(expected_conditions.
          presence_of_element_located(loc))
17 e.click() 18 except: 19 pass

 





免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM