Created
November 29, 2012 18:52
-
-
Save titusfortner/4171098 to your computer and use it in GitHub Desktop.
Page Object Webdriver Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GoogleHome | |
def initialize driver | |
@driver = driver | |
end | |
def goto | |
go_to "http://google.com" | |
return self | |
end | |
def search_field | |
return {:name => "q"} | |
end | |
def search_results | |
return {:id => "search"} | |
end | |
def search_for term | |
submit_text search_field, term | |
wait_for_element_present search_results | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include UtilityModule | |
browser = initialize_test | |
search_term = "Cheese!" | |
GoogleHome.new(browser).goto.search_for search_term | |
raise unless get_title.include?(search_term.downcase) | |
end_test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment