Method: Watir::Adjacent#children

Defined in:
lib/watir/adjacent.rb

#children(opt = {}) ⇒ Object

Returns collection of elements of direct children of current element.

Examples:

children = browser.select_list(id: "new_user_languages").children
children == browser.select_list(id: "new_user_languages").options.to_a
#=> true

Raises:

  • (ArgumentError)


107
108
109
110
111
# File 'lib/watir/adjacent.rb', line 107

def children(opt = {})
  raise ArgumentError, '#children can not take an index value' if opt[:index]

  xpath_adjacent(opt.merge(adjacent: :child, plural: true))
end