Class: Selenium::WebDriver::DevTools::PinnedScript

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/webdriver/devtools/pinned_script.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(script) ⇒ PinnedScript

Returns a new instance of PinnedScript.


27
28
29
30
# File 'lib/selenium/webdriver/devtools/pinned_script.rb', line 27

def initialize(script)
  @key = SecureRandom.alphanumeric
  @script = script
end

Instance Attribute Details

#devtools_identifierObject

Returns the value of attribute devtools_identifier.


25
26
27
# File 'lib/selenium/webdriver/devtools/pinned_script.rb', line 25

def devtools_identifier
  @devtools_identifier
end

#keyObject

Returns the value of attribute key.


25
26
27
# File 'lib/selenium/webdriver/devtools/pinned_script.rb', line 25

def key
  @key
end

#scriptObject

Returns the value of attribute script.


25
26
27
# File 'lib/selenium/webdriver/devtools/pinned_script.rb', line 25

def script
  @script
end

Instance Method Details

#callableObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


36
37
38
# File 'lib/selenium/webdriver/devtools/pinned_script.rb', line 36

def callable
  "function __webdriver_#{key}(arguments) { #{script} }"
end

#removeObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


52
53
54
# File 'lib/selenium/webdriver/devtools/pinned_script.rb', line 52

def remove
  "__webdriver_#{key} = undefined"
end

#to_jsonObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


44
45
46
# File 'lib/selenium/webdriver/devtools/pinned_script.rb', line 44

def to_json(*)
  %{"return __webdriver_#{key}(arguments)"}
end