Class: Puppeteer::FunctionLocator

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(page_or_frame, func) ⇒ FunctionLocator

Returns a new instance of FunctionLocator.

Parameters:

  • page_or_frame (Object)
  • func (Object)


567
568
569
570
571
# File 'lib/puppeteer/locators.rb', line 567

def initialize(page_or_frame, func)
  super()
  @page_or_frame = page_or_frame
  @func = func
end

Class Method Details

.create(page_or_frame, func) ⇒ Puppeteer::Locator

Parameters:

Returns:



563
564
565
# File 'lib/puppeteer/locators.rb', line 563

def self.create(page_or_frame, func)
  new(page_or_frame, func).set_timeout(default_timeout_for(page_or_frame))
end

Instance Method Details

#_cloneObject

Returns:

  • (Object)


573
574
575
# File 'lib/puppeteer/locators.rb', line 573

protected def _clone
  self.class.new(@page_or_frame, @func).copy_options(self)
end

#_wait(options) ⇒ Object

Parameters:

  • options (Object)

Returns:

  • (Object)


577
578
579
# File 'lib/puppeteer/locators.rb', line 577

protected def _wait(options)
  @page_or_frame.wait_for_function(@func, timeout: options[:timeout])
end