Python selenium.webdriver.support.expected_conditions.staleness_of() Examples
The following are 6
code examples of selenium.webdriver.support.expected_conditions.staleness_of().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
selenium.webdriver.support.expected_conditions
, or try the search function
.
Example #1
Source File: extended_driver.py From golem with MIT License | 6 votes |
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)
Example #2
Source File: utils.py From opencraft with GNU Affero General Public License v3.0 | 5 votes |
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")
Example #3
Source File: legoshop.py From lego-mindstorms-ev3-comparison with GNU General Public License v3.0 | 5 votes |
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")
Example #4
Source File: test_selenium.py From ckanext-oauth2 with GNU Affero General Public License v3.0 | 5 votes |
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))
Example #5
Source File: scrape_lib.py From finance-dl with GNU General Public License v2.0 | 5 votes |
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()
Example #6
Source File: tools.py From Kairos with GNU General Public License v3.0 | 4 votes |
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))