Loading ...
Sorry, an error occurred while loading the content.
 

Using Div tag in WATIR

Expand Messages
  • Cool Priti
    Hello Everyone, I am trying to do mouseover of my image which is in a div tag. But I m afraid if WATIR can see the image present in div tag. The code I m
    Message 1 of 3 , Jan 9, 2006
      Hello Everyone,
      I am trying to do mouseover of my image which is in a div tag. But I'm afraid if WATIR can see the image present in div tag.
      The code I'm writing for accessing the image is as follows:
      $ie.div(:id,"div1").image(:id,"roll").fireEvent("onMouseOver")
      Is it a right way? Or a another way is there?
      Can anybody please help me?
      Thank you,
      Priti.

      Send instant messages to your online friends http://in.messenger.yahoo.com

      [Non-text portions of this message have been removed]
    • Shashank Date
      Hi, I am not sure why you want Watir to see the image in the tag. Can you not identify it using :id or :src directly like you would any other image? Like
      Message 2 of 3 , Jan 13, 2006
        Hi,

        I am not sure why you want Watir to see the image in the <div> tag.

        Can you not identify it using :id or :src directly like you would any other image?
        Like this:

        #############
        require "watir"
        testSite = "C:\\tst_watir.html"
        $ie = Watir::IE.new
        $ie.goto(testSite)

        ## This one is outside a <div> tag
        $ie.image(:src,/watir.gif/).fireEvent("onMouseOver")

        ## This one is inside a <div> tag
        $ie.image(:id,"pogo").fireEvent("onMouseOver")

        ## p $ie.div(:id,"here").methods.sort #<< check if Div object responds to .image

        __END__

        That is what was suggested here:

        http://rubyforge.org/pipermail/wtr-general/2005-October/003717.html

        If you insist on making sure that it is in the <div> tag then I do not think that your method of accessing the image will work. I have tried.

        The syntax is correct but it fails at the .image call with the following error:

        -----------------------
        C:/ruby/lib/ruby/site_ruby/1.8/watir.rb:856:in `getImage': undefined local variable or method `document' for #<Watir::Div:0x2de8748> (NameError)
        from C:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2701:in `initialize'
        from C:/ruby/lib/ruby/site_ruby/1.8/watir.rb:608:in `new'
        from C:/ruby/lib/ruby/site_ruby/1.8/watir.rb:608:in `image'
        from C:/atest/tst_watir2.rb:13
        -----------------------

        You may want to try asking this on the Watir ML:

        http://rubyforge.org/mailman/listinfo/wtr-general

        If you do, please include a snippet of your code and a test .html file along with details of your Windows version, Ruby version and Watir version. Also an error log if possible.

        HTH,
        -- Shashank

        Cool Priti <cool_priti_s@...> wrote:
        Hello Everyone,
        I am trying to do mouseover of my image which is in a div tag. But I'm afraid if WATIR can see the image present in div tag.
        The code I'm writing for accessing the image is as follows:
        $ie.div(:id,"div1").image(:id,"roll").fireEvent("onMouseOver")
        Is it a right way? Or a another way is there?
        Can anybody please help me?
        Thank you,
        Priti.

        Send instant messages to your online friends http://in.messenger.yahoo.com

        [Non-text portions of this message have been removed]



        SPONSORED LINKS
        Programming languages Computer security C programming language Computer programming languages Computer training

        ---------------------------------
        YAHOO! GROUPS LINKS


        Visit your group "ruby-india" on the web.

        To unsubscribe from this group, send an email to:
        ruby-india-unsubscribe@yahoogroups.com

        Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


        ---------------------------------






        ---------------------------------
        Yahoo! Photos – Showcase holiday pictures in hardcover
        Photo Books. You design it and we’ll bind it!

        [Non-text portions of this message have been removed]
      • bpettichord
        ... I m afraid if WATIR can see the image present in div tag. ... Looks right to me. You ll have to use Watir 1.5, however.
        Message 3 of 3 , Mar 2, 2006
          --- In ruby-india@yahoogroups.com, Cool Priti <cool_priti_s@...> wrote:
          >
          > Hello Everyone,
          > I am trying to do mouseover of my image which is in a div tag. But
          I'm afraid if WATIR can see the image present in div tag.
          > The code I'm writing for accessing the image is as follows:
          > $ie.div(:id,"div1").image(:id,"roll").fireEvent("onMouseOver")
          > Is it a right way? Or a another way is there?
          > Can anybody please help me?
          > Thank you,
          > Priti.

          Looks right to me. You'll have to use Watir 1.5, however.
        Your message has been successfully submitted and would be delivered to recipients shortly.