Class: Puppeteer::Bidi::RaceLocator
- Defined in:
- lib/puppeteer/bidi/locator.rb,
sig/puppeteer/bidi/locator.rbs
Overview
Locator that races multiple locators.
Constant Summary
Constants inherited from Locator
Instance Attribute Summary
Attributes inherited from Locator
#ensure_element_is_in_viewport, #timeout, #visibility, #wait_for_enabled, #wait_for_stable_bounding_box
Instance Method Summary collapse
- #_clone ⇒ Object
- #_wait(timeout_ms:, deadline:) ⇒ Object
-
#initialize(locators) ⇒ RaceLocator
constructor
A new instance of RaceLocator.
Methods inherited from Locator
#build_deadline, #click, #clone, #copy_options, #ensure_element_is_in_viewport?, #ensure_element_is_in_viewport_if_needed, #fill, #fill_directly, #filter, #hover, #map, #map_handle, #off, #on, #once, #perform_action, race, #raise_timeout, #remaining_time_ms, #scroll, #set_ensure_element_is_in_the_viewport, #set_timeout, #set_visibility, #set_wait_for_enabled, #set_wait_for_stable_bounding_box, #wait, #wait_for_enabled?, #wait_for_enabled_if_needed, #wait_for_stable_bounding_box?, #wait_for_stable_bounding_box_if_needed, #wait_handle, #wait_until, #with_retry
Constructor Details
#initialize(locators) ⇒ RaceLocator
Returns a new instance of RaceLocator.
809 810 811 812 |
# File 'lib/puppeteer/bidi/locator.rb', line 809 def initialize(locators) super() @locators = locators end |
Instance Method Details
#_clone ⇒ Object
816 817 818 |
# File 'lib/puppeteer/bidi/locator.rb', line 816 def _clone RaceLocator.new(@locators.map(&:clone)).(self) end |
#_wait(timeout_ms:, deadline:) ⇒ Object
820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 |
# File 'lib/puppeteer/bidi/locator.rb', line 820 def _wait(timeout_ms:, deadline:) found = nil wait_until(deadline) do @locators.each do |locator| begin found = locator.__send__(:_wait, timeout_ms: timeout_ms, deadline: deadline) break rescue RetryableError next end end !found.nil? end found end |