Example #1
0
 def page_loaded(webdriver):
     # jQuery should be inactive (no AJAX pending).
     if not initial_jquery_active:
         if not wait.jquery_inactive(webdriver):
             return False
     # Body element doesn't have class 'oe_wait'.
     try:
         webdriver.find_element(By.CSS_SELECTOR, 'body.oe_wait')
     except:
         pass
     else:
         return False
     return True
Example #2
0
 def page_loaded(webdriver):
     # jQuery should be inactive (no AJAX pending).
     if not initial_jquery_active:
         if not wait.jquery_inactive(webdriver):
             return False
     # Body element doesn't have class 'oe_wait'.
     try:
         webdriver.find_element(By.CSS_SELECTOR, 'body.oe_wait')
     except:
         pass
     else:
         return False
     return True
Example #3
0
    def wait_for_ajax_load(self, timeout=10):
        """Wait for AJAX-style load and assert new page has been loaded."""
        # Inspect initial state.
        initial_jquery_active = not wait.jquery_inactive(self.webdriver)

        # Yield (back to 'with' block where user clicks or whatever)
        yield

        # Check state changed.
        def page_loaded(webdriver):
            # jQuery should be inactive (no AJAX pending).
            if not initial_jquery_active:
                if not wait.jquery_inactive(webdriver):
                    return False
            # Body element doesn't have class 'oe_wait'.
            try:
                webdriver.find_element(By.CSS_SELECTOR, 'body.oe_wait')
            except:
                pass
            else:
                return False
            return True

        ui.WebDriverWait(self.webdriver, timeout).until(page_loaded)
Example #4
0
    def wait_for_ajax_load(self):
        """Wait for AJAX-style load and assert new page has been loaded."""
        # Inspect initial state.
        initial_jquery_active = not wait.jquery_inactive(self.webdriver)

        # Yield (back to 'with' block where user clicks or whatever)
        yield

        # Check state changed.
        def page_loaded(webdriver):
            # jQuery should be inactive (no AJAX pending).
            if not initial_jquery_active:
                if not wait.jquery_inactive(webdriver):
                    return False
            # Body element doesn't have class 'oe_wait'.
            try:
                webdriver.find_element(By.CSS_SELECTOR, 'body.oe_wait')
            except:
                pass
            else:
                return False
            return True

        ui.WebDriverWait(self.webdriver, 10).until(page_loaded)