from appium import webdriver from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.by import By def always_allow(self,driver,number=2): logger.info("跳过系统权限") for i in range(number): allow_button = (By.XPATH, self.allow) try: a_button = WebDriverWait(self.driver,1,0.5).until(EC.presence_of_element_located(allow_button)) a_button.click() except Exception as e: pass