首页 > 移动平台 > 详细

Python+Appium 获取 toast 方法的封装

时间:2018-01-13 20:16:04      阅读:325      评论:0      收藏:0      [点我收藏+]

获取toast内容方法封装如下:

  def get_Toast(self,message):  #查找toast值
        ‘‘‘
        method explain:查找toast的值,与find_Toast实现方法一样,只是不同的2种写法
        parameter explain:【text】查找的toast值
        Usage:
            device.get_Toast(再按一次退出iBer)
        ‘‘‘
        logging.info("查找toast值---‘%s‘" %(message))
        try:
            message = //*[@text=\‘{}\‘].format(message)
            ele = WebDriverWait(self.driver,5,0.5).until(expected_conditions.presence_of_element_located((By.XPATH,message)))
            return ele.get_attribute("text")
            logging.info("查找到toast----%s"%message)
        except:
            logging.error("未查找到toast----%s"%message)
            return False

 

Python+Appium 获取 toast 方法的封装

原文:https://www.cnblogs.com/syw20170419/p/8280115.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!