Some things to try.
a) Look at the HTML source for each of the variants of the page, and
try to identify and common attribute that Watir can use to distinguish
them. Perhaps while the button's text may change (e.g. "Recherche
Google" or "Google Search", some other attribute remains constant
(e.g. it index).
b) Add case statements to the test to pick the correct code based on
the style of the test which you would need to set in advance, perhaps
by using an element in the URL (e.g.
http://www.google.ca/webhp?hl=fr
http://www.google.ca
http://www.google.it
http://www.google.com/webhp?hl=es
In each URL the last 2 characters of the URL can be used to identify
the language. Which you could use as a means to select the correct
version for your test to run.
myLanguage = "en" # You'll need to provide some means to set this
automatically or you'll have to edit it for each test run.
case myLanguage
when "es" # Spanish
sButtonText = "Buscar con Google"
when "fr" # French
sButtonText = "Recherche Google"
when "en" # English
sButtonText = "Google Search"
when "it" # Italian
sButtonText = "Cerca con Google"
end
browser.button(:text, sButtonText ).click
c) If you can't find a commonality that works reliably, you could try
creating a support file for the test (e.g. an Excel spreadsheet) and
populating it with the distinguishing data. Then have your test read
the data from the support file, based on which style of the test
(French, English, etc.) that is being run. In essence make you test a
data driven test. With as much data as is practical being read from
the support file and used by the test as necessary.
Hope this helps,
Joe
--
Before posting, please read http://watir.com/support. In short: search before
you ask, be nice.
You received this message because you are subscribed to
http://groups.google.com/group/watir-general
To post: [email protected]
To unsubscribe: [email protected]