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
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 size=1 name=phone_type
             option value=- Select One --/option
             option selected= value=MMobile Phone/option
             option value=ODaytime Phone/option
             option value=HEvening Phone/option
         /select

 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
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


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:

select id=gender
option value=UUnknown/option
option value=M selectedMale/option
option value=FFemale/option
/select

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 tim.ko...@gmail.com 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=_blankhttp://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 rajivkumarnandv...@gmail.comwrote:

 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 size=1 name=phone_type
 option value=- Select One --/option
 option selected= value=MMobile Phone/option
 option value=ODaytime Phone/option
 option value=HEvening Phone/option
 /select

 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
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com