Object Identification in Watir

Hi,

I am new to watir. I have been reading materials on watir for past few
days and decided to try out some simple things on our web application in
IE. But looking at the way our application has been designed I am now
getting a doubt whether Watir is the right tool for our kind of
application.
Ours is a web application, page is loaded by .jsp. We have a grid in our
application I just wanted to get a data from one of the grid cell. I
have downloaded IE developer tool bar to learn the property of the grid
cell. It returned a series of

tags followed by a tag. I
don’t know how to identify the element to get the text that is present
in the element. I am attaching the exact output of IE developer tool bar
(in the form of .htm file, view source of the file to get the element
details) and the screen shot of the image. Kindly let me know how do I
identify the element to perform action on it,

Thanks In Advance,

You have to keep in mind that Watir was built for interacting with a web
broswer, usually for test automation of websites. If you are just going
to go to a web page and pull down information, you might just want to
use Hpricot instead. You can just load the html into a string (using
something like the open-uri gem) and pass it to the Hpricot object, and
then query for your data by using the DOM path to the data you want.
For example, this textbox that I’m typing into has a DOM path of
/html/body/div/div/div/div/div/div/form/table/tr/td/textarea ( There
are shortcuts to that if there are class and id tags present) You can
get the DOM path by using either the Firefox browser with the Firebug
plug in, or the Chrome browser, right click on the element you need,
select “inspect element”. A web search for ‘ruby hpricot’ will turn up
lots of howto pages that can explain it all better :slight_smile:
Good Luck!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs