[Wtr-general] Finding the name of objects

Paul Rogers paul.rogers at shaw.ca
Thu May 3 16:19:53 EDT 2007


oops, you can also do this too

give focus to the element you are interested in ( for a text field, just click in it , for a link you have to tab to it )
then do
ie.show_active

Paul
  ----- Original Message ----- 
  From: Paul Rogers 
  To: wtr-general at rubyforge.org 
  Sent: Thursday, May 03, 2007 2:16 PM
  Subject: Re: [Wtr-general] Finding the name of objects


  you can also use the show_all_objects method, like this

  in irb
  require 'watir'
  ie=Watir::IE.attach(:title , 'the title of your browser window')
  ie.show_all_objects

  and then you can use flash and to_s

  ie.text_field(:index,1).flash
  ie.text_field(:index,1).to_s
    ----- Original Message ----- 
    From: Charley Baker 
    To: wtr-general at rubyforge.org 
    Sent: Thursday, May 03, 2007 2:12 PM
    Subject: Re: [Wtr-general] Finding the name of objects


    I'm starting to sound like a broken record and was just thinking about updating the user guide for this. Use the ie developer toolbar to find controls and identify them, while being familiar with the html source and some basic knowledge around the dom is important, this will also help: 

    http://www.microsoft.com/downloads/details.aspx?familyid=E59C3964-672D-4511-BB3E-2D5E1DB91038&displaylang=en 

    -Charley 


    On 5/3/07, Ken <forum-watir-users at openqa.org> wrote: 
      I just got started with this and am trying to write a simple script to get my feet wet.  I was following the googlesearch.rb case that is provided.  My question is how do you find the name of the object that you want to perform an action with?  For example: 

      ie.text_field(:name, "q").set("pickaxe") # q is the name of the search field

      How do you know that q is the name of the search field?  I viewed the source of the page and eventually found the field named q but it was not obvious or easy.  It was so murky that if I didnt know already that the fields name was q I never would have found it.  Is there a simple way to identify a list box, text field, radio button...etc? 

      Thanks.
      _______________________________________________
      Wtr-general mailing list
      Wtr-general at rubyforge.org
      http://rubyforge.org/mailman/listinfo/wtr-general





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


    _______________________________________________
    Wtr-general mailing list
    Wtr-general at rubyforge.org
    http://rubyforge.org/mailman/listinfo/wtr-general


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


  _______________________________________________
  Wtr-general mailing list
  Wtr-general at rubyforge.org
  http://rubyforge.org/mailman/listinfo/wtr-general
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070503/971d699c/attachment.html 


More information about the Wtr-general mailing list