Refactored all clicks to use the css_click method
This commit is contained in:
@@ -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 ""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user