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.


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

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.


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

def headers
  @headers
end

#idObject (readonly)

Returns the value of attribute id.


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

def id
  @id
end

#methodObject

Returns the value of attribute method.


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

def method
  @method
end

#post_dataObject

Returns the value of attribute post_data.


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

def post_data
  @post_data
end

#urlObject

Returns the value of attribute url.


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

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.


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

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

Instance Method Details

#==(other) ⇒ Object


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

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


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

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