Commit 359cbbb4 by David Baumgold

Fixing up ui_helpers based on feedback from Christina

parent 437e658f
...@@ -73,9 +73,8 @@ def css_click(css_selector, index=0, max_attempts=5, success_condition=lambda: T ...@@ -73,9 +73,8 @@ def css_click(css_selector, index=0, max_attempts=5, success_condition=lambda: T
for _ in range(max_attempts): for _ in range(max_attempts):
try: try:
world.css_find(css_selector)[index].click() world.css_find(css_selector)[index].click()
if not success_condition(): if success_condition():
raise Exception("unsuccessful click") return
return
except WebDriverException: except WebDriverException:
# Occasionally, MathJax or other JavaScript can cover up # Occasionally, MathJax or other JavaScript can cover up
# an element temporarily. # an element temporarily.
...@@ -118,6 +117,8 @@ def css_check(css_selector, index=0, max_attempts=5, success_condition=lambda: T ...@@ -118,6 +117,8 @@ def css_check(css_selector, index=0, max_attempts=5, success_condition=lambda: T
else: else:
# try once more, letting exceptions raise # try once more, letting exceptions raise
world.css_find(css_selector)[index].check() world.css_find(css_selector)[index].check()
if not success_condition():
raise Exception("unsuccessful check")
@world.absorb @world.absorb
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment