Re: Re: [wtr-general] how to get slectlist box option value

2011-02-25 Thread rajivkumarnandvani

thanks All
I got this from this URL  
http://rdoc.info/gems/watir/1.7.0/Watir/SelectList:option


Given the following html:


Unknown
Male
Female


get the value attribute of option with visible text 'Female'

browser.select_list(:id, 'gender').option(:text, 'Female').value #=> 'F'

or find out if the value 'M' is selected

browser.select_list(:id, 'gender').option(:value, 'M').selected #=> true

* attribute - Symbol :value, :text or other attribute - how we find an item  
in the select box

* value - string or reg exp - what we are looking for

just to inform Priya.

By your example it will not work because
browser.select_list(:name, "phone_type").select("M")
Select("M") M is the value while here it required Text "Mobile Phone"

browser.select_list(:name, "phone_type").select("Mobile Phone")

cheers :)



On , Tim Koopmans  wrote:

b.select_list(:name => "phone_type").options.collect {|o| o.text[/\w/]}





or this





b.goto 'http://tinyurl.com/6f8v92t'







Cheers,



Tim









On Fri, Feb 25, 2011 at 5:28 PM, Rajiv Nanduani



rajivkumarnandv...@gmail.com> wrote:



> Hi All,



>


> I am facing a problem with watir for list box object. I have to extrach  
the



> value of select item in list box instead of text value Like..



>



>



> - Select One --



> Mobile Phone



> Daytime Phone



> Evening Phone



>



>



> Here i need the value property value like M , O , H



>



> please suggest how to get this value using watir/ruby



>



> --



> RAJIV KUMAR



>



> http://rajivkumarnandvani.wordpress.com/>



> http://learnqtphelp.blogspot.com/>



>



>



> --



> 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



>





--


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





watir-general@googlegroups.com


watir-general+unsubscr...@googlegroups.com"  
target="_blank">http://groups.google.com/group/watir-general



watir-general+unsubscr...@googlegroups.com


--
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


Re: [wtr-general] how to get slectlist box option value

2011-02-25 Thread Tim Koopmans
b.select_list(:name => "phone_type").options.collect {|o| o.text[/\w/]}

or this

b.goto 'http://tinyurl.com/6f8v92t'


Cheers,
Tim



On Fri, Feb 25, 2011 at 5:28 PM, Rajiv Nanduani
 wrote:
> Hi All,
>
> I am facing a problem with watir for list box object. I have to extrach the
> value of select item in list box instead of text value Like..
>
> 
>             - Select One --
>             Mobile Phone
>             Daytime Phone
>             Evening Phone
>         
>
> Here i need the value property value like M , O , H
>
> please suggest how to get this value using watir/ruby
>
> --
> RAJIV KUMAR
>
> 
> 
>
>
> --
> 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
>

-- 
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


Re: [wtr-general] how to get slectlist box option value

2011-02-24 Thread Priya D
Try this

To select individual attribute :-

browser.select_list(:name, "phone_type").select("M")



On 25 February 2011 11:58, Rajiv Nanduani wrote:

> Hi All,
>
> I am facing a problem with watir for list box object. I have to extrach the
> value of select item in list box instead of text value Like..
>
> 
> - Select One --
> Mobile Phone
> Daytime Phone
> Evening Phone
> 
>
> Here i need the value property value like M , O , H
>
> please suggest how to get this value using watir/ruby
>
> --
> RAJIV KUMAR
>
> 
> 
>
>
>  --
> 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
>

-- 
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