获取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