Hello,
I need to start automating my web application project. While I have used
watir before, this time I want to implement something new.

I want to implement GUI-Map file where object references of html elements
are stored. So I will create logical entities and map them to objects of
html elements present in my test application. Now in test script wherever
there is a need to refer to an html element object I can do so using its
logical name given in the map file. This allows me to have logical names for
ui objects instead of literal locator strings.
You can find more about this concept here:
http://functionaltestautomation.blogspot.com/2009/09/ui-elements-all-about-it.html

So I was thinking of implementing a text file e.g:
*Map.txt* with contents:

userna...@browser.text_field(:id, "Username")
passwo...@browser.text_field(:id, "Password")
submitbutt...@browser.button(:id, "Submit")

OR
I could create a hash object in a *Map.rb* file, e.g:

  @map = Hash.new
  @map["Username"]='@browser.text_field(:id, "Username")'
  @map["Password"]='@browser.text_field(:id, "Password")'
  @map["SubmitButton"]='@browser.button(:id, "Submit")'


And then I could get the contents in above files in my code.
The problem is that whether I read from a text file or a hash object, I am
going to get the contents in strings. So if I want to click on submit
button, I will write something like this in my code:

@map["SubmitButton"].click


And this will give me an error: "undefined method click for string element"

So my question is that, is there any way at all to extract the object
@browser.button(:id,
"Submit") out of the string '@browser.button(:id, "Submit")', so that I can
execute the click operation on it.

Also, I would like to know if there is a better way of implementing this UI
map than what I am thinking of. Hope someone can help me out.

Thanks,
Prajakta

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

Reply via email to