Class: Dhalang::Puppeteer

Inherits:
Object
  • Object
show all
Defined in:
lib/Dhalang/puppeteer.rb

Overview

Contains common logic for interacting with Puppeteer.

Class Method Summary collapse

Class Method Details

.visit(page_url, script_path, temp_file_path, temp_file_extension) ⇒ Object

Launches a new Node process, executing the (Puppeteer) script under the given script_path.

Parameters:

  • page_url (String)

    The url to pass to the goTo method of Puppeteer.

  • script_path (String)

    The absolute path of the JS script to execute.

  • temp_file_path (String)

    The absolute path of the temp file to use to write any actions tom from Puppeteer.

  • temp_file_extension (String)

    The extension of the temp file.



13
14
15
# File 'lib/Dhalang/puppeteer.rb', line 13

def self.visit(page_url, script_path, temp_file_path, temp_file_extension)
    system("node #{script_path} #{Shellwords.escape(NODE_MODULES_PATH)} #{page_url} #{Shellwords.escape(temp_file_path)} #{Shellwords.escape(temp_file_extension)}")
end