python自动化:appium中获取toast

实现代码如下:

from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
class toast:
    def is_toast_exist(self,driver,text,timeout=30, poll_frequency=0.5):
        try:
            toast_loc = ("xpath", "//*[contains(@text,%s)]"%text)
            WebDriverWait(driver, timeout, poll_frequency).until(EC.presence_of_element_located(toast_loc))
            return True
        except:
            return False

猜你喜欢

转载自www.cnblogs.com/badbadboyyx/p/12163426.html
今日推荐