Method: Selenium::WebDriver::Remote::Bridge#find_elements_by

Defined in:
lib/selenium/webdriver/remote/bridge.rb

#find_elements_by(how, what, parent_ref = []) ⇒ Object



507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
# File 'lib/selenium/webdriver/remote/bridge.rb', line 507

def find_elements_by(how, what, parent_ref = [])
  how, what = @locator_converter.convert(how, what)

  return execute_atom :findElements, Support::RelativeLocator.new(what).as_json if how == 'relative'

  parent_type, parent_id = parent_ref
  ids = case parent_type
        when :element
          execute :find_child_elements, {id: parent_id}, {using: how, value: what.to_s}
        when :shadow_root
          execute :find_shadow_child_elements, {id: parent_id}, {using: how, value: what.to_s}
        else
          execute :find_elements, {}, {using: how, value: what.to_s}
        end

  ids.map { |id| Bridge.element_class.new self, element_id_from(id) }
end