Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Object Identification in Watir

Thread Tools

Object Identification in Watir

Manjunath Ra
Posts: n/a

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
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 <DIV> tags followed by a <SPAN> tag. I
don=E2=80=99t know how to identify the element to get the text that is pr=
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,

-- =

Posted via

Reply With Quote
John Allen
Posts: n/a
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
Good Luck!

Posted via

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Watir: Access an Object Mario Ruiz Ruby 2 01-14-2009 04:06 PM
Watir: How to return a Watir::IE object for an existing IE? Anukul Singhal Ruby 1 05-15-2008 04:57 PM
WATIR: Error to find all most object on a Java Script driven html page Ruby 1 05-14-2006 02:31 AM
Object creation - Do we really need to create a parent for a derieved object - can't the base object just point to an already created base object jon wayne C++ 9 09-22-2005 02:06 AM
Client identification Sorin Sandu ASP .Net 1 04-09-2004 07:24 AM