Beispiel #1
0
 def find_by_swip2(driver: WebDriver, by, locator) -> WebElement:
     driver.implicitly_wait(1)
     elements = driver.find_elements(by, locator)
     while len(elements) == 0:
         driver.swipe(0, 600, 0, 400)
         elements = driver.find_elements(by, locator)
     driver.implicitly_wait(5)
     return elements[0]
Beispiel #2
0
 def wait_find_elements(self, by_type: str, value: str, driver: WebDriver = None):
     """
     获取多个元素, 显式等待
     :param driver:
     :param by_type:
     :param value:
     :return:
     """
     driver = driver or self.driver
     if not driver:
         return driver
     try:
         WebDriverWait(driver, 10).until(EC.presence_of_all_elements_located(locator=(by_type, value)))
         return driver.find_elements(by_type, value)
     except:
         return False
Beispiel #3
0
 def wait_ele_for(driver: WebDriver):
     eles = driver.find_elements(by, locator)
     return len(eles) > 0
Beispiel #4
0
 def wait_ele_for(driver: WebDriver):
     eles = driver.find_elements(MobileBy.XPATH, "//*[@text='女']")
     return len(eles) > 0