当前位置: 首页>>代码示例>>Python>>正文


Python expected_conditions.staleness_of方法代码示例

本文整理汇总了Python中selenium.webdriver.support.expected_conditions.staleness_of方法的典型用法代码示例。如果您正苦于以下问题:Python expected_conditions.staleness_of方法的具体用法?Python expected_conditions.staleness_of怎么用?Python expected_conditions.staleness_of使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在selenium.webdriver.support.expected_conditions的用法示例。


在下文中一共展示了expected_conditions.staleness_of方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: wait_for_element_not_present

# 需要导入模块: from selenium.webdriver.support import expected_conditions [as 别名]
# 或者: from selenium.webdriver.support.expected_conditions import staleness_of [as 别名]
def wait_for_element_not_present(self, element, timeout):
        """Wait for element not present in the DOM

        :Args:
        - element: an element tuple, a CSS string or a WebElement object
        - timeout: time to wait (in seconds)
        """
        found_element = None
        try:
            found_element = self.find(element, timeout=0)
        except ElementNotFound:
            pass
        if found_element:
            wait = WebDriverWait(self, timeout)
            message = ('Timeout waiting for element {} to not be present'
                       .format(found_element.name))
            wait.until(ec.staleness_of(found_element), message=message) 
开发者ID:golemhq,项目名称:golem,代码行数:19,代码来源:extended_driver.py

示例2: submit_form

# 需要导入模块: from selenium.webdriver.support import expected_conditions [as 别名]
# 或者: from selenium.webdriver.support.expected_conditions import staleness_of [as 别名]
def submit_form(self):
        """
        Click the submit button on the form and wait for the next page to
        load.
        """
        html = self.client.find_element_by_tag_name('html')
        submit = self.form.find_element_by_tag_name('button')
        submit.click()
        # Wait for page to start reloading.
        WebDriverWait(self.client, timeout=3) \
            .until(expected_conditions.staleness_of(html))
        # Wait for page to finish reloading.
        WebDriverWait(self.client, timeout=20) \
            .until(lambda driver: driver.execute_script("return document.readyState;") == "complete") 
开发者ID:open-craft,项目名称:opencraft,代码行数:16,代码来源:utils.py

示例3: wait_for_page_load

# 需要导入模块: from selenium.webdriver.support import expected_conditions [as 别名]
# 或者: from selenium.webdriver.support.expected_conditions import staleness_of [as 别名]
def wait_for_page_load(self, timeout=10):
    """
    This solution only works for "non-javascript" clicks, ie clicks that will cause the browser to load a brand new page, and thus load a brand new HTML body element.
    @see http://www.obeythetestinggoat.com/how-to-get-selenium-to-wait-for-page-load-after-a-click.html
    :param self:
    :param timeout:
    :return:
    """
    self.log.debug("Waiting for page to load at {}.".format(self.driver.current_url))
    old_page = self.find_element_by_tag_name('html')
    yield
    WebDriverWait(self, timeout).until(staleness_of(old_page)) 
开发者ID:timelyart,项目名称:Kairos,代码行数:14,代码来源:tools.py

示例4: _process_survey_age_country

# 需要导入模块: from selenium.webdriver.support import expected_conditions [as 别名]
# 或者: from selenium.webdriver.support.expected_conditions import staleness_of [as 别名]
def _process_survey_age_country(self):
        try:
            print("* They want to know how old we are.")
            age_field = self.wait.until(EC.element_to_be_clickable(
                (By.NAME, 'rpAgeAndCountryAgeField')))
            age_field.send_keys('55')
            age_field.send_keys(Keys.RETURN)

            # wait for age_field's DOM element to be removed
            self.wait.until(EC.staleness_of(age_field))
        except TimeoutException:
            print("!!! Something's wrong with the survey") 
开发者ID:bittner,项目名称:lego-mindstorms-ev3-comparison,代码行数:14,代码来源:legoshop.py

示例5: _introduce_log_in_parameters

# 需要导入模块: from selenium.webdriver.support import expected_conditions [as 别名]
# 或者: from selenium.webdriver.support.expected_conditions import staleness_of [as 别名]
def _introduce_log_in_parameters(cls, username=FILAB2_MAIL, password=FILAB_PASSWORD):
        driver = cls.driver
        id_username = WebDriverWait(cls.driver, 10).until(EC.presence_of_element_located((By.ID, "id_email")))
        id_username.clear()
        id_username.send_keys(username)
        driver.find_element_by_id("id_password").clear()
        driver.find_element_by_id("id_password").send_keys(password)
        driver.find_element_by_xpath("//button[@type='submit']").click()
        WebDriverWait(driver, 30).until(EC.staleness_of(id_username)) 
开发者ID:conwetlab,项目名称:ckanext-oauth2,代码行数:11,代码来源:test_selenium.py

示例6: wait_for_page_load

# 需要导入模块: from selenium.webdriver.support import expected_conditions [as 别名]
# 或者: from selenium.webdriver.support.expected_conditions import staleness_of [as 别名]
def wait_for_page_load(self, timeout=30):
        old_page = self.driver.find_element_by_tag_name('html')
        yield
        WebDriverWait(self.driver, timeout).until(
            expected_conditions.staleness_of(old_page),
            message='waiting for page to load')
        self.check_after_wait() 
开发者ID:jbms,项目名称:finance-dl,代码行数:9,代码来源:scrape_lib.py


注:本文中的selenium.webdriver.support.expected_conditions.staleness_of方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。