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.



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

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

Instance Attribute Details

#devtools_identifierObject

Returns the value of attribute devtools_identifier.



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

def devtools_identifier
  @devtools_identifier
end

#keyObject

Returns the value of attribute key.



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

def key
  @key
end

#scriptObject

Returns the value of attribute script.



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

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.



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

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.



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

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.



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

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