Class: Kreuzcrawl::PageActionExecuteJs

Inherits:
Data
  • Object
show all
Extended by:
T::Sig
Includes:
PageAction
Defined in:
lib/kreuzcrawl/native.rb

Overview

Execute arbitrary JavaScript in the page context.

# Safety

The script runs with full page privileges in the browser context. Only execute scripts from trusted sources.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#scriptObject (readonly)

rubocop:disable Lint/UselessMethodDefinition



436
437
438
# File 'lib/kreuzcrawl/native.rb', line 436

def script
  @script
end

Class Method Details

.from_hash(hash) ⇒ Object



462
463
464
# File 'lib/kreuzcrawl/native.rb', line 462

def self.from_hash(hash)
  new(script: hash[:script] || hash["script"])
end

Instance Method Details

#click?Boolean

Returns:

  • (Boolean)


444
# File 'lib/kreuzcrawl/native.rb', line 444

def click? = false

#execute_js?Boolean

Returns:

  • (Boolean)


456
# File 'lib/kreuzcrawl/native.rb', line 456

def execute_js? = true

#press?Boolean

Returns:

  • (Boolean)


448
# File 'lib/kreuzcrawl/native.rb', line 448

def press? = false

#scrape?Boolean

Returns:

  • (Boolean)


458
459
460
# File 'lib/kreuzcrawl/native.rb', line 458

def scrape? = false
# @param hash [Hash] deserialized from the native extension
# @return [self]

#screenshot?Boolean

Returns:

  • (Boolean)


454
# File 'lib/kreuzcrawl/native.rb', line 454

def screenshot? = false

#scroll?Boolean

Returns:

  • (Boolean)


450
# File 'lib/kreuzcrawl/native.rb', line 450

def scroll? = false

#type_text?Boolean

Returns:

  • (Boolean)


446
# File 'lib/kreuzcrawl/native.rb', line 446

def type_text? = false

#wait?Boolean

Returns:

  • (Boolean)


452
# File 'lib/kreuzcrawl/native.rb', line 452

def wait? = false