playwright-ruby-client 1.15.1 → 1.17.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/documentation/docs/api/{fetch_request.md → api_request_context.md} +2 -2
  3. data/documentation/docs/api/browser_context.md +1 -1
  4. data/documentation/docs/api/element_handle.md +2 -3
  5. data/documentation/docs/api/frame.md +30 -0
  6. data/documentation/docs/api/frame_locator.md +70 -0
  7. data/documentation/docs/api/locator.md +35 -2
  8. data/documentation/docs/api/page.md +35 -4
  9. data/documentation/docs/api/request.md +3 -3
  10. data/documentation/docs/api/selectors.md +1 -1
  11. data/documentation/docs/api/tracing.md +2 -2
  12. data/documentation/docs/include/api_coverage.md +26 -7
  13. data/documentation/package.json +2 -2
  14. data/documentation/yarn.lock +1430 -1486
  15. data/lib/playwright/channel_owners/api_request_context.rb +4 -0
  16. data/lib/playwright/channel_owners/artifact.rb +1 -6
  17. data/lib/playwright/channel_owners/browser.rb +6 -8
  18. data/lib/playwright/channel_owners/browser_context.rb +5 -3
  19. data/lib/playwright/channel_owners/browser_type.rb +0 -1
  20. data/lib/playwright/channel_owners/fetch_request.rb +5 -1
  21. data/lib/playwright/channel_owners/frame.rb +13 -7
  22. data/lib/playwright/channel_owners/page.rb +18 -10
  23. data/lib/playwright/channel_owners/request.rb +9 -21
  24. data/lib/playwright/channel_owners/response.rb +0 -4
  25. data/lib/playwright/connection.rb +9 -0
  26. data/lib/playwright/frame_locator_impl.rb +49 -0
  27. data/lib/playwright/locator_impl.rb +17 -5
  28. data/lib/playwright/route_handler.rb +13 -1
  29. data/lib/playwright/tracing_impl.rb +6 -9
  30. data/lib/playwright/version.rb +2 -2
  31. data/lib/playwright/video.rb +3 -0
  32. data/lib/playwright.rb +2 -1
  33. data/lib/playwright_api/api_request_context.rb +149 -0
  34. data/lib/playwright_api/browser_context.rb +6 -1
  35. data/lib/playwright_api/element_handle.rb +2 -3
  36. data/lib/playwright_api/frame.rb +26 -1
  37. data/lib/playwright_api/frame_locator.rb +51 -0
  38. data/lib/playwright_api/locator.rb +25 -2
  39. data/lib/playwright_api/page.rb +35 -9
  40. data/lib/playwright_api/playwright.rb +5 -0
  41. data/lib/playwright_api/selectors.rb +2 -2
  42. data/lib/playwright_api/tracing.rb +4 -4
  43. data/lib/playwright_api/worker.rb +4 -4
  44. metadata +11 -7
  45. data/lib/playwright_api/fetch_request.rb +0 -74
@@ -0,0 +1,4 @@
1
+ module Playwright
2
+ define_channel_owner :APIRequestContext do
3
+ end
4
+ end
@@ -1,14 +1,13 @@
1
1
  module Playwright
2
2
  define_channel_owner :Artifact do
3
3
  private def after_initialize
4
- @remote = false
5
4
  @absolute_path = @initializer['absolutePath']
6
5
  end
7
6
 
8
7
  attr_reader :absolute_path
9
8
 
10
9
  def path_after_finished
11
- if @remote
10
+ if @connection.remote?
12
11
  raise "Path is not available when using browser_type.connect(). Use save_as() to save a local copy."
13
12
  end
14
13
  @channel.send_message_to_server('pathAfterFinished')
@@ -30,9 +29,5 @@ module Playwright
30
29
  def cancel
31
30
  @channel.send_message_to_server('cancel')
32
31
  end
33
-
34
- private def update_as_remote
35
- @remote = true
36
- end
37
32
  end
38
33
  end
@@ -7,7 +7,7 @@ module Playwright
7
7
  private def after_initialize
8
8
  @connected = true
9
9
  @closed_or_closing = false
10
- @remote = false
10
+ @should_close_connection_on_close = false
11
11
 
12
12
  @contexts = Set.new
13
13
  @channel.on('close', method(:on_close))
@@ -58,6 +58,9 @@ module Playwright
58
58
  return if @closed_or_closing
59
59
  @closed_or_closing = true
60
60
  @channel.send_message_to_server('close')
61
+ if @should_close_connection_on_close
62
+ @connection.stop
63
+ end
61
64
  nil
62
65
  rescue => err
63
66
  raise unless safe_close_error?(err)
@@ -99,13 +102,8 @@ module Playwright
99
102
  @contexts << context
100
103
  end
101
104
 
102
- # called from BrowserType#connectOverCDP
103
- private def update_as_remote
104
- @remote = true
105
- end
106
-
107
- private def remote?
108
- @remote
105
+ private def should_close_connection_on_close!
106
+ @should_close_connection_on_close = true
109
107
  end
110
108
 
111
109
  # called from BrowserContext#on_close with send(:remove_context), so keep private.
@@ -72,6 +72,11 @@ module Playwright
72
72
 
73
73
  if @routes.none? { |handler_entry| handler_entry.handle(wrapped_route, wrapped_request) }
74
74
  route.continue
75
+ else
76
+ @routes.reject!(&:expired?)
77
+ if @routes.count == 0
78
+ @channel.async_send_message_to_server('setNetworkInterceptionEnabled', enabled: false)
79
+ end
75
80
  end
76
81
  end
77
82
 
@@ -271,9 +276,6 @@ module Playwright
271
276
  def close
272
277
  if @options && @options.key?(:recordHar)
273
278
  har = ChannelOwners::Artifact.from(@channel.send_message_to_server('harExport'))
274
- if @browser.send(:remote?)
275
- har.update_as_remote
276
- end
277
279
  har.save_as(@options[:recordHar][:path])
278
280
  har.delete
279
281
  end
@@ -54,7 +54,6 @@ module Playwright
54
54
 
55
55
  result = @channel.send_message_to_server_result('connectOverCDP', params)
56
56
  browser = ChannelOwners::Browser.from(result['browser'])
57
- browser.send(:update_as_remote)
58
57
 
59
58
  if result['defaultContext']
60
59
  context = ChannelOwners::BrowserContext.from(result['defaultContext'])
@@ -1,4 +1,8 @@
1
+ require_relative './api_request_context'
2
+
1
3
  module Playwright
2
- define_channel_owner :FetchRequest do
4
+ module ChannelOwners
5
+ class FetchRequest < APIRequestContext
6
+ end
3
7
  end
4
8
  end
@@ -110,8 +110,8 @@ module Playwright
110
110
  def wait_for_load_state(state: nil, timeout: nil)
111
111
  option_state = state || 'load'
112
112
  option_timeout = timeout || @page.send(:timeout_settings).navigation_timeout
113
- unless %w(load domcontentloaded networkidle).include?(option_state)
114
- raise ArgumentError.new('state: expected one of (load|domcontentloaded|networkidle)')
113
+ unless %w(load domcontentloaded networkidle commit).include?(option_state)
114
+ raise ArgumentError.new('state: expected one of (load|domcontentloaded|networkidle|commit)')
115
115
  end
116
116
  if @load_states.include?(option_state)
117
117
  return
@@ -191,10 +191,6 @@ module Playwright
191
191
  @channel.send_message_to_server('isVisible', params)
192
192
  end
193
193
 
194
- def locator(selector)
195
- LocatorImpl.new(frame: self, timeout_settings: @page.send(:timeout_settings), selector: selector)
196
- end
197
-
198
194
  def dispatch_event(selector, type, eventInit: nil, strict: nil, timeout: nil)
199
195
  params = {
200
196
  selector: selector,
@@ -404,6 +400,14 @@ module Playwright
404
400
  nil
405
401
  end
406
402
 
403
+ def locator(selector)
404
+ LocatorImpl.new(frame: self, timeout_settings: @page.send(:timeout_settings), selector: selector)
405
+ end
406
+
407
+ def frame_locator(selector)
408
+ FrameLocatorImpl.new(frame: self, timeout_settings: @page.send(:timeout_settings), frame_selector: selector)
409
+ end
410
+
407
411
  def focus(selector, strict: nil, timeout: nil)
408
412
  params = { selector: selector, strict: strict, timeout: timeout }.compact
409
413
  @channel.send_message_to_server('focus', params)
@@ -593,7 +597,9 @@ module Playwright
593
597
  end
594
598
 
595
599
  def wait_for_timeout(timeout)
596
- sleep(timeout / 1000.0)
600
+ @channel.send_message_to_server('waitForTimeout', timeout: timeout)
601
+
602
+ nil
597
603
  end
598
604
 
599
605
  def wait_for_function(pageFunction, arg: nil, polling: nil, timeout: nil)
@@ -100,6 +100,11 @@ module Playwright
100
100
 
101
101
  if @routes.none? { |handler_entry| handler_entry.handle(wrapped_route, wrapped_request) }
102
102
  @browser_context.send(:on_route, route, request)
103
+ else
104
+ @routes.reject!(&:expired?)
105
+ if @routes.count == 0
106
+ @channel.async_send_message_to_server('setNetworkInterceptionEnabled', enabled: false)
107
+ end
103
108
  end
104
109
  end
105
110
 
@@ -133,9 +138,6 @@ module Playwright
133
138
 
134
139
  private def on_download(params)
135
140
  artifact = ChannelOwners::Artifact.from(params['artifact'])
136
- if @browser_context.browser.send(:remote?)
137
- artifact.update_as_remote
138
- end
139
141
  download = DownloadImpl.new(
140
142
  page: self,
141
143
  url: params['url'],
@@ -147,9 +149,6 @@ module Playwright
147
149
 
148
150
  private def on_video(params)
149
151
  artifact = ChannelOwners::Artifact.from(params['artifact'])
150
- if @browser_context.browser.send(:remote?)
151
- artifact.update_as_remote
152
- end
153
152
  video.send(:set_artifact, artifact)
154
153
  end
155
154
 
@@ -256,10 +255,6 @@ module Playwright
256
255
  @main_frame.visible?(selector, strict: strict, timeout: timeout)
257
256
  end
258
257
 
259
- def locator(selector)
260
- @main_frame.locator(selector)
261
- end
262
-
263
258
  def dispatch_event(selector, type, eventInit: nil, strict: nil, timeout: nil)
264
259
  @main_frame.dispatch_event(selector, type, eventInit: eventInit, strict: strict, timeout: timeout)
265
260
  end
@@ -563,6 +558,14 @@ module Playwright
563
558
  timeout: timeout)
564
559
  end
565
560
 
561
+ def locator(selector)
562
+ @main_frame.locator(selector)
563
+ end
564
+
565
+ def frame_locator(selector)
566
+ @main_frame.frame_locator(selector)
567
+ end
568
+
566
569
  def focus(selector, strict: nil, timeout: nil)
567
570
  @main_frame.focus(selector, strict: strict, timeout: timeout)
568
571
  end
@@ -920,6 +923,11 @@ module Playwright
920
923
  @workers.delete(worker)
921
924
  end
922
925
 
926
+ # called from Video
927
+ private def remote_connection?
928
+ @connection.remote?
929
+ end
930
+
923
931
  # Expose guid for library developers.
924
932
  # Not intended to be used by users.
925
933
  def guid
@@ -84,39 +84,27 @@ module Playwright
84
84
 
85
85
  # @return [RawHeaders|nil]
86
86
  private def actual_headers
87
- @actual_headers ||= response&.send(:raw_request_headers)
87
+ @actual_headers ||= raw_request_headers
88
+ end
89
+
90
+ private def raw_request_headers
91
+ RawHeaders.new(@channel.send_message_to_server('rawRequestHeaders'))
88
92
  end
89
93
 
90
94
  def all_headers
91
- if actual_headers
92
- actual_headers.headers
93
- else
94
- @provisional_headers.headers
95
- end
95
+ actual_headers.headers
96
96
  end
97
97
 
98
98
  def headers_array
99
- if actual_headers
100
- actual_headers.headers_array
101
- else
102
- @provisional_headers.headers_array
103
- end
99
+ actual_headers.headers_array
104
100
  end
105
101
 
106
102
  def header_value(name)
107
- if actual_headers
108
- actual_headers.get(name)
109
- else
110
- @provisional_headers.get(name)
111
- end
103
+ actual_headers.get(name)
112
104
  end
113
105
 
114
106
  def header_values(name)
115
- if actual_headers
116
- actual_headers.get_all(name)
117
- else
118
- @provisional_headers.get_all(name)
119
- end
107
+ actual_headers.get_all(name)
120
108
  end
121
109
 
122
110
  def sizes
@@ -48,10 +48,6 @@ module Playwright
48
48
  @actual_headers ||= raw_response_headers
49
49
  end
50
50
 
51
- private def raw_request_headers
52
- RawHeaders.new(@channel.send_message_to_server('rawRequestHeaders'))
53
- end
54
-
55
51
  private def raw_response_headers
56
52
  RawHeaders.new(@channel.send_message_to_server('rawResponseHeaders'))
57
53
  end
@@ -21,6 +21,15 @@ module Playwright
21
21
  @waiting_for_object = {} # Hash[ guid => Promise<ChannelOwner> ]
22
22
  @callbacks = {} # Hash [ guid => Promise<ChannelOwner> ]
23
23
  @root_object = RootChannelOwner.new(self)
24
+ @remote = false
25
+ end
26
+
27
+ def mark_as_remote
28
+ @remote = true
29
+ end
30
+
31
+ def remote?
32
+ @remote
24
33
  end
25
34
 
26
35
  def async_run
@@ -0,0 +1,49 @@
1
+ module Playwright
2
+ define_api_implementation :FrameLocatorImpl do
3
+ def initialize(frame:, timeout_settings:, frame_selector:)
4
+ @frame = frame
5
+ @timeout_settings = timeout_settings
6
+ @frame_selector = frame_selector
7
+ end
8
+
9
+ def locator(selector)
10
+ LocatorImpl.new(
11
+ frame: @frame,
12
+ timeout_settings: @timeout_settings,
13
+ selector: "#{@frame_selector} >> control=enter-frame >> #{selector}",
14
+ )
15
+ end
16
+
17
+ def frame_locator(selector)
18
+ FrameLocatorImpl.new(
19
+ frame: @frame,
20
+ timeout_settings: @timeout_settings,
21
+ frame_selector: "#{@frame_selector} >> control=enter-frame >> #{selector}",
22
+ )
23
+ end
24
+
25
+ def first
26
+ FrameLocatorImpl.new(
27
+ frame: @frame,
28
+ timeout_settings: @timeout_settings,
29
+ frame_selector: "#{@frame_selector} >> nth=0",
30
+ )
31
+ end
32
+
33
+ def last
34
+ FrameLocatorImpl.new(
35
+ frame: @frame,
36
+ timeout_settings: @timeout_settings,
37
+ frame_selector: "#{@frame_selector} >> nth=-1",
38
+ )
39
+ end
40
+
41
+ def nth(index)
42
+ FrameLocatorImpl.new(
43
+ frame: @frame,
44
+ timeout_settings: @timeout_settings,
45
+ frame_selector: "#{@frame_selector} >> nth=#{index}",
46
+ )
47
+ end
48
+ end
49
+ end
@@ -11,17 +11,17 @@ module Playwright
11
11
  end
12
12
 
13
13
  private def with_element(timeout: nil, &block)
14
+ timeout_or_default = @timeout_settings.timeout(timeout)
14
15
  start_time = Time.now
15
16
 
16
- handle = @frame.wait_for_selector(@selector, strict: true, state: 'attached', timeout: timeout)
17
+ handle = @frame.wait_for_selector(@selector, strict: true, state: 'attached', timeout: timeout_or_default)
17
18
  unless handle
18
19
  raise "Could not resolve #{@selector} to DOM Element"
19
20
  end
20
21
 
21
- call_options = {}
22
- if timeout
23
- call_options[:timeout] = (timeout - (Time.now - start_time) * 1000).to_i
24
- end
22
+ call_options = {
23
+ timeout: (timeout_or_default - (Time.now - start_time) * 1000).to_i,
24
+ }
25
25
 
26
26
  begin
27
27
  block.call(handle, call_options)
@@ -130,6 +130,14 @@ module Playwright
130
130
  )
131
131
  end
132
132
 
133
+ def frame_locator(selector)
134
+ FrameLocatorImpl.new(
135
+ frame: @frame,
136
+ timeout_settings: @timeout_settings,
137
+ frame_selector: "#{@selector} >> #{selector}",
138
+ )
139
+ end
140
+
133
141
  def element_handle(timeout: nil)
134
142
  @frame.wait_for_selector(@selector, strict: true, state: 'attached', timeout: timeout)
135
143
  end
@@ -303,6 +311,10 @@ module Playwright
303
311
  trial: trial)
304
312
  end
305
313
 
314
+ def wait_for(state: nil, timeout: nil)
315
+ @frame.wait_for_selector(@selector, strict: true, state: state, timeout: timeout)
316
+ end
317
+
306
318
  def set_checked(checked, **options)
307
319
  if checked
308
320
  check(**options)
@@ -6,17 +6,25 @@ module Playwright
6
6
  end
7
7
 
8
8
  def handle
9
- return false if @count <= 0
9
+ return false if expired?
10
10
 
11
11
  @count = @count - 1
12
12
  true
13
13
  end
14
+
15
+ def expired?
16
+ @count <= 0
17
+ end
14
18
  end
15
19
 
16
20
  class StubCounter
17
21
  def handle
18
22
  true
19
23
  end
24
+
25
+ def expired?
26
+ false
27
+ end
20
28
  end
21
29
 
22
30
  # @param url [String]
@@ -46,6 +54,10 @@ module Playwright
46
54
  end
47
55
  end
48
56
 
57
+ def expired?
58
+ @counter.expired?
59
+ end
60
+
49
61
  def same_value?(url:, handler: nil)
50
62
  if handler
51
63
  @url_value == url && @handler == handler
@@ -5,18 +5,18 @@ module Playwright
5
5
  @context = context
6
6
  end
7
7
 
8
- def start(name: nil, screenshots: nil, snapshots: nil)
8
+ def start(name: nil, title: nil, screenshots: nil, snapshots: nil)
9
9
  params = {
10
10
  name: name,
11
11
  screenshots: screenshots,
12
12
  snapshots: snapshots,
13
13
  }.compact
14
14
  @channel.send_message_to_server('tracingStart', params)
15
- @channel.send_message_to_server('tracingStartChunk')
15
+ @channel.send_message_to_server('tracingStartChunk', { title: title }.compact)
16
16
  end
17
17
 
18
- def start_chunk
19
- @channel.send_message_to_server('tracingStartChunk')
18
+ def start_chunk(title: nil)
19
+ @channel.send_message_to_server('tracingStartChunk', { title: title }.compact)
20
20
  end
21
21
 
22
22
  def stop_chunk(path: nil)
@@ -29,13 +29,10 @@ module Playwright
29
29
  end
30
30
 
31
31
  private def do_stop_chunk(path:)
32
- resp = @channel.send_message_to_server('tracingStopChunk', save: !path.nil?)
33
- artifact = ChannelOwners::Artifact.from_nullable(resp)
32
+ result = @channel.send_message_to_server_result('tracingStopChunk', save: !path.nil?, skipCompress: false)
33
+ artifact = ChannelOwners::Artifact.from_nullable(result['artifact'])
34
34
  return unless artifact
35
35
 
36
- if @context.browser.send(:remote?)
37
- artifact.update_as_remote
38
- end
39
36
  artifact.save_as(path)
40
37
  artifact.delete
41
38
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Playwright
4
- VERSION = '1.15.1'
5
- COMPATIBLE_PLAYWRIGHT_VERSION = '1.15.2'
4
+ VERSION = '1.17.beta1'
5
+ COMPATIBLE_PLAYWRIGHT_VERSION = '1.17.0'
6
6
  end
@@ -22,6 +22,9 @@ module Playwright
22
22
  end
23
23
 
24
24
  def path
25
+ if @page.send(:remote_connection?)
26
+ raise 'Path is not available when using browserType.connect(). Use save_as() to save a local copy.'
27
+ end
25
28
  wait_for_artifact_and do |artifact|
26
29
  artifact.absolute_path
27
30
  end
data/lib/playwright.rb CHANGED
@@ -135,13 +135,14 @@ module Playwright
135
135
 
136
136
  transport = WebSocketTransport.new(ws_endpoint: ws_endpoint)
137
137
  connection = Connection.new(transport)
138
+ connection.mark_as_remote
138
139
  connection.async_run
139
140
 
140
141
  execution =
141
142
  begin
142
143
  playwright = connection.initialize_playwright
143
144
  browser = playwright.send(:pre_launched_browser)
144
- browser.send(:update_as_remote)
145
+ browser.should_close_connection_on_close!
145
146
  Execution.new(connection, PlaywrightApi.wrap(playwright), PlaywrightApi.wrap(browser))
146
147
  rescue
147
148
  connection.stop
@@ -0,0 +1,149 @@
1
+ module Playwright
2
+ # This API is used for the Web API testing. You can use it to trigger API endpoints, configure micro-services, prepare
3
+ # environment or the service to your e2e test. When used on `Page` or a `BrowserContext`, this API will automatically use
4
+ # the cookies from the corresponding `BrowserContext`. This means that if you log in using this API, your e2e test will be
5
+ # logged in and vice versa.
6
+ class APIRequestContext < PlaywrightApi
7
+
8
+ # Sends HTTP(S) [DELETE](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/DELETE) request and returns its
9
+ # response. The method will populate request cookies from the context and update context cookies from the response. The
10
+ # method will automatically follow redirects.
11
+ def delete(
12
+ url,
13
+ data: nil,
14
+ failOnStatusCode: nil,
15
+ form: nil,
16
+ headers: nil,
17
+ ignoreHTTPSErrors: nil,
18
+ multipart: nil,
19
+ params: nil,
20
+ timeout: nil)
21
+ raise NotImplementedError.new('delete is not implemented yet.')
22
+ end
23
+
24
+ # All responses returned by [`method: APIRequestContext.get`] and similar methods are stored in the memory, so that you
25
+ # can later call [`method: APIResponse.body`]. This method discards all stored responses, and makes
26
+ # [`method: APIResponse.body`] throw "Response disposed" error.
27
+ def dispose
28
+ raise NotImplementedError.new('dispose is not implemented yet.')
29
+ end
30
+
31
+ # Sends HTTP(S) request and returns its response. The method will populate request cookies from the context and update
32
+ # context cookies from the response. The method will automatically follow redirects.
33
+ def fetch(
34
+ urlOrRequest,
35
+ data: nil,
36
+ failOnStatusCode: nil,
37
+ form: nil,
38
+ headers: nil,
39
+ ignoreHTTPSErrors: nil,
40
+ method: nil,
41
+ multipart: nil,
42
+ params: nil,
43
+ timeout: nil)
44
+ raise NotImplementedError.new('fetch is not implemented yet.')
45
+ end
46
+
47
+ # Sends HTTP(S) [GET](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GET) request and returns its response. The
48
+ # method will populate request cookies from the context and update context cookies from the response. The method will
49
+ # automatically follow redirects.
50
+ def get(
51
+ url,
52
+ failOnStatusCode: nil,
53
+ headers: nil,
54
+ ignoreHTTPSErrors: nil,
55
+ params: nil,
56
+ timeout: nil)
57
+ raise NotImplementedError.new('get is not implemented yet.')
58
+ end
59
+
60
+ # Sends HTTP(S) [HEAD](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD) request and returns its response.
61
+ # The method will populate request cookies from the context and update context cookies from the response. The method will
62
+ # automatically follow redirects.
63
+ def head(
64
+ url,
65
+ failOnStatusCode: nil,
66
+ headers: nil,
67
+ ignoreHTTPSErrors: nil,
68
+ params: nil,
69
+ timeout: nil)
70
+ raise NotImplementedError.new('head is not implemented yet.')
71
+ end
72
+
73
+ # Sends HTTP(S) [PATCH](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PATCH) request and returns its response.
74
+ # The method will populate request cookies from the context and update context cookies from the response. The method will
75
+ # automatically follow redirects.
76
+ def patch(
77
+ url,
78
+ data: nil,
79
+ failOnStatusCode: nil,
80
+ form: nil,
81
+ headers: nil,
82
+ ignoreHTTPSErrors: nil,
83
+ multipart: nil,
84
+ params: nil,
85
+ timeout: nil)
86
+ raise NotImplementedError.new('patch is not implemented yet.')
87
+ end
88
+
89
+ # Sends HTTP(S) [POST](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST) request and returns its response.
90
+ # The method will populate request cookies from the context and update context cookies from the response. The method will
91
+ # automatically follow redirects.
92
+ def post(
93
+ url,
94
+ data: nil,
95
+ failOnStatusCode: nil,
96
+ form: nil,
97
+ headers: nil,
98
+ ignoreHTTPSErrors: nil,
99
+ multipart: nil,
100
+ params: nil,
101
+ timeout: nil)
102
+ raise NotImplementedError.new('post is not implemented yet.')
103
+ end
104
+
105
+ # Sends HTTP(S) [PUT](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PUT) request and returns its response. The
106
+ # method will populate request cookies from the context and update context cookies from the response. The method will
107
+ # automatically follow redirects.
108
+ def put(
109
+ url,
110
+ data: nil,
111
+ failOnStatusCode: nil,
112
+ form: nil,
113
+ headers: nil,
114
+ ignoreHTTPSErrors: nil,
115
+ multipart: nil,
116
+ params: nil,
117
+ timeout: nil)
118
+ raise NotImplementedError.new('put is not implemented yet.')
119
+ end
120
+
121
+ # Returns storage state for this request context, contains current cookies and local storage snapshot if it was passed to
122
+ # the constructor.
123
+ def storage_state(path: nil)
124
+ raise NotImplementedError.new('storage_state is not implemented yet.')
125
+ end
126
+
127
+ # -- inherited from EventEmitter --
128
+ # @nodoc
129
+ def off(event, callback)
130
+ event_emitter_proxy.off(event, callback)
131
+ end
132
+
133
+ # -- inherited from EventEmitter --
134
+ # @nodoc
135
+ def once(event, callback)
136
+ event_emitter_proxy.once(event, callback)
137
+ end
138
+
139
+ # -- inherited from EventEmitter --
140
+ # @nodoc
141
+ def on(event, callback)
142
+ event_emitter_proxy.on(event, callback)
143
+ end
144
+
145
+ private def event_emitter_proxy
146
+ @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
147
+ end
148
+ end
149
+ end