Created
November 22, 2010 15:26
-
-
Save bfaloona/710107 to your computer and use it in GitHub Desktop.
Access to WatirCraft Methods from WatirCraft page classes
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
# lib/methods/versions.rb | |
module MyProject | |
module Methods | |
def app_version | |
browser.url.match(/\/myproject\/([0-9]{2})\//)[1].to_i | |
end | |
end | |
end | |
# lib/pages/versioned_page.rb | |
module MyProject | |
class VersionedPage < Taza::Page | |
# in order to make app_version() available, | |
# this explicit include is required on every page class (with :: prepended) | |
include ::MyProject::Methods | |
field(:versioned_textbox) do | |
if app_version > 3 | |
browser.text_field(:id, 'text3') | |
else | |
browser.text_field(:id, 'text5') | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment