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

欢迎扫码关注自动化技术公众号

python appium 封装获取toast方法

 

相关文章:

  • 2021-09-13
  • 2021-09-06
  • 2022-12-23
  • 2021-07-02
  • 2022-03-02
  • 2022-12-23
  • 2021-07-13
猜你喜欢
  • 2021-09-29
  • 2022-12-23
  • 2022-12-23
  • 2022-02-16
  • 2022-12-23
  • 2022-01-28
  • 2021-08-15
相关资源
相似解决方案