playwright-ruby-client 1.42.1 → 1.43.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/documentation/docs/api/browser_context.md +22 -10
  4. data/documentation/docs/api/frame_locator.md +26 -4
  5. data/documentation/docs/api/locator.md +22 -0
  6. data/documentation/docs/api/page.md +10 -8
  7. data/documentation/docs/article/guides/download_playwright_driver.md +7 -10
  8. data/documentation/docs/article/guides/playwright_on_alpine_linux.md +3 -1
  9. data/documentation/docs/include/api_coverage.md +2 -0
  10. data/lib/playwright/channel_owners/browser_context.rb +31 -2
  11. data/lib/playwright/channel_owners/js_handle.rb +4 -0
  12. data/lib/playwright/channel_owners/request.rb +1 -1
  13. data/lib/playwright/connection.rb +3 -0
  14. data/lib/playwright/frame_locator_impl.rb +8 -0
  15. data/lib/playwright/locator_impl.rb +8 -0
  16. data/lib/playwright/transport.rb +6 -0
  17. data/lib/playwright/version.rb +2 -2
  18. data/lib/playwright/web_socket_transport.rb +8 -0
  19. data/lib/playwright.rb +1 -1
  20. data/lib/playwright_api/android.rb +6 -6
  21. data/lib/playwright_api/android_device.rb +6 -6
  22. data/lib/playwright_api/api_request_context.rb +6 -6
  23. data/lib/playwright_api/browser.rb +6 -6
  24. data/lib/playwright_api/browser_context.rb +24 -14
  25. data/lib/playwright_api/browser_type.rb +6 -6
  26. data/lib/playwright_api/cdp_session.rb +6 -6
  27. data/lib/playwright_api/dialog.rb +6 -6
  28. data/lib/playwright_api/element_handle.rb +6 -6
  29. data/lib/playwright_api/frame.rb +6 -6
  30. data/lib/playwright_api/frame_locator.rb +23 -4
  31. data/lib/playwright_api/js_handle.rb +6 -6
  32. data/lib/playwright_api/locator.rb +19 -0
  33. data/lib/playwright_api/page.rb +26 -22
  34. data/lib/playwright_api/playwright.rb +6 -6
  35. data/lib/playwright_api/request.rb +6 -6
  36. data/lib/playwright_api/response.rb +6 -6
  37. data/lib/playwright_api/route.rb +6 -6
  38. data/lib/playwright_api/selectors.rb +6 -6
  39. data/lib/playwright_api/tracing.rb +6 -6
  40. data/lib/playwright_api/web_socket.rb +6 -6
  41. data/lib/playwright_api/worker.rb +6 -6
  42. data/sig/playwright.rbs +3 -1
  43. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 79e99154b04a3b18273674554754ce1b06e49ae03f334b7e780f89d3b2b8c50c
4
- data.tar.gz: e0939e8cde7fd6e57ec24896bf26cf0c19a371a500be3f79fa5f284ca7b047b8
3
+ metadata.gz: e22c38ec1a50889adfbb6664dcb445db3635bcfd3d0240113f5b7250f5a16f91
4
+ data.tar.gz: 74f4b27cbc4d4e0b903c46621fa7dea13249d97b17bd780436fd5635d90f3e83
5
5
  SHA512:
6
- metadata.gz: 3b9a52e358b44a45294c244e88f1a7646011db15cf02d14f717b69bbaca4a81df90607a3425079a00c63bc185c8a1e4d5859244da007e67a84d9d399a40a5211
7
- data.tar.gz: 1f3a94d32ce82afdd196b2cd928f590bd0278f1ea0eb1cf2cc8ae22a31fbaa5a5ab4414b6dbb0916fd0f42cc6c5609d73da48bcb960b4299215516cbe9b1ac99
6
+ metadata.gz: f4201f5fa8a9353daecb78860b4a142a477c64b9634560b262faaea2c53491c0b5909ec3ada0e6ece917de08a91390b479a0aca34e7d607c0c14e9cf0999579a
7
+ data.tar.gz: 63968771197cee749d2780fa3f822f9e154088c0ea53062b86dda770f05704344a3f1f5dd696387d419252c2d1466a83e1ffbf8810ee25f069cf48c5662804ad
data/README.md CHANGED
@@ -168,13 +168,13 @@ If your environment doesn't accept installing browser or creating browser proces
168
168
  For launching Playwright server, just execute:
169
169
 
170
170
  ```
171
- npx playwright install && npx playwright run-server --port 8080
171
+ npx playwright install && npx playwright run-server --port 8080 --path /ws
172
172
  ```
173
173
 
174
174
  and we can connect to the server with the code like this:
175
175
 
176
176
  ```ruby
177
- Playwright.connect_to_playwright_server('ws://127.0.0.1:8080') do |playwright|
177
+ Playwright.connect_to_playwright_server('ws://127.0.0.1:8080/ws?browser=chromium') do |playwright|
178
178
  playwright.chromium.launch do |browser|
179
179
  page = browser.new_page
180
180
  page.goto('https://github.com/YusukeIwaki')
@@ -91,11 +91,21 @@ Returns the browser instance of the context. If it was launched as a persistent
91
91
  ## clear_cookies
92
92
 
93
93
  ```
94
- def clear_cookies
94
+ def clear_cookies(domain: nil, name: nil, path: nil)
95
95
  ```
96
96
 
97
97
 
98
- Clears context cookies.
98
+ Removes cookies from context. Accepts optional filter.
99
+
100
+ **Usage**
101
+
102
+ ```ruby
103
+ context.clear_cookies()
104
+ context.clear_cookies(name: "session-id")
105
+ context.clear_cookies(domain: "my-origin.com")
106
+ context.clear_cookies(path: "/api/v1")
107
+ context.clear_cookies(name: "session-id", domain: "my-origin.com")
108
+ ```
99
109
 
100
110
  ## clear_permissions
101
111
 
@@ -311,14 +321,16 @@ page.goto("https://example.com")
311
321
 
312
322
  It is possible to examine the request to decide the route action. For example, mocking all requests that contain some post data, and leaving all other requests as is:
313
323
 
314
- ```python sync title=example_c78483d1434363f907c28aecef3a1c6d83c0136d98bb07c2bd326cd19e006aa9.py
315
- def handle_route(route: Route):
316
- if ("my-string" in route.request.post_data):
317
- route.fulfill(body="mocked-data")
318
- else:
319
- route.continue_()
320
- context.route("/api/**", handle_route)
321
-
324
+ ```ruby
325
+ def handle_route(route, request)
326
+ if request.post_data["my-string"]
327
+ mocked_data = request.post_data.merge({ "my-string" => 'mocked-data'})
328
+ route.fulfill(postData: mocked_data)
329
+ else
330
+ route.continue
331
+ end
332
+ end
333
+ context.route("/api/**", method(:handle_route))
322
334
  ```
323
335
 
324
336
  Page routes (set up with [Page#route](./page#route)) take precedence over browser context routes when request matches both
@@ -26,11 +26,11 @@ page.frame_locator('.result-frame').first.get_by_role('button').click
26
26
 
27
27
  **Converting Locator to FrameLocator**
28
28
 
29
- If you have a [Locator](./locator) object pointing to an `iframe` it can be converted to [FrameLocator](./frame_locator) using [`:scope`](https://developer.mozilla.org/en-US/docs/Web/CSS/:scope) CSS selector:
29
+ If you have a [Locator](./locator) object pointing to an `iframe` it can be converted to [FrameLocator](./frame_locator) using [Locator#content_frame](./locator#content_frame).
30
30
 
31
- ```ruby
32
- frame_locator = locator.frame_locator(':scope')
33
- ```
31
+ **Converting FrameLocator to Locator**
32
+
33
+ If you have a [FrameLocator](./frame_locator) object it can be converted to [Locator](./locator) pointing to the same `iframe` using [FrameLocator#owner](./frame_locator#owner).
34
34
 
35
35
  ## first
36
36
 
@@ -305,3 +305,25 @@ def nth(index)
305
305
 
306
306
 
307
307
  Returns locator to the n-th matching frame. It's zero based, `nth(0)` selects the first frame.
308
+
309
+ ## owner
310
+
311
+ ```
312
+ def owner
313
+ ```
314
+
315
+
316
+ Returns a [Locator](./locator) object pointing to the same `iframe` as this frame locator.
317
+
318
+ Useful when you have a [FrameLocator](./frame_locator) object obtained somewhere, and later on would like to interact with the `iframe` element.
319
+
320
+ For a reverse operation, use [Locator#content_frame](./locator#content_frame).
321
+
322
+ **Usage**
323
+
324
+ ```ruby
325
+ frame_locator = page.frame_locator('iframe[name="embedded"]')
326
+ # ...
327
+ locator = frame_locator.owner
328
+ locator.get_attribute('src') # => frame1.html
329
+ ```
@@ -377,6 +377,28 @@ def element_handles
377
377
 
378
378
  Resolves given locator to all matching DOM elements. If there are no matching elements, returns an empty list.
379
379
 
380
+ ## content_frame
381
+
382
+ ```
383
+ def content_frame
384
+ ```
385
+
386
+
387
+ Returns a [FrameLocator](./frame_locator) object pointing to the same `iframe` as this locator.
388
+
389
+ Useful when you have a [Locator](./locator) object obtained somewhere, and later on would like to interact with the content inside the frame.
390
+
391
+ For a reverse operation, use [FrameLocator#owner](./frame_locator#owner).
392
+
393
+ **Usage**
394
+
395
+ ```ruby
396
+ locator = page.locator('iframe[name="embedded"]')
397
+ # ...
398
+ frame_locator = locator.content_frame
399
+ frame_locator.get_by_role("button").click
400
+ ```
401
+
380
402
  ## evaluate
381
403
 
382
404
  ```
@@ -1246,14 +1246,16 @@ page.goto("https://example.com")
1246
1246
 
1247
1247
  It is possible to examine the request to decide the route action. For example, mocking all requests that contain some post data, and leaving all other requests as is:
1248
1248
 
1249
- ```python sync title=example_0ef62eead1348f28a69716a047f3b75c979d3230569d3720d4e7bdd0a22ef647.py
1250
- def handle_route(route: Route):
1251
- if ("my-string" in route.request.post_data):
1252
- route.fulfill(body="mocked-data")
1253
- else:
1254
- route.continue_()
1255
- page.route("/api/**", handle_route)
1256
-
1249
+ ```ruby
1250
+ def handle_route(route, request)
1251
+ if request.post_data["my-string"]
1252
+ mocked_data = request.post_data.merge({ "my-string" => 'mocked-data'})
1253
+ route.fulfill(postData: mocked_data)
1254
+ else
1255
+ route.continue
1256
+ end
1257
+ end
1258
+ page.route("/api/**", method(:handle_route))
1257
1259
  ```
1258
1260
 
1259
1261
  Page routes take precedence over browser context routes (set up with [BrowserContext#route](./browser_context#route)) when request
@@ -8,16 +8,16 @@ sidebar_position: 1
8
8
 
9
9
  Choose any of the three ways as you prefer to download the driver:
10
10
 
11
- * `npx`: suitable for playground use, and not suitable for continuous usage.
12
- * `npm install`: the best choice for most use cases, with existing Node.js environment.
13
- * Direct download: maybe a good choice for Docker :whale: integration.
11
+ - `npx`: suitable for playground use, and not suitable for continuous usage.
12
+ - `npm install`: the best choice for most use cases, with existing Node.js environment.
13
+ - Direct download: maybe a good choice for Docker :whale: integration.
14
14
 
15
15
  :::note
16
16
 
17
17
  Also the article [Playwright on Alpine Linux](./playwright_on_alpine_linux) would be helpful if you plan to
18
18
 
19
- * Build a browser server/container like Selenium Grid
20
- * Run automation scripts on Alpine Linux
19
+ - Build a browser server/container like Selenium Grid
20
+ - Run automation scripts on Alpine Linux
21
21
 
22
22
  :::
23
23
 
@@ -29,7 +29,6 @@ $ npx playwright install
29
29
 
30
30
  and then set `playwright_cli_executable_path: "npx playwright"` at `Playwright.create`.
31
31
 
32
-
33
32
  ## Using `npm install`
34
33
 
35
34
  Actually `npx playwright` is a bit slow. We can also use `npm install` to setup.
@@ -44,15 +43,13 @@ $ ./node_modules/.bin/playwright install
44
43
 
45
44
  and then set `playwright_cli_executable_path: './node_modules/.bin/playwright'`
46
45
 
47
-
48
46
  ## Directly download driver without Node.js installation.
49
47
 
50
- Instead of npm, you can also directly download playwright driver from playwright.azureedge.net. (The URL can be easily detected from [here](https://github.com/microsoft/playwright-python/blob/cfc1030a69d1e934cac579687a680eac53d4b9ee/setup.py#L75))
51
-
48
+ Instead of npm, you can also directly download playwright driver from playwright.azureedge.net. (The URL can be easily detected from [here](https://github.com/microsoft/playwright-python/blob/cfc1030a69d1e934cac579687a680eac53d4b9ee/setup.py#L75))
52
49
 
53
50
  ```shell
54
51
  $ export PLAYWRIGHT_CLI_VERSION=$(bundle exec ruby -e 'puts Playwright::COMPATIBLE_PLAYWRIGHT_VERSION.strip')
55
52
  $ wget https://playwright.azureedge.net/builds/driver/playwright-$PLAYWRIGHT_CLI_VERSION-linux.zip
56
53
  ```
57
54
 
58
- and then extract it, and set `playwright_cli_executable_path: '/path/to/playwright-1.11.0-linux/playwright.sh'`
55
+ and then extract it, and set `playwright_cli_executable_path: '/path/to/playwright-$PLAYWRIGHT_CLI_VERSION-linux/node /path/to/playwright-$PLAYWRIGHT_CLI_VERSION-linux/package/cli.js'`
@@ -62,7 +62,7 @@ Many example uses `Playwright#create`, which internally uses Pipe (stdin/stdout)
62
62
  ```ruby {3}
63
63
  require 'playwright'
64
64
 
65
- Playwright.connect_to_playwright_server('wss://example.com:8888/ws') do |playwright|
65
+ Playwright.connect_to_playwright_server('wss://example.com:8888/ws?browser=chromium') do |playwright|
66
66
  playwright.chromium.launch do |browser|
67
67
  page = browser.new_page
68
68
  page.goto('https://github.com/microsoft/playwright')
@@ -73,6 +73,8 @@ end
73
73
 
74
74
  `wss://example.com:8888/ws` is an example of endpoint URL of the Playwright server. In local development environment, it is typically `"ws://127.0.0.1:#{port}/ws"`.
75
75
 
76
+ Note that `?browser=chromium` is important for server to determine which browser to prepare.
77
+
76
78
  ### Server code
77
79
 
78
80
  With the [official Docker image](https://hub.docker.com/_/microsoft-playwright) or in the local development environment with Node.js, just execute `npx playwright install && npx playwright run-server --port $PORT --path /ws`. (`$PORT` is a port number of the server)
@@ -440,6 +440,7 @@
440
440
  * drag_to
441
441
  * element_handle
442
442
  * element_handles
443
+ * content_frame
443
444
  * evaluate
444
445
  * evaluate_all
445
446
  * evaluate_handle
@@ -500,6 +501,7 @@
500
501
  * last
501
502
  * locator
502
503
  * nth
504
+ * owner
503
505
 
504
506
  ## APIResponse
505
507
 
@@ -267,8 +267,37 @@ module Playwright
267
267
  @channel.send_message_to_server('addCookies', cookies: cookies)
268
268
  end
269
269
 
270
- def clear_cookies
271
- @channel.send_message_to_server('clearCookies')
270
+ def clear_cookies(domain: nil, name: nil, path: nil)
271
+ params = {}
272
+
273
+ case name
274
+ when String
275
+ params[:name] = name
276
+ when Regexp
277
+ regex = JavaScript::Regex.new(name)
278
+ params[:nameRegexSource] = regex.source
279
+ params[:nameRegexFlags] = regex.flag
280
+ end
281
+
282
+ case domain
283
+ when String
284
+ params[:domain] = domain
285
+ when Regexp
286
+ regex = JavaScript::Regex.new(domain)
287
+ params[:domainRegexSource] = regex.source
288
+ params[:domainRegexFlags] = regex.flag
289
+ end
290
+
291
+ case path
292
+ when String
293
+ params[:path] = path
294
+ when Regexp
295
+ regex = JavaScript::Regex.new(path)
296
+ params[:pathRegexSource] = regex.source
297
+ params[:pathRegexFlags] = regex.flag
298
+ end
299
+
300
+ @channel.send_message_to_server('clearCookies', params)
272
301
  end
273
302
 
274
303
  def grant_permissions(permissions, origin: nil)
@@ -1,5 +1,7 @@
1
1
  module Playwright
2
2
  define_channel_owner :JSHandle do
3
+ include Utils::Errors::TargetClosedErrorMethods
4
+
3
5
  private def after_initialize
4
6
  @preview = @initializer['preview']
5
7
  @channel.on('previewUpdated', method(:on_preview_updated))
@@ -37,6 +39,8 @@ module Playwright
37
39
 
38
40
  def dispose
39
41
  @channel.send_message_to_server('dispose')
42
+ rescue => err
43
+ raise if !target_closed_error?(err)
40
44
  end
41
45
 
42
46
  def json_value
@@ -62,7 +62,7 @@ module Playwright
62
62
  content_type = headers['content-type']
63
63
  return unless content_type
64
64
 
65
- if content_type == "application/x-www-form-urlencoded"
65
+ if content_type.include?("application/x-www-form-urlencoded")
66
66
  URI.decode_www_form(data).to_h
67
67
  else
68
68
  JSON.parse(data)
@@ -16,6 +16,9 @@ module Playwright
16
16
  end
17
17
  raise ::Playwright::DriverCrashedError.new
18
18
  end
19
+ @transport.on_driver_closed do
20
+ cleanup
21
+ end
19
22
 
20
23
  @objects = {} # Hash[ guid => ChannelOwner ]
21
24
  @waiting_for_object = {} # Hash[ guid => Promise<ChannelOwner> ]
@@ -26,6 +26,14 @@ module Playwright
26
26
  hasText: hasText)
27
27
  end
28
28
 
29
+ def owner
30
+ LocatorImpl.new(
31
+ frame: @frame,
32
+ timeout_settings: @timeout_settings,
33
+ selector: @frame_selector,
34
+ )
35
+ end
36
+
29
37
  def frame_locator(selector)
30
38
  FrameLocatorImpl.new(
31
39
  frame: @frame,
@@ -233,6 +233,14 @@ module Playwright
233
233
  @frame.query_selector_all(@selector)
234
234
  end
235
235
 
236
+ def content_frame
237
+ FrameLocatorImpl.new(
238
+ frame: @frame,
239
+ timeout_settings: @timeout_settings,
240
+ frame_selector: @selector,
241
+ )
242
+ end
243
+
236
244
  def filter(has: nil, hasNot: nil, hasNotText: nil, hasText: nil)
237
245
  LocatorImpl.new(
238
246
  frame: @frame,
@@ -18,6 +18,10 @@ module Playwright
18
18
  @on_message = block
19
19
  end
20
20
 
21
+ def on_driver_closed(&block)
22
+ @on_driver_closed = block
23
+ end
24
+
21
25
  def on_driver_crashed(&block)
22
26
  @on_driver_crashed = block
23
27
  end
@@ -83,6 +87,7 @@ module Playwright
83
87
  end
84
88
  rescue IOError
85
89
  # disconnected by remote.
90
+ @on_driver_closed&.call
86
91
  end
87
92
 
88
93
  def handle_stderr
@@ -106,6 +111,7 @@ module Playwright
106
111
  end
107
112
  rescue IOError
108
113
  # disconnected by remote.
114
+ @on_driver_closed&.call
109
115
  end
110
116
 
111
117
  def debug_send_message(message)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Playwright
4
- VERSION = '1.42.1'
5
- COMPATIBLE_PLAYWRIGHT_VERSION = '1.42.1'
4
+ VERSION = '1.43.0'
5
+ COMPATIBLE_PLAYWRIGHT_VERSION = '1.43.1'
6
6
  end
@@ -15,6 +15,10 @@ module Playwright
15
15
  @on_message = block
16
16
  end
17
17
 
18
+ def on_driver_closed(&block)
19
+ @on_driver_closed = block
20
+ end
21
+
18
22
  def on_driver_crashed(&block)
19
23
  @on_driver_crashed = block
20
24
  end
@@ -76,6 +80,10 @@ module Playwright
76
80
 
77
81
  ws.start
78
82
  @ws = promise.value!
83
+ @ws.on_close do |reason, code|
84
+ puts "[WebSocketTransport] closed with code: #{code}, reason: #{reason}"
85
+ @on_driver_closed&.call(reason, code)
86
+ end
79
87
  @ws.on_error do |error|
80
88
  puts "[WebSocketTransport] error: #{error}"
81
89
  @on_driver_crashed&.call
data/lib/playwright.rb CHANGED
@@ -181,7 +181,7 @@ module Playwright
181
181
 
182
182
  # Connects to Playwright server, launched by `npx playwright launch-server chromium` or `playwright.chromium.launchServer()`
183
183
  #
184
- # Playwright.connect_to_browser_server('ws://....') do |browser|
184
+ # Playwright.connect_to_android_server('ws://....') do |browser|
185
185
  # page = browser.new_page
186
186
  # ...
187
187
  # end
@@ -40,20 +40,20 @@ module Playwright
40
40
 
41
41
  # -- inherited from EventEmitter --
42
42
  # @nodoc
43
- def off(event, callback)
44
- event_emitter_proxy.off(event, callback)
43
+ def on(event, callback)
44
+ event_emitter_proxy.on(event, callback)
45
45
  end
46
46
 
47
47
  # -- inherited from EventEmitter --
48
48
  # @nodoc
49
- def once(event, callback)
50
- event_emitter_proxy.once(event, callback)
49
+ def off(event, callback)
50
+ event_emitter_proxy.off(event, callback)
51
51
  end
52
52
 
53
53
  # -- inherited from EventEmitter --
54
54
  # @nodoc
55
- def on(event, callback)
56
- event_emitter_proxy.on(event, callback)
55
+ def once(event, callback)
56
+ event_emitter_proxy.once(event, callback)
57
57
  end
58
58
 
59
59
  private def event_emitter_proxy
@@ -205,20 +205,20 @@ module Playwright
205
205
 
206
206
  # -- inherited from EventEmitter --
207
207
  # @nodoc
208
- def off(event, callback)
209
- event_emitter_proxy.off(event, callback)
208
+ def on(event, callback)
209
+ event_emitter_proxy.on(event, callback)
210
210
  end
211
211
 
212
212
  # -- inherited from EventEmitter --
213
213
  # @nodoc
214
- def once(event, callback)
215
- event_emitter_proxy.once(event, callback)
214
+ def off(event, callback)
215
+ event_emitter_proxy.off(event, callback)
216
216
  end
217
217
 
218
218
  # -- inherited from EventEmitter --
219
219
  # @nodoc
220
- def on(event, callback)
221
- event_emitter_proxy.on(event, callback)
220
+ def once(event, callback)
221
+ event_emitter_proxy.once(event, callback)
222
222
  end
223
223
 
224
224
  private def event_emitter_proxy
@@ -280,20 +280,20 @@ module Playwright
280
280
 
281
281
  # -- inherited from EventEmitter --
282
282
  # @nodoc
283
- def off(event, callback)
284
- event_emitter_proxy.off(event, callback)
283
+ def on(event, callback)
284
+ event_emitter_proxy.on(event, callback)
285
285
  end
286
286
 
287
287
  # -- inherited from EventEmitter --
288
288
  # @nodoc
289
- def once(event, callback)
290
- event_emitter_proxy.once(event, callback)
289
+ def off(event, callback)
290
+ event_emitter_proxy.off(event, callback)
291
291
  end
292
292
 
293
293
  # -- inherited from EventEmitter --
294
294
  # @nodoc
295
- def on(event, callback)
296
- event_emitter_proxy.on(event, callback)
295
+ def once(event, callback)
296
+ event_emitter_proxy.once(event, callback)
297
297
  end
298
298
 
299
299
  private def event_emitter_proxy
@@ -202,20 +202,20 @@ module Playwright
202
202
 
203
203
  # -- inherited from EventEmitter --
204
204
  # @nodoc
205
- def off(event, callback)
206
- event_emitter_proxy.off(event, callback)
205
+ def on(event, callback)
206
+ event_emitter_proxy.on(event, callback)
207
207
  end
208
208
 
209
209
  # -- inherited from EventEmitter --
210
210
  # @nodoc
211
- def once(event, callback)
212
- event_emitter_proxy.once(event, callback)
211
+ def off(event, callback)
212
+ event_emitter_proxy.off(event, callback)
213
213
  end
214
214
 
215
215
  # -- inherited from EventEmitter --
216
216
  # @nodoc
217
- def on(event, callback)
218
- event_emitter_proxy.on(event, callback)
217
+ def once(event, callback)
218
+ event_emitter_proxy.once(event, callback)
219
219
  end
220
220
 
221
221
  private def event_emitter_proxy
@@ -81,9 +81,19 @@ module Playwright
81
81
  end
82
82
 
83
83
  #
84
- # Clears context cookies.
85
- def clear_cookies
86
- wrap_impl(@impl.clear_cookies)
84
+ # Removes cookies from context. Accepts optional filter.
85
+ #
86
+ # **Usage**
87
+ #
88
+ # ```python sync
89
+ # context.clear_cookies()
90
+ # context.clear_cookies(name="session-id")
91
+ # context.clear_cookies(domain="my-origin.com")
92
+ # context.clear_cookies(path="/api/v1")
93
+ # context.clear_cookies(name="session-id", domain="my-origin.com")
94
+ # ```
95
+ def clear_cookies(domain: nil, name: nil, path: nil)
96
+ wrap_impl(@impl.clear_cookies(domain: unwrap_impl(domain), name: unwrap_impl(name), path: unwrap_impl(path)))
87
97
  end
88
98
 
89
99
  #
@@ -438,6 +448,11 @@ module Playwright
438
448
  raise NotImplementedError.new('wait_for_event is not implemented yet.')
439
449
  end
440
450
 
451
+ # @nodoc
452
+ def owner_page=(req)
453
+ wrap_impl(@impl.owner_page=(unwrap_impl(req)))
454
+ end
455
+
441
456
  # @nodoc
442
457
  def pause
443
458
  wrap_impl(@impl.pause)
@@ -448,11 +463,6 @@ module Playwright
448
463
  wrap_impl(@impl.options=(unwrap_impl(req)))
449
464
  end
450
465
 
451
- # @nodoc
452
- def owner_page=(req)
453
- wrap_impl(@impl.owner_page=(unwrap_impl(req)))
454
- end
455
-
456
466
  # @nodoc
457
467
  def enable_debug_console!
458
468
  wrap_impl(@impl.enable_debug_console!)
@@ -465,20 +475,20 @@ module Playwright
465
475
 
466
476
  # -- inherited from EventEmitter --
467
477
  # @nodoc
468
- def off(event, callback)
469
- event_emitter_proxy.off(event, callback)
478
+ def on(event, callback)
479
+ event_emitter_proxy.on(event, callback)
470
480
  end
471
481
 
472
482
  # -- inherited from EventEmitter --
473
483
  # @nodoc
474
- def once(event, callback)
475
- event_emitter_proxy.once(event, callback)
484
+ def off(event, callback)
485
+ event_emitter_proxy.off(event, callback)
476
486
  end
477
487
 
478
488
  # -- inherited from EventEmitter --
479
489
  # @nodoc
480
- def on(event, callback)
481
- event_emitter_proxy.on(event, callback)
490
+ def once(event, callback)
491
+ event_emitter_proxy.once(event, callback)
482
492
  end
483
493
 
484
494
  private def event_emitter_proxy
@@ -176,20 +176,20 @@ module Playwright
176
176
 
177
177
  # -- inherited from EventEmitter --
178
178
  # @nodoc
179
- def off(event, callback)
180
- event_emitter_proxy.off(event, callback)
179
+ def on(event, callback)
180
+ event_emitter_proxy.on(event, callback)
181
181
  end
182
182
 
183
183
  # -- inherited from EventEmitter --
184
184
  # @nodoc
185
- def once(event, callback)
186
- event_emitter_proxy.once(event, callback)
185
+ def off(event, callback)
186
+ event_emitter_proxy.off(event, callback)
187
187
  end
188
188
 
189
189
  # -- inherited from EventEmitter --
190
190
  # @nodoc
191
- def on(event, callback)
192
- event_emitter_proxy.on(event, callback)
191
+ def once(event, callback)
192
+ event_emitter_proxy.once(event, callback)
193
193
  end
194
194
 
195
195
  private def event_emitter_proxy
@@ -34,20 +34,20 @@ module Playwright
34
34
 
35
35
  # -- inherited from EventEmitter --
36
36
  # @nodoc
37
- def off(event, callback)
38
- event_emitter_proxy.off(event, callback)
37
+ def on(event, callback)
38
+ event_emitter_proxy.on(event, callback)
39
39
  end
40
40
 
41
41
  # -- inherited from EventEmitter --
42
42
  # @nodoc
43
- def once(event, callback)
44
- event_emitter_proxy.once(event, callback)
43
+ def off(event, callback)
44
+ event_emitter_proxy.off(event, callback)
45
45
  end
46
46
 
47
47
  # -- inherited from EventEmitter --
48
48
  # @nodoc
49
- def on(event, callback)
50
- event_emitter_proxy.on(event, callback)
49
+ def once(event, callback)
50
+ event_emitter_proxy.once(event, callback)
51
51
  end
52
52
 
53
53
  private def event_emitter_proxy
@@ -70,20 +70,20 @@ module Playwright
70
70
 
71
71
  # -- inherited from EventEmitter --
72
72
  # @nodoc
73
- def off(event, callback)
74
- event_emitter_proxy.off(event, callback)
73
+ def on(event, callback)
74
+ event_emitter_proxy.on(event, callback)
75
75
  end
76
76
 
77
77
  # -- inherited from EventEmitter --
78
78
  # @nodoc
79
- def once(event, callback)
80
- event_emitter_proxy.once(event, callback)
79
+ def off(event, callback)
80
+ event_emitter_proxy.off(event, callback)
81
81
  end
82
82
 
83
83
  # -- inherited from EventEmitter --
84
84
  # @nodoc
85
- def on(event, callback)
86
- event_emitter_proxy.on(event, callback)
85
+ def once(event, callback)
86
+ event_emitter_proxy.once(event, callback)
87
87
  end
88
88
 
89
89
  private def event_emitter_proxy
@@ -575,20 +575,20 @@ module Playwright
575
575
 
576
576
  # -- inherited from EventEmitter --
577
577
  # @nodoc
578
- def off(event, callback)
579
- event_emitter_proxy.off(event, callback)
578
+ def on(event, callback)
579
+ event_emitter_proxy.on(event, callback)
580
580
  end
581
581
 
582
582
  # -- inherited from EventEmitter --
583
583
  # @nodoc
584
- def once(event, callback)
585
- event_emitter_proxy.once(event, callback)
584
+ def off(event, callback)
585
+ event_emitter_proxy.off(event, callback)
586
586
  end
587
587
 
588
588
  # -- inherited from EventEmitter --
589
589
  # @nodoc
590
- def on(event, callback)
591
- event_emitter_proxy.on(event, callback)
590
+ def once(event, callback)
591
+ event_emitter_proxy.once(event, callback)
592
592
  end
593
593
 
594
594
  private def event_emitter_proxy
@@ -1049,20 +1049,20 @@ module Playwright
1049
1049
 
1050
1050
  # -- inherited from EventEmitter --
1051
1051
  # @nodoc
1052
- def off(event, callback)
1053
- event_emitter_proxy.off(event, callback)
1052
+ def on(event, callback)
1053
+ event_emitter_proxy.on(event, callback)
1054
1054
  end
1055
1055
 
1056
1056
  # -- inherited from EventEmitter --
1057
1057
  # @nodoc
1058
- def once(event, callback)
1059
- event_emitter_proxy.once(event, callback)
1058
+ def off(event, callback)
1059
+ event_emitter_proxy.off(event, callback)
1060
1060
  end
1061
1061
 
1062
1062
  # -- inherited from EventEmitter --
1063
1063
  # @nodoc
1064
- def on(event, callback)
1065
- event_emitter_proxy.on(event, callback)
1064
+ def once(event, callback)
1065
+ event_emitter_proxy.once(event, callback)
1066
1066
  end
1067
1067
 
1068
1068
  private def event_emitter_proxy
@@ -21,11 +21,11 @@ module Playwright
21
21
  #
22
22
  # **Converting Locator to FrameLocator**
23
23
  #
24
- # If you have a `Locator` object pointing to an `iframe` it can be converted to `FrameLocator` using [`:scope`](https://developer.mozilla.org/en-US/docs/Web/CSS/:scope) CSS selector:
24
+ # If you have a `Locator` object pointing to an `iframe` it can be converted to `FrameLocator` using [`method: Locator.contentFrame`].
25
25
  #
26
- # ```python sync
27
- # frameLocator = locator.frame_locator(":scope")
28
- # ```
26
+ # **Converting FrameLocator to Locator**
27
+ #
28
+ # If you have a `FrameLocator` object it can be converted to `Locator` pointing to the same `iframe` using [`method: FrameLocator.owner`].
29
29
  class FrameLocator < PlaywrightApi
30
30
 
31
31
  #
@@ -255,5 +255,24 @@ module Playwright
255
255
  def nth(index)
256
256
  wrap_impl(@impl.nth(unwrap_impl(index)))
257
257
  end
258
+
259
+ #
260
+ # Returns a `Locator` object pointing to the same `iframe` as this frame locator.
261
+ #
262
+ # Useful when you have a `FrameLocator` object obtained somewhere, and later on would like to interact with the `iframe` element.
263
+ #
264
+ # For a reverse operation, use [`method: Locator.contentFrame`].
265
+ #
266
+ # **Usage**
267
+ #
268
+ # ```python sync
269
+ # frame_locator = page.frame_locator("iframe[name=\"embedded\"]")
270
+ # # ...
271
+ # locator = frame_locator.owner
272
+ # expect(locator).to_be_visible()
273
+ # ```
274
+ def owner
275
+ wrap_impl(@impl.owner)
276
+ end
258
277
  end
259
278
  end
@@ -100,20 +100,20 @@ module Playwright
100
100
 
101
101
  # -- inherited from EventEmitter --
102
102
  # @nodoc
103
- def off(event, callback)
104
- event_emitter_proxy.off(event, callback)
103
+ def on(event, callback)
104
+ event_emitter_proxy.on(event, callback)
105
105
  end
106
106
 
107
107
  # -- inherited from EventEmitter --
108
108
  # @nodoc
109
- def once(event, callback)
110
- event_emitter_proxy.once(event, callback)
109
+ def off(event, callback)
110
+ event_emitter_proxy.off(event, callback)
111
111
  end
112
112
 
113
113
  # -- inherited from EventEmitter --
114
114
  # @nodoc
115
- def on(event, callback)
116
- event_emitter_proxy.on(event, callback)
115
+ def once(event, callback)
116
+ event_emitter_proxy.once(event, callback)
117
117
  end
118
118
 
119
119
  private def event_emitter_proxy
@@ -325,6 +325,25 @@ module Playwright
325
325
  wrap_impl(@impl.element_handles)
326
326
  end
327
327
 
328
+ #
329
+ # Returns a `FrameLocator` object pointing to the same `iframe` as this locator.
330
+ #
331
+ # Useful when you have a `Locator` object obtained somewhere, and later on would like to interact with the content inside the frame.
332
+ #
333
+ # For a reverse operation, use [`method: FrameLocator.owner`].
334
+ #
335
+ # **Usage**
336
+ #
337
+ # ```python sync
338
+ # locator = page.locator("iframe[name=\"embedded\"]")
339
+ # # ...
340
+ # frame_locator = locator.content_frame
341
+ # frame_locator.get_by_role("button").click()
342
+ # ```
343
+ def content_frame
344
+ wrap_impl(@impl.content_frame)
345
+ end
346
+
328
347
  #
329
348
  # Execute JavaScript code in the page, taking the matching element as an argument.
330
349
  #
@@ -1080,31 +1080,35 @@ module Playwright
1080
1080
  end
1081
1081
 
1082
1082
  #
1083
- # Sometimes, the web page can show an overlay that obstructs elements behind it and prevents certain actions, like click, from completing. When such an overlay is shown predictably, we recommend dismissing it as a part of your test flow. However, sometimes such an overlay may appear non-deterministically, for example certain cookies consent dialogs behave this way. In this case, [`method: Page.addLocatorHandler`] allows handling an overlay during an action that it would block.
1083
+ # **NOTE**: This method is experimental and its behavior may change in the upcoming releases.
1084
1084
  #
1085
- # This method registers a handler for an overlay that is executed once the locator is visible on the page. The handler should get rid of the overlay so that actions blocked by it can proceed. This is useful for nondeterministic interstitial pages or dialogs, like a cookie consent dialog.
1085
+ # When testing a web page, sometimes unexpected overlays like a "Sign up" dialog appear and block actions you want to automate, e.g. clicking a button. These overlays don't always show up in the same way or at the same time, making them tricky to handle in automated tests.
1086
1086
  #
1087
- # Note that execution time of the handler counts towards the timeout of the action/assertion that executed the handler.
1087
+ # This method lets you set up a special function, called a handler, that activates when it detects that overlay is visible. The handler's job is to remove the overlay, allowing your test to continue as if the overlay wasn't there.
1088
1088
  #
1089
- # You can register multiple handlers. However, only a single handler will be running at a time. Any actions inside a handler must not require another handler to run.
1089
+ # Things to keep in mind:
1090
+ # - When an overlay is shown predictably, we recommend explicitly waiting for it in your test and dismissing it as a part of your normal test flow, instead of using [`method: Page.addLocatorHandler`].
1091
+ # - Playwright checks for the overlay every time before executing or retrying an action that requires an [actionability check](../actionability.md), or before performing an auto-waiting assertion check. When overlay is visible, Playwright calls the handler first, and then proceeds with the action/assertion. Note that the handler is only called when you perform an action/assertion - if the overlay becomes visible but you don't perform any actions, the handler will not be triggered.
1092
+ # - The execution time of the handler counts towards the timeout of the action/assertion that executed the handler. If your handler takes too long, it might cause timeouts.
1093
+ # - You can register multiple handlers. However, only a single handler will be running at a time. Make sure the actions within a handler don't depend on another handler.
1090
1094
  #
1091
- # **NOTE**: Running the interceptor will alter your page state mid-test. For example it will change the currently focused element and move the mouse. Make sure that the actions that run after the interceptor are self-contained and do not rely on the focus and mouse state.
1095
+ # **NOTE**: Running the handler will alter your page state mid-test. For example it will change the currently focused element and move the mouse. Make sure that actions that run after the handler are self-contained and do not rely on the focus and mouse state being unchanged.
1092
1096
  # <br />
1093
1097
  # <br />
1094
1098
  # For example, consider a test that calls [`method: Locator.focus`] followed by [`method: Keyboard.press`]. If your handler clicks a button between these two actions, the focused element most likely will be wrong, and key press will happen on the unexpected element. Use [`method: Locator.press`] instead to avoid this problem.
1095
1099
  # <br />
1096
1100
  # <br />
1097
- # Another example is a series of mouse actions, where [`method: Mouse.move`] is followed by [`method: Mouse.down`]. Again, when the handler runs between these two actions, the mouse position will be wrong during the mouse down. Prefer methods like [`method: Locator.click`] that are self-contained.
1101
+ # Another example is a series of mouse actions, where [`method: Mouse.move`] is followed by [`method: Mouse.down`]. Again, when the handler runs between these two actions, the mouse position will be wrong during the mouse down. Prefer self-contained actions like [`method: Locator.click`] that do not rely on the state being unchanged by a handler.
1098
1102
  #
1099
1103
  # **Usage**
1100
1104
  #
1101
- # An example that closes a cookie dialog when it appears:
1105
+ # An example that closes a "Sign up to the newsletter" dialog when it appears:
1102
1106
  #
1103
1107
  # ```python sync
1104
1108
  # # Setup the handler.
1105
1109
  # def handler():
1106
- # page.get_by_role("button", name="Reject all cookies").click()
1107
- # page.add_locator_handler(page.get_by_role("button", name="Accept all cookies"), handler)
1110
+ # page.get_by_role("button", name="No thanks").click()
1111
+ # page.add_locator_handler(page.get_by_text("Sign up to the newsletter"), handler)
1108
1112
  #
1109
1113
  # # Write the test as usual.
1110
1114
  # page.goto("https://example.com")
@@ -1743,6 +1747,16 @@ module Playwright
1743
1747
  raise NotImplementedError.new('wait_for_event is not implemented yet.')
1744
1748
  end
1745
1749
 
1750
+ # @nodoc
1751
+ def owned_context=(req)
1752
+ wrap_impl(@impl.owned_context=(unwrap_impl(req)))
1753
+ end
1754
+
1755
+ # @nodoc
1756
+ def guid
1757
+ wrap_impl(@impl.guid)
1758
+ end
1759
+
1746
1760
  # @nodoc
1747
1761
  def start_css_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
1748
1762
  wrap_impl(@impl.start_css_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
@@ -1763,14 +1777,10 @@ module Playwright
1763
1777
  wrap_impl(@impl.stop_js_coverage)
1764
1778
  end
1765
1779
 
1780
+ # -- inherited from EventEmitter --
1766
1781
  # @nodoc
1767
- def owned_context=(req)
1768
- wrap_impl(@impl.owned_context=(unwrap_impl(req)))
1769
- end
1770
-
1771
- # @nodoc
1772
- def guid
1773
- wrap_impl(@impl.guid)
1782
+ def on(event, callback)
1783
+ event_emitter_proxy.on(event, callback)
1774
1784
  end
1775
1785
 
1776
1786
  # -- inherited from EventEmitter --
@@ -1785,12 +1795,6 @@ module Playwright
1785
1795
  event_emitter_proxy.once(event, callback)
1786
1796
  end
1787
1797
 
1788
- # -- inherited from EventEmitter --
1789
- # @nodoc
1790
- def on(event, callback)
1791
- event_emitter_proxy.on(event, callback)
1792
- end
1793
-
1794
1798
  private def event_emitter_proxy
1795
1799
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
1796
1800
  end
@@ -105,20 +105,20 @@ module Playwright
105
105
 
106
106
  # -- inherited from EventEmitter --
107
107
  # @nodoc
108
- def off(event, callback)
109
- event_emitter_proxy.off(event, callback)
108
+ def on(event, callback)
109
+ event_emitter_proxy.on(event, callback)
110
110
  end
111
111
 
112
112
  # -- inherited from EventEmitter --
113
113
  # @nodoc
114
- def once(event, callback)
115
- event_emitter_proxy.once(event, callback)
114
+ def off(event, callback)
115
+ event_emitter_proxy.off(event, callback)
116
116
  end
117
117
 
118
118
  # -- inherited from EventEmitter --
119
119
  # @nodoc
120
- def on(event, callback)
121
- event_emitter_proxy.on(event, callback)
120
+ def once(event, callback)
121
+ event_emitter_proxy.once(event, callback)
122
122
  end
123
123
 
124
124
  private def event_emitter_proxy
@@ -207,20 +207,20 @@ module Playwright
207
207
 
208
208
  # -- inherited from EventEmitter --
209
209
  # @nodoc
210
- def off(event, callback)
211
- event_emitter_proxy.off(event, callback)
210
+ def on(event, callback)
211
+ event_emitter_proxy.on(event, callback)
212
212
  end
213
213
 
214
214
  # -- inherited from EventEmitter --
215
215
  # @nodoc
216
- def once(event, callback)
217
- event_emitter_proxy.once(event, callback)
216
+ def off(event, callback)
217
+ event_emitter_proxy.off(event, callback)
218
218
  end
219
219
 
220
220
  # -- inherited from EventEmitter --
221
221
  # @nodoc
222
- def on(event, callback)
223
- event_emitter_proxy.on(event, callback)
222
+ def once(event, callback)
223
+ event_emitter_proxy.once(event, callback)
224
224
  end
225
225
 
226
226
  private def event_emitter_proxy
@@ -129,20 +129,20 @@ module Playwright
129
129
 
130
130
  # -- inherited from EventEmitter --
131
131
  # @nodoc
132
- def off(event, callback)
133
- event_emitter_proxy.off(event, callback)
132
+ def on(event, callback)
133
+ event_emitter_proxy.on(event, callback)
134
134
  end
135
135
 
136
136
  # -- inherited from EventEmitter --
137
137
  # @nodoc
138
- def once(event, callback)
139
- event_emitter_proxy.once(event, callback)
138
+ def off(event, callback)
139
+ event_emitter_proxy.off(event, callback)
140
140
  end
141
141
 
142
142
  # -- inherited from EventEmitter --
143
143
  # @nodoc
144
- def on(event, callback)
145
- event_emitter_proxy.on(event, callback)
144
+ def once(event, callback)
145
+ event_emitter_proxy.once(event, callback)
146
146
  end
147
147
 
148
148
  private def event_emitter_proxy
@@ -167,20 +167,20 @@ module Playwright
167
167
 
168
168
  # -- inherited from EventEmitter --
169
169
  # @nodoc
170
- def off(event, callback)
171
- event_emitter_proxy.off(event, callback)
170
+ def on(event, callback)
171
+ event_emitter_proxy.on(event, callback)
172
172
  end
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
  private def event_emitter_proxy
@@ -63,20 +63,20 @@ module Playwright
63
63
 
64
64
  # -- inherited from EventEmitter --
65
65
  # @nodoc
66
- def off(event, callback)
67
- event_emitter_proxy.off(event, callback)
66
+ def on(event, callback)
67
+ event_emitter_proxy.on(event, callback)
68
68
  end
69
69
 
70
70
  # -- inherited from EventEmitter --
71
71
  # @nodoc
72
- def once(event, callback)
73
- event_emitter_proxy.once(event, callback)
72
+ def off(event, callback)
73
+ event_emitter_proxy.off(event, callback)
74
74
  end
75
75
 
76
76
  # -- inherited from EventEmitter --
77
77
  # @nodoc
78
- def on(event, callback)
79
- event_emitter_proxy.on(event, callback)
78
+ def once(event, callback)
79
+ event_emitter_proxy.once(event, callback)
80
80
  end
81
81
 
82
82
  private def event_emitter_proxy
@@ -72,20 +72,20 @@ module Playwright
72
72
 
73
73
  # -- inherited from EventEmitter --
74
74
  # @nodoc
75
- def off(event, callback)
76
- event_emitter_proxy.off(event, callback)
75
+ def on(event, callback)
76
+ event_emitter_proxy.on(event, callback)
77
77
  end
78
78
 
79
79
  # -- inherited from EventEmitter --
80
80
  # @nodoc
81
- def once(event, callback)
82
- event_emitter_proxy.once(event, callback)
81
+ def off(event, callback)
82
+ event_emitter_proxy.off(event, callback)
83
83
  end
84
84
 
85
85
  # -- inherited from EventEmitter --
86
86
  # @nodoc
87
- def on(event, callback)
88
- event_emitter_proxy.on(event, callback)
87
+ def once(event, callback)
88
+ event_emitter_proxy.once(event, callback)
89
89
  end
90
90
 
91
91
  private def event_emitter_proxy
@@ -34,20 +34,20 @@ module Playwright
34
34
 
35
35
  # -- inherited from EventEmitter --
36
36
  # @nodoc
37
- def off(event, callback)
38
- event_emitter_proxy.off(event, callback)
37
+ def on(event, callback)
38
+ event_emitter_proxy.on(event, callback)
39
39
  end
40
40
 
41
41
  # -- inherited from EventEmitter --
42
42
  # @nodoc
43
- def once(event, callback)
44
- event_emitter_proxy.once(event, callback)
43
+ def off(event, callback)
44
+ event_emitter_proxy.off(event, callback)
45
45
  end
46
46
 
47
47
  # -- inherited from EventEmitter --
48
48
  # @nodoc
49
- def on(event, callback)
50
- event_emitter_proxy.on(event, callback)
49
+ def once(event, callback)
50
+ event_emitter_proxy.once(event, callback)
51
51
  end
52
52
 
53
53
  private def event_emitter_proxy
@@ -58,20 +58,20 @@ module Playwright
58
58
 
59
59
  # -- inherited from EventEmitter --
60
60
  # @nodoc
61
- def off(event, callback)
62
- event_emitter_proxy.off(event, callback)
61
+ def on(event, callback)
62
+ event_emitter_proxy.on(event, callback)
63
63
  end
64
64
 
65
65
  # -- inherited from EventEmitter --
66
66
  # @nodoc
67
- def once(event, callback)
68
- event_emitter_proxy.once(event, callback)
67
+ def off(event, callback)
68
+ event_emitter_proxy.off(event, callback)
69
69
  end
70
70
 
71
71
  # -- inherited from EventEmitter --
72
72
  # @nodoc
73
- def on(event, callback)
74
- event_emitter_proxy.on(event, callback)
73
+ def once(event, callback)
74
+ event_emitter_proxy.once(event, callback)
75
75
  end
76
76
 
77
77
  private def event_emitter_proxy
data/sig/playwright.rbs CHANGED
@@ -360,7 +360,7 @@ module Playwright
360
360
  def add_init_script: (?path: (String | File), ?script: String) -> void
361
361
  def background_pages: -> Array[untyped]
362
362
  def browser: -> (nil | Browser)
363
- def clear_cookies: -> void
363
+ def clear_cookies: (?domain: (String | Regexp), ?name: (String | Regexp), ?path: (String | Regexp)) -> void
364
364
  def clear_permissions: -> void
365
365
  def close: (?reason: String) -> void
366
366
  def cookies: (?urls: (String | Array[untyped])) -> Array[untyped]
@@ -451,6 +451,7 @@ module Playwright
451
451
  def drag_to: (Locator target, ?force: bool, ?noWaitAfter: bool, ?sourcePosition: Hash[untyped, untyped], ?targetPosition: Hash[untyped, untyped], ?timeout: Float, ?trial: bool) -> void
452
452
  def element_handle: (?timeout: Float) -> ElementHandle
453
453
  def element_handles: -> Array[untyped]
454
+ def content_frame: -> FrameLocator
454
455
  def evaluate: (String expression, ?arg: untyped, ?timeout: Float) -> untyped
455
456
  def evaluate_all: (String expression, ?arg: untyped) -> untyped
456
457
  def evaluate_handle: (String expression, ?arg: untyped, ?timeout: Float) -> JSHandle
@@ -514,6 +515,7 @@ module Playwright
514
515
  def last: -> FrameLocator
515
516
  def locator: ((String | Locator) selectorOrLocator, ?has: Locator, ?hasNot: Locator, ?hasNotText: (String | Regexp), ?hasText: (String | Regexp)) -> Locator
516
517
  def nth: (Integer index) -> FrameLocator
518
+ def owner: -> Locator
517
519
  end
518
520
 
519
521
  class APIResponse
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: playwright-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.42.1
4
+ version: 1.43.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - YusukeIwaki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-03-06 00:00:00.000000000 Z
11
+ date: 2024-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -407,5 +407,5 @@ requirements: []
407
407
  rubygems_version: 3.3.26
408
408
  signing_key:
409
409
  specification_version: 4
410
- summary: The Ruby binding of playwright driver 1.42.1
410
+ summary: The Ruby binding of playwright driver 1.43.1
411
411
  test_files: []