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

 




posted @ 2018-11-17 17:24  转角看见牛  阅读(1780)  评论(0编辑  收藏  举报