python appium 封装获取toast方法
获取toast text封装,传入toast 部分文本,返回全部文本
def get_toast_text(self,text): try: toast_loc = (By.XPATH, "//*[contains(@text,'"+text+"')]") logger.info(toast_loc) ele = WebDriverWait(self.driver, 10, 0.1).until(EC.presence_of_element_located(toast_loc)) return ele.text except: return None
需要导入
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
欢迎扫码关注自动化技术公众号