playwright-ruby-client 1.18.1 → 1.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/documentation/docs/api/api_request_context.md +11 -1
  3. data/documentation/docs/api/frame.md +1 -1
  4. data/documentation/docs/api/frame_locator.md +1 -1
  5. data/documentation/docs/api/locator.md +10 -2
  6. data/documentation/docs/api/page.md +5 -1
  7. data/documentation/docs/api/route.md +1 -0
  8. data/documentation/docs/api/tracing.md +6 -1
  9. data/documentation/docs/include/api_coverage.md +1 -0
  10. data/lib/playwright/api_response_impl.rb +4 -0
  11. data/lib/playwright/channel_owner.rb +4 -0
  12. data/lib/playwright/channel_owners/api_request_context.rb +4 -0
  13. data/lib/playwright/channel_owners/browser_context.rb +10 -9
  14. data/lib/playwright/channel_owners/frame.rb +2 -2
  15. data/lib/playwright/channel_owners/page.rb +11 -5
  16. data/lib/playwright/channel_owners/route.rb +18 -4
  17. data/lib/playwright/{tracing_impl.rb → channel_owners/tracing.rb} +4 -8
  18. data/lib/playwright/frame_locator_impl.rb +2 -1
  19. data/lib/playwright/locator_impl.rb +42 -15
  20. data/lib/playwright/route_handler.rb +11 -8
  21. data/lib/playwright/transport.rb +14 -1
  22. data/lib/playwright/version.rb +2 -2
  23. data/lib/playwright_api/android.rb +6 -6
  24. data/lib/playwright_api/android_device.rb +6 -6
  25. data/lib/playwright_api/api_request_context.rb +8 -8
  26. data/lib/playwright_api/browser.rb +6 -6
  27. data/lib/playwright_api/browser_context.rb +6 -6
  28. data/lib/playwright_api/browser_type.rb +6 -6
  29. data/lib/playwright_api/cdp_session.rb +6 -6
  30. data/lib/playwright_api/console_message.rb +6 -6
  31. data/lib/playwright_api/dialog.rb +6 -6
  32. data/lib/playwright_api/element_handle.rb +6 -6
  33. data/lib/playwright_api/frame.rb +8 -8
  34. data/lib/playwright_api/frame_locator.rb +2 -2
  35. data/lib/playwright_api/js_handle.rb +6 -6
  36. data/lib/playwright_api/locator.rb +8 -3
  37. data/lib/playwright_api/page.rb +14 -14
  38. data/lib/playwright_api/playwright.rb +6 -6
  39. data/lib/playwright_api/request.rb +6 -6
  40. data/lib/playwright_api/response.rb +6 -6
  41. data/lib/playwright_api/route.rb +8 -7
  42. data/lib/playwright_api/selectors.rb +6 -6
  43. data/lib/playwright_api/tracing.rb +29 -2
  44. data/lib/playwright_api/web_socket.rb +6 -6
  45. data/lib/playwright_api/worker.rb +8 -8
  46. metadata +5 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4743c153d270bd3343d7f59b53e1ef03ebecf65495804c79ef4561e5db1263ac
4
- data.tar.gz: 2f5db2b025b62ebece498cce6edc8f02f85a07377dee2945fbbcfb60e6718c48
3
+ metadata.gz: 68d737d7d01fd92889e417be20bca72ee6247258d07dc8b18f44a1b07967a2c1
4
+ data.tar.gz: 18522777dc4ef3e19a9be4a17710cfdef404fc441dcf2a5a28b82138175dfebd
5
5
  SHA512:
6
- metadata.gz: 36f2d941a86f2533ad494013346f68a3840e33065bf1d3021ff071f6caec635e890378eb7a88df3d096ffa85a86b037e93dae68535c0d30baacc699cb62292a5
7
- data.tar.gz: 38757489faccca207351dfc8ff1d5519ee7fe329726a0024fe80fe83eb772abed986dbfcde5ad0b1cd5987a5b79666a4675cb360bb3333b1b29e4065087b2b75
6
+ metadata.gz: bf0887d285eabec5cf17b380d99e566f1b1399e089614adf23d99a38f0975e5f1b9fb6eb8891d67857b21945b5ad00772202caf337aeac53439407f20f5386f9
7
+ data.tar.gz: 95553f620063bbd52ded34d1f260a920fd82ba127868f1c85c43ac0b466ed9e93a1fce5d6319805e8f13ade1f3ad3c0aa03795be4387b3354664e26c2c1f4e00
@@ -28,7 +28,17 @@ playwright.chromium.launch do |browser|
28
28
  data: { name: 'test-repo-1' },
29
29
  )
30
30
  response.ok? # => true
31
- response.json['name'] # => "tes≈-repo-1"
31
+ response.json['name'] # => "test-repo-1"
32
+
33
+ # Delete a repository.
34
+ response = api_request_context.delete(
35
+ "/repos/YourName/test-repo-1",
36
+ headers: {
37
+ "Accept": "application/vnd.github.v3+json",
38
+ "Authorization": "Bearer #{API_TOKEN}",
39
+ },
40
+ )
41
+ response.ok? # => true
32
42
  end
33
43
  ```
34
44
 
@@ -549,7 +549,7 @@ considered not visible.
549
549
  ## locator
550
550
 
551
551
  ```
552
- def locator(selector, hasText: nil)
552
+ def locator(selector, has: nil, hasText: nil)
553
553
  ```
554
554
 
555
555
  The method returns an element locator that can be used to perform actions in the frame. Locator is resolved to the
@@ -65,7 +65,7 @@ Returns locator to the last matching frame.
65
65
  ## locator
66
66
 
67
67
  ```
68
- def locator(selector, hasText: nil)
68
+ def locator(selector, has: nil, hasText: nil)
69
69
  ```
70
70
 
71
71
  The method finds an element matching the specified selector in the FrameLocator's subtree.
@@ -311,7 +311,7 @@ When working with iframes, you can create a frame locator that will enter the if
311
311
  that iframe:
312
312
 
313
313
  ```ruby
314
- locator = page.frame_locator("text=Submit").locator("text=Submit")
314
+ locator = page.frame_locator("iframe").locator("text=Submit")
315
315
  locator.click
316
316
  ```
317
317
 
@@ -430,7 +430,7 @@ Returns locator to the last matching element.
430
430
  ## locator
431
431
 
432
432
  ```
433
- def locator(selector, hasText: nil)
433
+ def locator(selector, has: nil, hasText: nil)
434
434
  ```
435
435
 
436
436
  The method finds an element matching the specified selector in the [Locator](./locator)'s subtree.
@@ -443,6 +443,14 @@ def nth(index)
443
443
 
444
444
  Returns locator to the n-th matching element.
445
445
 
446
+ ## page
447
+
448
+ ```
449
+ def page
450
+ ```
451
+
452
+ A page this locator belongs to.
453
+
446
454
  ## press
447
455
 
448
456
  ```
@@ -774,7 +774,7 @@ considered not visible.
774
774
  ## locator
775
775
 
776
776
  ```
777
- def locator(selector, hasText: nil)
777
+ def locator(selector, has: nil, hasText: nil)
778
778
  ```
779
779
 
780
780
  The method returns an element locator that can be used to perform actions on the page. Locator is resolved to the
@@ -1491,6 +1491,9 @@ response = page.expect_response(/example.com\/resource/) do
1491
1491
  page.click("input")
1492
1492
  end
1493
1493
  puts response.body
1494
+ puts response.ok?
1495
+
1496
+ page.wait_for_load_state # wait for request finished.
1494
1497
 
1495
1498
  # or with a predicate
1496
1499
  page.content = '<form action="https://example.com/resource"><input type="submit" /></form>'
@@ -1498,6 +1501,7 @@ response = page.expect_response(->(res) { res.url.start_with? 'https://example.c
1498
1501
  page.click("input")
1499
1502
  end
1500
1503
  puts response.body
1504
+ puts response.ok?
1501
1505
  ```
1502
1506
 
1503
1507
 
@@ -45,6 +45,7 @@ def fulfill(
45
45
  contentType: nil,
46
46
  headers: nil,
47
47
  path: nil,
48
+ response: nil,
48
49
  status: nil)
49
50
  ```
50
51
 
@@ -23,7 +23,12 @@ end
23
23
  ## start
24
24
 
25
25
  ```
26
- def start(name: nil, screenshots: nil, snapshots: nil, title: nil)
26
+ def start(
27
+ name: nil,
28
+ screenshots: nil,
29
+ snapshots: nil,
30
+ sources: nil,
31
+ title: nil)
27
32
  ```
28
33
 
29
34
  Start tracing.
@@ -430,6 +430,7 @@
430
430
  * last
431
431
  * locator
432
432
  * nth
433
+ * page
433
434
  * press
434
435
  * screenshot
435
436
  * scroll_into_view_if_needed
@@ -66,6 +66,10 @@ module Playwright
66
66
  @request.channel.send_message_to_server("disposeAPIResponse", fetchUid: fetch_uid)
67
67
  end
68
68
 
69
+ private def _request
70
+ @request
71
+ end
72
+
69
73
  private def fetch_uid
70
74
  @initializer['fetchUid']
71
75
  end
@@ -72,6 +72,10 @@ module Playwright
72
72
  private def delete_object_from_child(guid)
73
73
  @objects.delete(guid)
74
74
  end
75
+
76
+ private def same_connection?(other)
77
+ @connection == other.instance_variable_get(:@connection)
78
+ end
75
79
  end
76
80
 
77
81
  class RootChannelOwner < ChannelOwner
@@ -2,6 +2,10 @@ require 'base64'
2
2
 
3
3
  module Playwright
4
4
  define_channel_owner :APIRequestContext do
5
+ private def after_initialize
6
+ @tracing = ChannelOwners::Tracing.from(@initializer['tracing'])
7
+ end
8
+
5
9
  def dispose
6
10
  @channel.send_message_to_server('dispose')
7
11
  end
@@ -14,7 +14,7 @@ module Playwright
14
14
  @service_workers = Set.new
15
15
  @background_pages = Set.new
16
16
 
17
- @tracing = TracingImpl.new(@channel, self)
17
+ @tracing = ChannelOwners::Tracing.from(@initializer['tracing'])
18
18
  @request = ChannelOwners::APIRequestContext.from(@initializer['APIRequestContext'])
19
19
 
20
20
  @channel.on('bindingCall', ->(params) { on_binding(ChannelOwners::BindingCall.from(params['binding'])) })
@@ -72,13 +72,19 @@ module Playwright
72
72
  wrapped_route = PlaywrightApi.wrap(route)
73
73
  wrapped_request = PlaywrightApi.wrap(request)
74
74
 
75
- if @routes.none? { |handler_entry| handler_entry.handle(wrapped_route, wrapped_request) }
76
- route.continue
77
- else
75
+ handler_entry = @routes.find do |entry|
76
+ entry.match?(request.url)
77
+ end
78
+
79
+ if handler_entry
80
+ handler_entry.async_handle(wrapped_route, wrapped_request)
81
+
78
82
  @routes.reject!(&:expired?)
79
83
  if @routes.count == 0
80
84
  @channel.async_send_message_to_server('setNetworkInterceptionEnabled', enabled: false)
81
85
  end
86
+ else
87
+ route.continue
82
88
  end
83
89
  end
84
90
 
@@ -360,10 +366,5 @@ module Playwright
360
366
  private def base_url
361
367
  @options[:baseURL]
362
368
  end
363
-
364
- # called from Tracing
365
- private def remote_connection?
366
- @connection.remote?
367
- end
368
369
  end
369
370
  end
@@ -400,8 +400,8 @@ module Playwright
400
400
  nil
401
401
  end
402
402
 
403
- def locator(selector, hasText: nil)
404
- LocatorImpl.new(frame: self, timeout_settings: @page.send(:timeout_settings), selector: selector, hasText: hasText)
403
+ def locator(selector, hasText: nil, has: nil)
404
+ LocatorImpl.new(frame: self, timeout_settings: @page.send(:timeout_settings), selector: selector, hasText: hasText, has: has)
405
405
  end
406
406
 
407
407
  def frame_locator(selector)
@@ -98,13 +98,19 @@ module Playwright
98
98
  wrapped_route = PlaywrightApi.wrap(route)
99
99
  wrapped_request = PlaywrightApi.wrap(request)
100
100
 
101
- if @routes.none? { |handler_entry| handler_entry.handle(wrapped_route, wrapped_request) }
102
- @browser_context.send(:on_route, route, request)
103
- else
101
+ handler_entry = @routes.find do |entry|
102
+ entry.match?(request.url)
103
+ end
104
+
105
+ if handler_entry
106
+ handler_entry.async_handle(wrapped_route, wrapped_request)
107
+
104
108
  @routes.reject!(&:expired?)
105
109
  if @routes.count == 0
106
110
  @channel.async_send_message_to_server('setNetworkInterceptionEnabled', enabled: false)
107
111
  end
112
+ else
113
+ @browser_context.send(:on_route, route, request)
108
114
  end
109
115
  end
110
116
 
@@ -558,8 +564,8 @@ module Playwright
558
564
  timeout: timeout)
559
565
  end
560
566
 
561
- def locator(selector, hasText: nil)
562
- @main_frame.locator(selector, hasText: hasText)
567
+ def locator(selector, hasText: nil, has: nil)
568
+ @main_frame.locator(selector, hasText: hasText, has: has)
563
569
  end
564
570
 
565
571
  def frame_locator(selector)
@@ -17,16 +17,30 @@ module Playwright
17
17
  contentType: nil,
18
18
  headers: nil,
19
19
  path: nil,
20
- status: nil)
20
+ status: nil,
21
+ response: nil)
21
22
  params = {
22
23
  contentType: contentType,
23
24
  status: status,
24
25
  }.compact
26
+ option_body = body
27
+
28
+ if response
29
+ params[:status] ||= response.status
30
+ params[:headers] ||= response.headers
31
+
32
+ if !body && !path && response.is_a?(APIResponse)
33
+ if response.send(:_request).send(:same_connection?, self)
34
+ params[:fetchResponseUid] = response.send(:fetch_uid)
35
+ else
36
+ option_body = response.body
37
+ end
38
+ end
39
+ end
25
40
 
26
- length = 0
27
41
  content =
28
- if body
29
- body
42
+ if option_body
43
+ option_body
30
44
  elsif path
31
45
  File.read(path)
32
46
  else
@@ -1,15 +1,11 @@
1
1
  module Playwright
2
- define_api_implementation :TracingImpl do
3
- def initialize(channel, context)
4
- @channel = channel
5
- @context = context
6
- end
7
-
8
- def start(name: nil, title: nil, screenshots: nil, snapshots: nil)
2
+ define_channel_owner :Tracing do
3
+ def start(name: nil, title: nil, screenshots: nil, snapshots: nil, sources: nil)
9
4
  params = {
10
5
  name: name,
11
6
  screenshots: screenshots,
12
7
  snapshots: snapshots,
8
+ sources: sources,
13
9
  }.compact
14
10
  @channel.send_message_to_server('tracingStart', params)
15
11
  @channel.send_message_to_server('tracingStartChunk', { title: title }.compact)
@@ -31,7 +27,7 @@ module Playwright
31
27
  private def do_stop_chunk(file_path:)
32
28
  mode = 'doNotSave'
33
29
  if file_path
34
- if @context.send(:remote_connection?)
30
+ if @connection.remote?
35
31
  mode = 'compressTrace'
36
32
  else
37
33
  mode = 'compressTraceAndSources'
@@ -6,12 +6,13 @@ module Playwright
6
6
  @frame_selector = frame_selector
7
7
  end
8
8
 
9
- def locator(selector, hasText: nil)
9
+ def locator(selector, hasText: nil, has: nil)
10
10
  LocatorImpl.new(
11
11
  frame: @frame,
12
12
  timeout_settings: @timeout_settings,
13
13
  selector: "#{@frame_selector} >> control=enter-frame >> #{selector}",
14
14
  hasText: hasText,
15
+ has: has,
15
16
  )
16
17
  end
17
18
 
@@ -24,29 +24,51 @@ module Playwright
24
24
  end
25
25
 
26
26
  define_api_implementation :LocatorImpl do
27
- def initialize(frame:, timeout_settings:, selector:, hasText: nil)
27
+ def initialize(frame:, timeout_settings:, selector:, hasText: nil, has: nil)
28
28
  @frame = frame
29
29
  @timeout_settings = timeout_settings
30
- @selector =
31
- case hasText
32
- when Regexp
33
- source = EscapeWithQuotes.new(hasText.source, '"')
34
- flags = []
35
- flags << 'ms' if (hasText.options & Regexp::MULTILINE) != 0
36
- flags << 'i' if (hasText.options & Regexp::IGNORECASE) != 0
37
- "#{selector} >> :scope:text-matches(#{source}, \"#{flags.join('')}\")"
38
- when String
39
- text = EscapeWithQuotes.new(hasText, '"')
40
- "#{selector} >> :scope:has-text(#{text})"
41
- else
42
- selector
30
+ selector_scopes = [selector]
31
+
32
+ case hasText
33
+ when Regexp
34
+ source = EscapeWithQuotes.new(hasText.source, '"')
35
+ flags = []
36
+ flags << 'ms' if (hasText.options & Regexp::MULTILINE) != 0
37
+ flags << 'i' if (hasText.options & Regexp::IGNORECASE) != 0
38
+ selector_scopes << ":scope:text-matches(#{source}, \"#{flags.join('')}\")"
39
+ when String
40
+ text = EscapeWithQuotes.new(hasText, '"')
41
+ selector_scopes << ":scope:has-text(#{text})"
42
+ end
43
+
44
+ if has
45
+ unless same_frame?(has)
46
+ raise DifferentFrameError.new
43
47
  end
48
+ selector_scopes << "has=#{has.send(:selector_json)}"
49
+ end
50
+
51
+ @selector = selector_scopes.join(' >> ')
44
52
  end
45
53
 
46
54
  def to_s
47
55
  "Locator@#{@selector}"
48
56
  end
49
57
 
58
+ class DifferentFrameError < StandardError
59
+ def initialize
60
+ super('Inner "has" locator must belong to the same frame.')
61
+ end
62
+ end
63
+
64
+ private def same_frame?(other)
65
+ @frame == other.instance_variable_get(:@frame)
66
+ end
67
+
68
+ private def selector_json
69
+ @selector.to_json
70
+ end
71
+
50
72
  private def with_element(timeout: nil, &block)
51
73
  timeout_or_default = @timeout_settings.timeout(timeout)
52
74
  start_time = Time.now
@@ -67,6 +89,10 @@ module Playwright
67
89
  end
68
90
  end
69
91
 
92
+ def page
93
+ @frame.page
94
+ end
95
+
70
96
  def bounding_box(timeout: nil)
71
97
  with_element(timeout: timeout) do |handle|
72
98
  handle.bounding_box
@@ -180,12 +206,13 @@ module Playwright
180
206
  @frame.fill(@selector, value, strict: true, force: force, noWaitAfter: noWaitAfter, timeout: timeout)
181
207
  end
182
208
 
183
- def locator(selector, hasText: nil)
209
+ def locator(selector, hasText: nil, has: nil)
184
210
  LocatorImpl.new(
185
211
  frame: @frame,
186
212
  timeout_settings: @timeout_settings,
187
213
  selector: "#{@selector} >> #{selector}",
188
214
  hasText: hasText,
215
+ has: has,
189
216
  )
190
217
  end
191
218
 
@@ -5,7 +5,7 @@ module Playwright
5
5
  @count = count
6
6
  end
7
7
 
8
- def handle
8
+ def increment
9
9
  return false if expired?
10
10
 
11
11
  @count = @count - 1
@@ -18,7 +18,7 @@ module Playwright
18
18
  end
19
19
 
20
20
  class StubCounter
21
- def handle
21
+ def increment
22
22
  true
23
23
  end
24
24
 
@@ -43,14 +43,17 @@ module Playwright
43
43
  end
44
44
  end
45
45
 
46
- def handle(route, request)
47
- return false unless @counter.handle
46
+ def match?(url)
47
+ @url_matcher.match?(url)
48
+ end
49
+
50
+ def async_handle(route, request)
51
+ @counter.increment
48
52
 
49
- if @url_matcher.match?(request.url)
53
+ Concurrent::Promises.future do
50
54
  @handler.call(route, request)
51
- true
52
- else
53
- false
55
+ rescue => err
56
+ puts err, err.backtrace
54
57
  end
55
58
  end
56
59
 
@@ -46,7 +46,8 @@ module Playwright
46
46
  #
47
47
  # @note This method blocks until playwright-cli exited. Consider using Thread or Future.
48
48
  def async_run
49
- @stdin, @stdout, @stderr, @thread = Open3.popen3("#{@driver_executable_path} run-driver")
49
+ popen3_args = {}
50
+ @stdin, @stdout, @stderr, @thread = run_driver_with_open3
50
51
  @stdin.binmode # Ensure Strings are written 1:1 without encoding conversion, necessary for integer values
51
52
 
52
53
  Thread.new { handle_stdout }
@@ -55,6 +56,18 @@ module Playwright
55
56
 
56
57
  private
57
58
 
59
+ def run_driver_with_open3
60
+ Open3.popen3("#{@driver_executable_path} run-driver", { pgroup: true })
61
+ rescue ArgumentError => err
62
+ # Windows doesn't accept pgroup parameter.
63
+ # ArgumentError: wrong exec option symbol: pgroup
64
+ if err.message =~ /pgroup/
65
+ Open3.popen3("#{@driver_executable_path} run-driver")
66
+ else
67
+ raise
68
+ end
69
+ end
70
+
58
71
  def handle_stdout(packet_size: 32_768)
59
72
  while chunk = @stdout.read(4)
60
73
  length = chunk.unpack1('V') # unsigned 32bit, little endian
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Playwright
4
- VERSION = '1.18.1'
5
- COMPATIBLE_PLAYWRIGHT_VERSION = '1.18.1'
4
+ VERSION = '1.19.1'
5
+ COMPATIBLE_PLAYWRIGHT_VERSION = '1.19.2'
6
6
  end
@@ -38,20 +38,20 @@ module Playwright
38
38
 
39
39
  # -- inherited from EventEmitter --
40
40
  # @nodoc
41
- def once(event, callback)
42
- event_emitter_proxy.once(event, callback)
41
+ def off(event, callback)
42
+ event_emitter_proxy.off(event, callback)
43
43
  end
44
44
 
45
45
  # -- inherited from EventEmitter --
46
46
  # @nodoc
47
- def on(event, callback)
48
- event_emitter_proxy.on(event, callback)
47
+ def once(event, callback)
48
+ event_emitter_proxy.once(event, callback)
49
49
  end
50
50
 
51
51
  # -- inherited from EventEmitter --
52
52
  # @nodoc
53
- def off(event, callback)
54
- event_emitter_proxy.off(event, callback)
53
+ def on(event, callback)
54
+ event_emitter_proxy.on(event, callback)
55
55
  end
56
56
 
57
57
  private def event_emitter_proxy
@@ -176,20 +176,20 @@ module Playwright
176
176
 
177
177
  # -- inherited from EventEmitter --
178
178
  # @nodoc
179
- def once(event, callback)
180
- event_emitter_proxy.once(event, callback)
179
+ def off(event, callback)
180
+ event_emitter_proxy.off(event, callback)
181
181
  end
182
182
 
183
183
  # -- inherited from EventEmitter --
184
184
  # @nodoc
185
- def on(event, callback)
186
- event_emitter_proxy.on(event, callback)
185
+ def once(event, callback)
186
+ event_emitter_proxy.once(event, callback)
187
187
  end
188
188
 
189
189
  # -- inherited from EventEmitter --
190
190
  # @nodoc
191
- def off(event, callback)
192
- event_emitter_proxy.off(event, callback)
191
+ def on(event, callback)
192
+ event_emitter_proxy.on(event, callback)
193
193
  end
194
194
 
195
195
  private def event_emitter_proxy
@@ -16,13 +16,13 @@ module Playwright
16
16
  # # This will launch a new browser, create a context and page. When making HTTP
17
17
  # # requests with the internal APIRequestContext (e.g. `context.request` or `page.request`)
18
18
  # # it will automatically set the cookies to the browser page and vise versa.
19
- # browser = playwright.chromium.launch()
19
+ # browser = p.chromium.launch()
20
20
  # context = browser.new_context(base_url="https://api.github.com")
21
21
  # api_request_context = context.request
22
22
  # page = context.new_page()
23
23
  #
24
24
  # # Alternatively you can create a APIRequestContext manually without having a browser context attached:
25
- # # api_request_context = playwright.request.new_context(base_url="https://api.github.com")
25
+ # # api_request_context = p.request.new_context(base_url="https://api.github.com")
26
26
  #
27
27
  #
28
28
  # # Create a repository.
@@ -173,20 +173,20 @@ module Playwright
173
173
 
174
174
  # -- inherited from EventEmitter --
175
175
  # @nodoc
176
- def once(event, callback)
177
- event_emitter_proxy.once(event, callback)
176
+ def off(event, callback)
177
+ event_emitter_proxy.off(event, callback)
178
178
  end
179
179
 
180
180
  # -- inherited from EventEmitter --
181
181
  # @nodoc
182
- def on(event, callback)
183
- event_emitter_proxy.on(event, callback)
182
+ def once(event, callback)
183
+ event_emitter_proxy.once(event, callback)
184
184
  end
185
185
 
186
186
  # -- inherited from EventEmitter --
187
187
  # @nodoc
188
- def off(event, callback)
189
- event_emitter_proxy.off(event, callback)
188
+ def on(event, callback)
189
+ event_emitter_proxy.on(event, callback)
190
190
  end
191
191
 
192
192
  private def event_emitter_proxy
@@ -168,20 +168,20 @@ module Playwright
168
168
 
169
169
  # -- inherited from EventEmitter --
170
170
  # @nodoc
171
- def once(event, callback)
172
- event_emitter_proxy.once(event, callback)
171
+ def off(event, callback)
172
+ event_emitter_proxy.off(event, callback)
173
173
  end
174
174
 
175
175
  # -- inherited from EventEmitter --
176
176
  # @nodoc
177
- def on(event, callback)
178
- event_emitter_proxy.on(event, callback)
177
+ def once(event, callback)
178
+ event_emitter_proxy.once(event, callback)
179
179
  end
180
180
 
181
181
  # -- inherited from EventEmitter --
182
182
  # @nodoc
183
- def off(event, callback)
184
- event_emitter_proxy.off(event, callback)
183
+ def on(event, callback)
184
+ event_emitter_proxy.on(event, callback)
185
185
  end
186
186
 
187
187
  private def event_emitter_proxy