Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

implement wait_for_ajax in an even better way

  • Loading branch information...
commit f5df3440b2dfe50018a925575dd0fb38f2d64fdb 1 parent 7a01058
@klrmn authored
Showing with 4 additions and 3 deletions.
  1. +3 −2 pages/create_run_page.py
  2. +1 −1  pages/page.py
View
5 pages/create_run_page.py
@@ -25,8 +25,9 @@ class MozTrapEditRunPage(MozTrapBasePage):
_remove_selected_suites_locator = (By.CSS_SELECTOR, '.multiselect .include-exclude .action-exclude')
_submit_locator = (By.CSS_SELECTOR, '#run-add-form .form-actions > button')
- # Note on __init__: it fails with 'ReferenceError: jQuery is not defined'
- # if you try to wait_for_ajax
+ def __init__(self, testsetup):
+ MozTrapBasePage.__init__(self, testsetup)
+ self.wait_for_ajax()
def fill_fields(self, **kwargs):
'''
View
2  pages/page.py
@@ -63,7 +63,7 @@ def is_element_visible(self, by, value):
def wait_for_ajax(self):
WebDriverWait(self.selenium, self.timeout).until(
- lambda s: s.execute_script("return jQuery.active == 0"),
+ lambda s: s.execute_script('return (typeof jQuery !== "undefined" && jQuery.active == 0)'),
"Wait for AJAX timed out after %s seconds" % self.timeout)
def type_in_element(self, locator, text):
Please sign in to comment.
Something went wrong with that request. Please try again.