python automation: appium acquired toast

Codes are as follows:

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

Guess you like

Origin www.cnblogs.com/badbadboyyx/p/12163426.html