Object Identification in Watir

Discussion in 'Ruby' started by Manjunath Ra, Oct 14, 2010.

  1. Manjunath Ra

    Manjunath Ra Guest


    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 http://www.ruby-forum.com/.=
    Manjunath Ra, Oct 14, 2010
    1. Advertisements

  2. John Allen

    John Allen Guest

    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/.
    John Allen, Oct 14, 2010
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sorin Sandu

    Client identification

    Sorin Sandu, Apr 9, 2004, in forum: ASP .Net
    Apr 9, 2004
  2. Sorin Sandu

    Re: Client identification

    Sorin Sandu, Apr 9, 2004, in forum: ASP .Net
    Bruno Sirianni
    Apr 9, 2004
  3. Daniel Jorge
  4. guy

    identification of NET objects

    guy, Sep 6, 2005, in forum: ASP .Net
    Eliyahu Goldin
    Sep 6, 2005
  5. Anukul Singhal
    Charley Baker
    May 15, 2008

Share This Page