# Object Identification in Watir

**URL:** <https://rubytalk.org/t/object-identification-in-watir/60442>\
**Category:** ruby-talk\
**Created:** [14 October 2010 10:03 UTC](https://rubytalk.org/t/object-identification-in-watir/60442 "2010-10-14T10:03:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Manjunath\_Ra](https://avatars.discourse-cdn.com/v4/letter/m/8e8cbc/32.png) [@Manjunath\_Ra](https://rubytalk.org/u/Manjunath_Ra)\
**Post date:** [14 October 2010 10:03 UTC](https://rubytalk.org/t/object-identification-in-watir/60442/1 "2010-10-14T10:03:17Z")

</div>

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 \<DIV\> tags followed by a \<SPAN\> 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,

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![John\_Allen1](https://avatars.discourse-cdn.com/v4/letter/j/43a26b/32.png) [@John\_Allen1](https://rubytalk.org/u/John_Allen1)\
**Post date:** [14 October 2010 14:26 UTC](https://rubytalk.org/t/object-identification-in-watir/60442/2 "2010-10-14T14:26:32Z")

</div>

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 [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
