On Friday, May 17, 2013 10:45:54 AM UTC-7, Dan wrote:
You may need a when_present because if that list is being populated via some other selection or ajax it might not be there when you're trying to select it.
@browser.select_list(:name => "siteName").when_present.select "ccfashion"
+1 for that idea. I've had to do that a bunch on sites that use ajax calls to create the lists. However in this case the error was not that it could not find the list, but the option, so we may need to wait for the option to be present, not the list. I think this might work for that
@browser.select_list(:name => "siteName").option("ccfashion").when_present.select
A lot of times an indication this is needed is if a line of code works fine from IRB (because by the time you type in the code, the list is likely populated) but not when run in your script. If you don't like IRB you could try something like this, to see if the item appears in the list over time
10.times do
puts @browser.select_list(:name => "siteName").include?("ccfashion")
sleep 1
end
If that does not work, is there more than one list? maybe you are finding a list that does not include that option?
puts @browser.select_lists(:name => "siteName").count # should be 1 if there is only one list with that name
Since the list has an ID that should be unique of the name is not, so you could try
@browser.select_list(:id => "site").select "ccfashion"