I am trying to eliminate my "sleep" commands, but so far the "sleep" is 
more consistent than "wait_until_present".  Can someone check the attached 
screenshot to see the simple select list scenario and compare to the couple 
lines of Ruby/Watir script that I have below?

I have several web forms that call json data in order to determine which 
items will appear in the next select list, so depending on how fast that 
service is, I need to have the script select the value only after it is 
present.  This method seems to be exactly what I need, but I'm just not 
able to get it to work consistently.

Below are a couple lines of code specific to the two select lists:  Again, 
the choice made in the first select list will impact the options that will 
be available.  In this case, "Bachelor's" degree code should make "Business 
Management" available in the study_area_code select list.  I'm trying to 
follow examples on http://watirwebdriver.com/waiting/.

browser.select(:id, "degree_code").wait_until_present
browser.select(:id, "degree_code").select("Bachelor's")

browser.select(:id, "study_area_code").wait_until_present
browser.select(:id, "study_area_code").select("Business Management")


I get this error message, so does anyone know what I could change? I've 
already tried this variation with => instead of a comma:  
#browser.select(:id => "study_area_code").wait_until_present 

Your help would be greatly appreciated.

/Users/mherzog/.rvm/gems/ruby-1.9.3-p194/gems/watir-webdriver-0.6.1/lib/watir-webdriver/elements/select.rb:216:in
 
`no_value_found': "Business Management" not found in select list 
(Watir::Exception::NoValueFoundException)
    from 
/Users/mherzog/.rvm/gems/ruby-1.9.3-p194/gems/watir-webdriver-0.6.1/lib/watir-webdriver/elements/select.rb:150:in
 
`rescue in select_by_string'
    from 
/Users/mherzog/.rvm/gems/ruby-1.9.3-p194/gems/watir-webdriver-0.6.1/lib/watir-webdriver/elements/select.rb:147:in
 
`select_by_string'
    from 
/Users/mherzog/.rvm/gems/ruby-1.9.3-p194/gems/watir-webdriver-0.6.1/lib/watir-webdriver/elements/select.rb:129:in
 
`select_by'
    from 
/Users/mherzog/.rvm/gems/ruby-1.9.3-p194/gems/watir-webdriver-0.6.1/lib/watir-webdriver/elements/select.rb:64:in
 
`select'
    from 
/Users/mherzog/Documents/MBS/Ruby/Web_Forms/QA/LandingPages/IRF_redesign1.rb:16:in
 
`<main>'
[Finished in 10.5s with exit code 1]






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

[email protected]
http://groups.google.com/group/watir-general
[email protected]

<<attachment: Screen Shot 2012-10-04 at 3.48.40 PM.png>>

Reply via email to