Skip to content

Instantly share code, notes, and snippets.

@aaltat
Created August 31, 2016 19:27
Show Gist options
  • Save aaltat/fb5e4de73dad82e09734460c80546e53 to your computer and use it in GitHub Desktop.
Save aaltat/fb5e4de73dad82e09734460c80546e53 to your computer and use it in GitHub Desktop.
from robot.libraries.BuiltIn import BuiltIn
def check_text(text):
s2l = BuiltIn().get_library_instance('Selenium2Library')
driver = s2l._current_browser()
for element in driver.find_elements_by_xpath('//*'):
if text in element.text:
return
raise ValueError('Text {} not from page'.format(text))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment