Class: Html2rss::RequestService::PuppetCommander::PreloadRunner
- Inherits:
-
Object
- Object
- Html2rss::RequestService::PuppetCommander::PreloadRunner
- Defined in:
- lib/html2rss/request_service/puppet_commander/preload_runner.rb
Overview
Runs Browserless preload choreography: wait, click, and scroll against the interaction budget on Context#budget.
Instance Method Summary collapse
-
#call(page) ⇒ void
Executes configured preload actions on the page, if any.
-
#initialize(ctx:) ⇒ PreloadRunner
constructor
A new instance of PreloadRunner.
Constructor Details
#initialize(ctx:) ⇒ PreloadRunner
Returns a new instance of PreloadRunner.
12 13 14 |
# File 'lib/html2rss/request_service/puppet_commander/preload_runner.rb', line 12 def initialize(ctx:) @ctx = ctx end |
Instance Method Details
#call(page) ⇒ void
This method returns an undefined value.
Executes configured preload actions on the page, if any.
21 22 23 24 25 26 27 28 29 |
# File 'lib/html2rss/request_service/puppet_commander/preload_runner.rb', line 21 def call(page) preload_config = ctx.browserless_preload return unless preload_config wait_after(page, preload_config[:wait_after_ms]) click_selectors(page, preload_config[:click_selectors]) if preload_config[:click_selectors] scroll_down(page, preload_config[:scroll_down]) if preload_config[:scroll_down] wait_after(page, preload_config[:wait_after_ms]) end |