getAllContents gives only the text.

As I wrote already above, I want to find out the titles because it
will save time for the test. If I am checking the titles, the test
will last more than 6 hours.

If I am checking the titles it will save a lot of duplicate effort.

On Dec 8, 2:23 pm, Chuck van der Linden <sqa...@gmail.com> wrote:
> Would a normal user be able to select the items that way?  why not
> interact with the page in the way a user would, choosing the options
> on the select according to the displayed text?
>
> Given you can't interact as a user would, then in terms of getting the
> options, you could try using the .getAllContents  method on the
> select_list element to see if the title attribute is returned, or if
> it only shows the values and text associated with each option.   If
> titles are shown, then it might be possible to parse the returned
> contents and fine the value or text associated with each selection
> choice that has a title looking like the one you want.  it means
> writing a tiny parser in ruby code, but the ruby string methods make
> that fairly easy to do.
>
> puts browser.select_list(how, what).getAllContents
>
> On Dec 8, 12:11 pm, Shlomit Gazit <shlomitpatr...@gmail.com> wrote:
>
>
>
> > I have lots of options like this one:
>
> > <option id="http://semanticweb.databaserepublic.com/c2p/systemData/
> > searchField#attachmentTargetItself" value="341" title="true,Inner
> > Search,^50$|^62$|^56$,attachmentTargetItself">Attachment::</option>
>
> > and I am trying to capture all options with title x.
>
> > As I know option is detected only by value or text. How can I get the
> > title from the html above?
>
> > On Dec 8, 9:11 am, Super Kevy <kpe...@scholarshipamerica.org> wrote:
>
> > > using youroptionfragment I modeled a quick form:
>
> > > Save as C:\ruby\testing\klp1.html
> > > <html>
> > > <head>
> > > <title>MyTest</title>
> > > </head>
> > > <body>
> > > <form name="input" action="html_form_action.asp" method="get">
> > > Username: <input type="text" name="user" />
> > > <form action="">
> > > <select name="cars">
> > > <optionid="a2" value="volvo">Volvo</option>
> > > <optionid="a3" value="saab">Saab</option>
> > > <optionid="a4" value="fiat">Fiat</option>
> > > <optionod="a5" value="audi">Audi</option>
> > > <optionid="http://semanticweb.databaserepublic.com/c2p/systemData/
> > > searchField#attachmentTargetItself" value="341" title="true,Inner
> > > Search,^50$|^62$|^56$,attachmentTargetItself">Attachment::</option>
> > > </select>
> > > <input type="submit" value="Submit" />
> > > </form>
> > > </body>
> > > </html>
>
> > > require 'rubygems'
> > > require 'watir'
> > > ie = Watir::IE.new
> > > sUrl='C:\Ruby\Testing\KLP1.html'
> > > ie.goto(sUrl)
> > > ie.maximize()
> > > ie.bring_to_front()
> > > sleep 3
> > > puts 'Select Attachment from the select list'
> > > ie.select_list(:name,'cars').set('Attachment::')
> > > sleep 3
> > > puts 'Attachment should be selected'
>
> > > I'm totally confused what you're trying to select...- Hide quoted text -
>
> > - Show quoted text -

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

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

Reply via email to