ruby - Watir/ ruby : How to get the text of the selected item in a drop down list?

标签 ruby watir

如何使用 Watir 返回下拉列表中当前选定项目的文本? getSelectedItems 似乎已被弃用。

最佳答案

改用 selected_options()。

selected_options () Description:

Gets all the selected items in the select list as an array. An empty array is returned if the select box has no selected item. Output:

Array containing the selected items of the select list.

Source

关于ruby - Watir/ ruby : How to get the text of the selected item in a drop down list?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3541275/

相关文章:

ruby-on-rails - 未定义方法 `errors' 为 nil :NilClass in app/views/articles/new. html.erb

ruby - 是否可以禁用 watir 的等待时间?

ruby - 在 ubuntu 11.10 上运行

ruby /沃提尔 : Unable to parse through xls Columns using the spreadsheet GEM

ruby-on-rails - Rails "try"常量

Ruby新手: Writing a method to read mulitple arrays from a file?

ruby-on-rails - Rspec:如何测试 ActiveRecord::Base.connection.execute

ruby - 使用 celerity 在 linux 上登录 saleforce.com(没有 gui),JS 和 VB 错误

serialization - watir-webdriver cookie jar 保存和加载

ruby-on-rails - 为什么 'haml --check' 找不到这个明显的语法错误