Class: Selenium::WebDriver::DevTools::Request

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, url:, method:, headers:, post_data:) ⇒ Request

Returns a new instance of Request.



42
43
44
45
46
47
48
# File 'lib/selenium/webdriver/devtools/request.rb', line 42

def initialize(id:, url:, method:, headers:, post_data:)
  @id = id
  @url = url
  @method = method
  @headers = headers
  @post_data = post_data
end

Instance Attribute Details

#headersObject

Returns the value of attribute headers.



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

def headers
  @headers
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#methodObject

Returns the value of attribute method.



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

def method
  @method
end

#post_dataObject

Returns the value of attribute post_data.



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

def post_data
  @post_data
end

#urlObject

Returns the value of attribute url.



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

def url
  @url
end

Class Method Details

.from(id, params) ⇒ Object

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.

Creates request from DevTools message.



32
33
34
35
36
37
38
39
40
# File 'lib/selenium/webdriver/devtools/request.rb', line 32

def self.from(id, params)
  new(
    id: id,
    url: params.dig('request', 'url'),
    method: params.dig('request', 'method'),
    headers: params.dig('request', 'headers').dup,
    post_data: params.dig('request', 'postData')
  )
end

Instance Method Details

#==(other) ⇒ Object



50
51
52
53
54
55
56
57
# File 'lib/selenium/webdriver/devtools/request.rb', line 50

def ==(other)
  self.class == other.class &&
    id == other.id &&
    url == other.url &&
    method == other.method &&
    headers == other.headers &&
    post_data == other.post_data
end

#inspectObject



59
60
61
# File 'lib/selenium/webdriver/devtools/request.rb', line 59

def inspect
  %(#<#{self.class.name} @id="#{id}" @method="#{method}" @url="#{url}")
end