Sha256: 8acbc98ba7b7f99093d09a79498fff6c948b8a24a02100a539ec8233b214d25b

Contents?: true

Size: 1003 Bytes

Versions: 2

Compression:

Stored size: 1003 Bytes

Contents

module Dhalang
    # Contains common logic for interacting with Puppeteer.
    class Puppeteer
        NODE_MODULES_PATH = Dir.pwd + '/node_modules/'.freeze
        private_constant :NODE_MODULES_PATH
        
        # Launches a new Node process, executing the (Puppeteer) script under the given script_path.
        #
        # @param [String] page_url              The url to pass to the goTo method of Puppeteer.
        # @param [String] script_path           The absolute path of the JS script to execute.
        # @param [String] temp_file_path        The absolute path of the temp file to use to write any actions tom from Puppeteer.
        # @param [String] temp_file_extension   The extension of the temp file.
        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
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
Dhalang-0.3.1 lib/Dhalang/puppeteer.rb
Dhalang-0.3.0 lib/Dhalang/puppeteer.rb