Class: Puppeteer::RaceLocator

Inherits:
Locator
  • Object
show all
Defined in:
lib/puppeteer/locators.rb,
sig/puppeteer/locators.rbs

Constant Summary

Constants inherited from Locator

Locator::RETRY_DELAY_SECONDS

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Locator

#click, #clone, #copy_options, #fill, #filter, #filter_handle, function_string?, #hover, #map, #map_handle, #on, #once, race, #scroll, #set_ensure_element_is_in_the_viewport, #set_timeout, #set_visibility, #set_wait_for_enabled, #set_wait_for_stable_bounding_box, #timeout, #wait, #wait_handle

Methods included from EventCallbackable

#add_event_listener, #emit_event, #observe_first, #off, #on_event, #remove_event_listener

Constructor Details

#initialize(locators) ⇒ RaceLocator

Returns a new instance of RaceLocator.

Parameters:

  • locators (Object)


749
750
751
752
# File 'lib/puppeteer/locators.rb', line 749

def initialize(locators)
  super()
  @locators = locators
end

Class Method Details

.create(locators) ⇒ Object

Parameters:

  • locators (Object)

Returns:

  • (Object)


744
745
746
747
# File 'lib/puppeteer/locators.rb', line 744

def self.create(locators)
  array = check_locator_array(locators)
  new(array)
end

Instance Method Details

#_cloneObject

Returns:

  • (Object)


754
755
756
# File 'lib/puppeteer/locators.rb', line 754

protected def _clone
  self.class.new(@locators.map(&:clone)).copy_options(self)
end

#_wait(options) ⇒ Object

Parameters:

  • options (Object)

Returns:

  • (Object)


758
759
760
761
762
763
# File 'lib/puppeteer/locators.rb', line 758

protected def _wait(options)
  tasks = @locators.map do |locator|
    proc { locator.send(:_wait, options) }
  end
  Puppeteer::AsyncUtils.await_promise_race(*tasks)
end