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



439
440
441
# File 'lib/kreuzcrawl/native.rb', line 439

def script
  @script
end

Class Method Details

.from_hash(hash) ⇒ Object



465
466
467
# File 'lib/kreuzcrawl/native.rb', line 465

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

Instance Method Details

#click?Boolean

Returns:

  • (Boolean)


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

def click? = false

#execute_js?Boolean

Returns:

  • (Boolean)


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

def execute_js? = true

#press?Boolean

Returns:

  • (Boolean)


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

def press? = false

#scrape?Boolean

Returns:

  • (Boolean)


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

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

#screenshot?Boolean

Returns:

  • (Boolean)


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

def screenshot? = false

#scroll?Boolean

Returns:

  • (Boolean)


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

def scroll? = false

#type_text?Boolean

Returns:

  • (Boolean)


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

def type_text? = false

#wait?Boolean

Returns:

  • (Boolean)


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

def wait? = false