Object Identification in Watir

M

Manjunath Ra

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=E2=80=99t know how to identify the element to get the text that is pr=
esent
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/.=
 
J

John Allen

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top