A long time back, Scott Hanselman of microsoft had posted a ruby watir
recorder in his blog. Like most other recorders, this had the problem
that the code generated couldn't be reused.
I made some small tweaking to this code so that when a user traverses
through the page, clicking on each element that he wants to record, it
records all the elements in the Watir format and gives back a nice
module with properties defined for each element.
As a sample say you have a page with two fields FirstName and
LastName.
The recorded output will be something like below:
module MyPage
def first_name
$browser.text_field(:id, "FirstName")
end
def last_name
$browser.text_field(:id, "LastName)
end
end
Now just add this module to your test cases and use first_name,
last_name etc directly without bothering about the identification of
IDs.
I could share this script if anybody was interested. But, I am not
sure where I can upload it.
Thanks,
Babitha
--
Before posting, please read http://watir.com/support. In short: search before
you ask, be nice.
[email protected]
http://groups.google.com/group/watir-general
[email protected]