Naresh,

 Yes it is possible to use Ruby and Watir to access various elements
on a HTML page,
retrieve their attributes and save the results.

1) You can identify the number of a particular object on a page such
as
     a text field's by using Watir's "length" method for  the
"text_field" object.
     For example:

            numberOfTextFields = browser.text_fields.length

    which returns an integer value. Similar methods exist for radios,
select_list, etc.

2) Watir also provides methods to read the settings of various
attributes from any particular object.
    For example if t he length method told me I had 2 text_fileds on
the page I could use the following
    to save the setting of each attribute into a variable:

#-------------------------#
# Attributes of text_field 1
#-------------------------#
tf1_enabled = browser.text_field(:index, 1).enabled?
tf1_contents = browser.text_field(:index, 1).getContents
tf1_id= browser.text_field(:index, 1).id
tf1_max=browser.text_field(:index, 1).maxLength
tf1_name= browser.text_field(:index, 1).name
tf1_size= browser.text_field(:index, 1).size
tf1_title= browser.text_field(:index, 1).title
tf1_type= browser.text_field(:index, 1).type
tf1_value=browser.text_field(:index, 1).value

#-------------------------#
# Attributes of text_field 2
#-------------------------#
tf2_enabled = browser.text_field(:index, 2).enabled?
tf2_contents = browser.text_field(:index, 2).getContents
tf2_id= browser.text_field(:index, 2).id
tf2_max=browser.text_field(:index, 2).maxLength
tf2_name= browser.text_field(:index, 2).name
tf2_size= browser.text_field(:index, 2).size
tf2_title= browser.text_field(:index, 2).title
tf2_type= browser.text_field(:index, 2).type
tf2_value=browser.text_field(:index, 2).value


3) Now that we've use Watir to access the browser and capture the
state of each
     object into a variable, you can use Ruby method to store those
values
     into anything you wish, be that a Database, or a file, as was
addressed
    in previous replies to your question

FYI:  Info on the Watir can be found at:
            http://wiki.openqa.org/display/WTR/Project+Home
and in the Watir RDoc at:
            http://wtr.rubyforge.org/rdoc/1.6.5/

Hope this helps,
Joe

On Jun 21, 12:48 am, naresh <nareshvatsa...@gmail.com> wrote:
> Hi All,
>
> I am confused about watir. Can anyone  give me  guidance.
> I want to take value from textfields, combobox, radiobutton,
> dropdownlist.
> Then i want to create insert query for oracle database
> Is it possible to retrieve values or not from above mentioned
> components?
> guide me.
>
> Regards,
> Naresh
>
> On Jun 18, 12:58 pm, Željko Filipin <zeljko.fili...@wa-research.ch>
> wrote:
>
> > On Fri, Jun 18, 2010 at 8:10 AM, naresh vatsal <nareshvatsa...@gmail.com>
> > wrote:
>
> > >         from Venus-Admin-Insert.rb:22
>
> > And this line is?
>
> > This?
>
> > cName =ie.textField(:id, "globalForm:categoryName").set("naresh");
>
> > Željko
> > --
> > watir.com - community manager
> > watirpodcast.com - host
> > testingpodcast.com - audio podcasts on software testing. all of them
> > vidipodkast.com - pričamo o hardveru, softveru i časopisu Vidi

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

You received this message because you are subscribed to 
http://groups.google.com/group/watir-general
To post: watir-general@googlegroups.com
To unsubscribe: watir-general+unsubscr...@googlegroups.com

Reply via email to