如何检查下拉选择或不使用watir?

时间:2013-07-02 08:18:40

标签: ruby watir

我想检查是否选择了下拉列表

if(ie.select_list(:id, "DropDownList").selected?)#this is wrong
  puts "selected"
else
   puts "not selected"
end

我该怎么检查?

1 个答案:

答案 0 :(得分:2)

看这里find out the value in select list

ar_vals = ie.select_list(:id, "DropDownList").selected_options
ar_vals.empty? ? puts "not selected" : puts "selected"