Refactored all clicks to use the css_click method

This commit is contained in:
JonahStanley
2013-07-03 10:34:56 -04:00
parent 9a5326bca5
commit 19513e4134
4 changed files with 16 additions and 16 deletions

View File

@@ -153,16 +153,16 @@ def click_link(partial_text):
@world.absorb
def css_text(css_selector):
def css_text(css_selector, index=0):
# Wait for the css selector to appear
if world.is_css_present(css_selector):
try:
return world.browser.find_by_css(css_selector).first.text
return world.browser.find_by_css(css_selector)[index].text
except StaleElementReferenceException:
# The DOM was still redrawing. Wait a second and try again.
world.wait(1)
return world.browser.find_by_css(css_selector).first.text
return world.browser.find_by_css(css_selector)[index].text
else:
return ""