playwright-ruby-client 1.42.1 → 1.43.1

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 +23 -13
  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 +8 -8
  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 +29 -25
  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 +8 -8
  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 +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 79e99154b04a3b18273674554754ce1b06e49ae03f334b7e780f89d3b2b8c50c
4
- data.tar.gz: e0939e8cde7fd6e57ec24896bf26cf0c19a371a500be3f79fa5f284ca7b047b8
3
+ metadata.gz: 28e058238a428979c1a84b8fd1109d37cd0aa79669ba3a0695bd374b1e0c8776
4
+ data.tar.gz: 4255f868bdd795dd1a8f84b9348f97d4d01e0a8fbd8f45ae51b366d868673a29
5
5
  SHA512:
6
- metadata.gz: 3b9a52e358b44a45294c244e88f1a7646011db15cf02d14f717b69bbaca4a81df90607a3425079a00c63bc185c8a1e4d5859244da007e67a84d9d399a40a5211
7
- data.tar.gz: 1f3a94d32ce82afdd196b2cd928f590bd0278f1ea0eb1cf2cc8ae22a31fbaa5a5ab4414b6dbb0916fd0f42cc6c5609d73da48bcb960b4299215516cbe9b1ac99
6
+ metadata.gz: ad65fdc5ca36488f277ab184baf0cf5dca2de67c873de126a0153210d10fce83ff48a8d9ebc6b5fe7aeefc05158cbe0d9661fa9ee57d25c6688dc87f3023f715
7
+ data.tar.gz: 9a3c7087cc9fd12f75bcbfe66fefe4a5a470b96aef03f596e84f36dc94ec1a738cac7aa7466cb71bfe4047e88c185e2e0fd7a9a9f638b9319cb6231adca900b0
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.1'
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
@@ -38,12 +38,6 @@ module Playwright
38
38
  end
39
39
  alias_method :default_timeout=, :set_default_timeout
40
40
 
41
- # -- inherited from EventEmitter --
42
- # @nodoc
43
- def off(event, callback)
44
- event_emitter_proxy.off(event, callback)
45
- end
46
-
47
41
  # -- inherited from EventEmitter --
48
42
  # @nodoc
49
43
  def once(event, callback)
@@ -56,6 +50,12 @@ module Playwright
56
50
  event_emitter_proxy.on(event, callback)
57
51
  end
58
52
 
53
+ # -- inherited from EventEmitter --
54
+ # @nodoc
55
+ def off(event, callback)
56
+ event_emitter_proxy.off(event, callback)
57
+ end
58
+
59
59
  private def event_emitter_proxy
60
60
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
61
61
  end
@@ -203,12 +203,6 @@ module Playwright
203
203
  wrap_impl(@impl.should_close_connection_on_close!)
204
204
  end
205
205
 
206
- # -- inherited from EventEmitter --
207
- # @nodoc
208
- def off(event, callback)
209
- event_emitter_proxy.off(event, callback)
210
- end
211
-
212
206
  # -- inherited from EventEmitter --
213
207
  # @nodoc
214
208
  def once(event, callback)
@@ -221,6 +215,12 @@ module Playwright
221
215
  event_emitter_proxy.on(event, callback)
222
216
  end
223
217
 
218
+ # -- inherited from EventEmitter --
219
+ # @nodoc
220
+ def off(event, callback)
221
+ event_emitter_proxy.off(event, callback)
222
+ end
223
+
224
224
  private def event_emitter_proxy
225
225
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
226
226
  end
@@ -278,12 +278,6 @@ module Playwright
278
278
  raise NotImplementedError.new('storage_state is not implemented yet.')
279
279
  end
280
280
 
281
- # -- inherited from EventEmitter --
282
- # @nodoc
283
- def off(event, callback)
284
- event_emitter_proxy.off(event, callback)
285
- end
286
-
287
281
  # -- inherited from EventEmitter --
288
282
  # @nodoc
289
283
  def once(event, callback)
@@ -296,6 +290,12 @@ module Playwright
296
290
  event_emitter_proxy.on(event, callback)
297
291
  end
298
292
 
293
+ # -- inherited from EventEmitter --
294
+ # @nodoc
295
+ def off(event, callback)
296
+ event_emitter_proxy.off(event, callback)
297
+ end
298
+
299
299
  private def event_emitter_proxy
300
300
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
301
301
  end
@@ -200,12 +200,6 @@ module Playwright
200
200
  wrap_impl(@impl.version)
201
201
  end
202
202
 
203
- # -- inherited from EventEmitter --
204
- # @nodoc
205
- def off(event, callback)
206
- event_emitter_proxy.off(event, callback)
207
- end
208
-
209
203
  # -- inherited from EventEmitter --
210
204
  # @nodoc
211
205
  def once(event, callback)
@@ -218,6 +212,12 @@ module Playwright
218
212
  event_emitter_proxy.on(event, callback)
219
213
  end
220
214
 
215
+ # -- inherited from EventEmitter --
216
+ # @nodoc
217
+ def off(event, callback)
218
+ event_emitter_proxy.off(event, callback)
219
+ end
220
+
221
221
  private def event_emitter_proxy
222
222
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
223
223
  end
@@ -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
  #
@@ -443,11 +453,6 @@ module Playwright
443
453
  wrap_impl(@impl.pause)
444
454
  end
445
455
 
446
- # @nodoc
447
- def options=(req)
448
- wrap_impl(@impl.options=(unwrap_impl(req)))
449
- end
450
-
451
456
  # @nodoc
452
457
  def owner_page=(req)
453
458
  wrap_impl(@impl.owner_page=(unwrap_impl(req)))
@@ -459,14 +464,13 @@ module Playwright
459
464
  end
460
465
 
461
466
  # @nodoc
462
- def browser=(req)
463
- wrap_impl(@impl.browser=(unwrap_impl(req)))
467
+ def options=(req)
468
+ wrap_impl(@impl.options=(unwrap_impl(req)))
464
469
  end
465
470
 
466
- # -- inherited from EventEmitter --
467
471
  # @nodoc
468
- def off(event, callback)
469
- event_emitter_proxy.off(event, callback)
472
+ def browser=(req)
473
+ wrap_impl(@impl.browser=(unwrap_impl(req)))
470
474
  end
471
475
 
472
476
  # -- inherited from EventEmitter --
@@ -481,6 +485,12 @@ module Playwright
481
485
  event_emitter_proxy.on(event, callback)
482
486
  end
483
487
 
488
+ # -- inherited from EventEmitter --
489
+ # @nodoc
490
+ def off(event, callback)
491
+ event_emitter_proxy.off(event, callback)
492
+ end
493
+
484
494
  private def event_emitter_proxy
485
495
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
486
496
  end
@@ -174,12 +174,6 @@ module Playwright
174
174
  wrap_impl(@impl.name)
175
175
  end
176
176
 
177
- # -- inherited from EventEmitter --
178
- # @nodoc
179
- def off(event, callback)
180
- event_emitter_proxy.off(event, callback)
181
- end
182
-
183
177
  # -- inherited from EventEmitter --
184
178
  # @nodoc
185
179
  def once(event, callback)
@@ -192,6 +186,12 @@ module Playwright
192
186
  event_emitter_proxy.on(event, callback)
193
187
  end
194
188
 
189
+ # -- inherited from EventEmitter --
190
+ # @nodoc
191
+ def off(event, callback)
192
+ event_emitter_proxy.off(event, callback)
193
+ end
194
+
195
195
  private def event_emitter_proxy
196
196
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
197
197
  end
@@ -32,12 +32,6 @@ module Playwright
32
32
  wrap_impl(@impl.send_message(unwrap_impl(method), params: unwrap_impl(params)))
33
33
  end
34
34
 
35
- # -- inherited from EventEmitter --
36
- # @nodoc
37
- def off(event, callback)
38
- event_emitter_proxy.off(event, callback)
39
- end
40
-
41
35
  # -- inherited from EventEmitter --
42
36
  # @nodoc
43
37
  def once(event, callback)
@@ -50,6 +44,12 @@ module Playwright
50
44
  event_emitter_proxy.on(event, callback)
51
45
  end
52
46
 
47
+ # -- inherited from EventEmitter --
48
+ # @nodoc
49
+ def off(event, callback)
50
+ event_emitter_proxy.off(event, callback)
51
+ end
52
+
53
53
  private def event_emitter_proxy
54
54
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
55
55
  end
@@ -68,12 +68,6 @@ module Playwright
68
68
  wrap_impl(@impl.accept_async(promptText: unwrap_impl(promptText)))
69
69
  end
70
70
 
71
- # -- inherited from EventEmitter --
72
- # @nodoc
73
- def off(event, callback)
74
- event_emitter_proxy.off(event, callback)
75
- end
76
-
77
71
  # -- inherited from EventEmitter --
78
72
  # @nodoc
79
73
  def once(event, callback)
@@ -86,6 +80,12 @@ module Playwright
86
80
  event_emitter_proxy.on(event, callback)
87
81
  end
88
82
 
83
+ # -- inherited from EventEmitter --
84
+ # @nodoc
85
+ def off(event, callback)
86
+ event_emitter_proxy.off(event, callback)
87
+ end
88
+
89
89
  private def event_emitter_proxy
90
90
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
91
91
  end
@@ -573,12 +573,6 @@ module Playwright
573
573
  wrap_impl(@impl.wait_for_selector(unwrap_impl(selector), state: unwrap_impl(state), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
574
574
  end
575
575
 
576
- # -- inherited from EventEmitter --
577
- # @nodoc
578
- def off(event, callback)
579
- event_emitter_proxy.off(event, callback)
580
- end
581
-
582
576
  # -- inherited from EventEmitter --
583
577
  # @nodoc
584
578
  def once(event, callback)
@@ -591,6 +585,12 @@ module Playwright
591
585
  event_emitter_proxy.on(event, callback)
592
586
  end
593
587
 
588
+ # -- inherited from EventEmitter --
589
+ # @nodoc
590
+ def off(event, callback)
591
+ event_emitter_proxy.off(event, callback)
592
+ end
593
+
594
594
  private def event_emitter_proxy
595
595
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
596
596
  end
@@ -1037,20 +1037,14 @@ module Playwright
1037
1037
  wrap_impl(@impl.wait_for_url(unwrap_impl(url), timeout: unwrap_impl(timeout), waitUntil: unwrap_impl(waitUntil)))
1038
1038
  end
1039
1039
 
1040
- # @nodoc
1041
- def detached=(req)
1042
- wrap_impl(@impl.detached=(unwrap_impl(req)))
1043
- end
1044
-
1045
1040
  # @nodoc
1046
1041
  def highlight(selector)
1047
1042
  wrap_impl(@impl.highlight(unwrap_impl(selector)))
1048
1043
  end
1049
1044
 
1050
- # -- inherited from EventEmitter --
1051
1045
  # @nodoc
1052
- def off(event, callback)
1053
- event_emitter_proxy.off(event, callback)
1046
+ def detached=(req)
1047
+ wrap_impl(@impl.detached=(unwrap_impl(req)))
1054
1048
  end
1055
1049
 
1056
1050
  # -- inherited from EventEmitter --
@@ -1065,6 +1059,12 @@ module Playwright
1065
1059
  event_emitter_proxy.on(event, callback)
1066
1060
  end
1067
1061
 
1062
+ # -- inherited from EventEmitter --
1063
+ # @nodoc
1064
+ def off(event, callback)
1065
+ event_emitter_proxy.off(event, callback)
1066
+ end
1067
+
1068
1068
  private def event_emitter_proxy
1069
1069
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
1070
1070
  end
@@ -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
@@ -98,12 +98,6 @@ module Playwright
98
98
  wrap_impl(@impl.to_s)
99
99
  end
100
100
 
101
- # -- inherited from EventEmitter --
102
- # @nodoc
103
- def off(event, callback)
104
- event_emitter_proxy.off(event, callback)
105
- end
106
-
107
101
  # -- inherited from EventEmitter --
108
102
  # @nodoc
109
103
  def once(event, callback)
@@ -116,6 +110,12 @@ module Playwright
116
110
  event_emitter_proxy.on(event, callback)
117
111
  end
118
112
 
113
+ # -- inherited from EventEmitter --
114
+ # @nodoc
115
+ def off(event, callback)
116
+ event_emitter_proxy.off(event, callback)
117
+ end
118
+
119
119
  private def event_emitter_proxy
120
120
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
121
121
  end
@@ -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,22 +1777,6 @@ module Playwright
1763
1777
  wrap_impl(@impl.stop_js_coverage)
1764
1778
  end
1765
1779
 
1766
- # @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)
1774
- end
1775
-
1776
- # -- inherited from EventEmitter --
1777
- # @nodoc
1778
- def off(event, callback)
1779
- event_emitter_proxy.off(event, callback)
1780
- end
1781
-
1782
1780
  # -- inherited from EventEmitter --
1783
1781
  # @nodoc
1784
1782
  def once(event, callback)
@@ -1791,6 +1789,12 @@ module Playwright
1791
1789
  event_emitter_proxy.on(event, callback)
1792
1790
  end
1793
1791
 
1792
+ # -- inherited from EventEmitter --
1793
+ # @nodoc
1794
+ def off(event, callback)
1795
+ event_emitter_proxy.off(event, callback)
1796
+ end
1797
+
1794
1798
  private def event_emitter_proxy
1795
1799
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
1796
1800
  end
@@ -103,12 +103,6 @@ module Playwright
103
103
  wrap_impl(@impl.electron)
104
104
  end
105
105
 
106
- # -- inherited from EventEmitter --
107
- # @nodoc
108
- def off(event, callback)
109
- event_emitter_proxy.off(event, callback)
110
- end
111
-
112
106
  # -- inherited from EventEmitter --
113
107
  # @nodoc
114
108
  def once(event, callback)
@@ -121,6 +115,12 @@ module Playwright
121
115
  event_emitter_proxy.on(event, callback)
122
116
  end
123
117
 
118
+ # -- inherited from EventEmitter --
119
+ # @nodoc
120
+ def off(event, callback)
121
+ event_emitter_proxy.off(event, callback)
122
+ end
123
+
124
124
  private def event_emitter_proxy
125
125
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
126
126
  end
@@ -205,12 +205,6 @@ module Playwright
205
205
  wrap_impl(@impl.header_values(unwrap_impl(name)))
206
206
  end
207
207
 
208
- # -- inherited from EventEmitter --
209
- # @nodoc
210
- def off(event, callback)
211
- event_emitter_proxy.off(event, callback)
212
- end
213
-
214
208
  # -- inherited from EventEmitter --
215
209
  # @nodoc
216
210
  def once(event, callback)
@@ -223,6 +217,12 @@ module Playwright
223
217
  event_emitter_proxy.on(event, callback)
224
218
  end
225
219
 
220
+ # -- inherited from EventEmitter --
221
+ # @nodoc
222
+ def off(event, callback)
223
+ event_emitter_proxy.off(event, callback)
224
+ end
225
+
226
226
  private def event_emitter_proxy
227
227
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
228
228
  end
@@ -117,20 +117,14 @@ module Playwright
117
117
  wrap_impl(@impl.url)
118
118
  end
119
119
 
120
- # @nodoc
121
- def from_service_worker?
122
- wrap_impl(@impl.from_service_worker?)
123
- end
124
-
125
120
  # @nodoc
126
121
  def ok?
127
122
  wrap_impl(@impl.ok?)
128
123
  end
129
124
 
130
- # -- inherited from EventEmitter --
131
125
  # @nodoc
132
- def off(event, callback)
133
- event_emitter_proxy.off(event, callback)
126
+ def from_service_worker?
127
+ wrap_impl(@impl.from_service_worker?)
134
128
  end
135
129
 
136
130
  # -- inherited from EventEmitter --
@@ -145,6 +139,12 @@ module Playwright
145
139
  event_emitter_proxy.on(event, callback)
146
140
  end
147
141
 
142
+ # -- inherited from EventEmitter --
143
+ # @nodoc
144
+ def off(event, callback)
145
+ event_emitter_proxy.off(event, callback)
146
+ end
147
+
148
148
  private def event_emitter_proxy
149
149
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
150
150
  end
@@ -165,12 +165,6 @@ module Playwright
165
165
  wrap_impl(@impl.redirect_navigation_request(unwrap_impl(url)))
166
166
  end
167
167
 
168
- # -- inherited from EventEmitter --
169
- # @nodoc
170
- def off(event, callback)
171
- event_emitter_proxy.off(event, callback)
172
- end
173
-
174
168
  # -- inherited from EventEmitter --
175
169
  # @nodoc
176
170
  def once(event, callback)
@@ -183,6 +177,12 @@ module Playwright
183
177
  event_emitter_proxy.on(event, callback)
184
178
  end
185
179
 
180
+ # -- inherited from EventEmitter --
181
+ # @nodoc
182
+ def off(event, callback)
183
+ event_emitter_proxy.off(event, callback)
184
+ end
185
+
186
186
  private def event_emitter_proxy
187
187
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
188
188
  end
@@ -61,12 +61,6 @@ module Playwright
61
61
  wrap_impl(@impl.text_id_attribute=(unwrap_impl(attribute_name)))
62
62
  end
63
63
 
64
- # -- inherited from EventEmitter --
65
- # @nodoc
66
- def off(event, callback)
67
- event_emitter_proxy.off(event, callback)
68
- end
69
-
70
64
  # -- inherited from EventEmitter --
71
65
  # @nodoc
72
66
  def once(event, callback)
@@ -79,6 +73,12 @@ module Playwright
79
73
  event_emitter_proxy.on(event, callback)
80
74
  end
81
75
 
76
+ # -- inherited from EventEmitter --
77
+ # @nodoc
78
+ def off(event, callback)
79
+ event_emitter_proxy.off(event, callback)
80
+ end
81
+
82
82
  private def event_emitter_proxy
83
83
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
84
84
  end
@@ -70,12 +70,6 @@ module Playwright
70
70
  wrap_impl(@impl.stop_chunk(path: unwrap_impl(path)))
71
71
  end
72
72
 
73
- # -- inherited from EventEmitter --
74
- # @nodoc
75
- def off(event, callback)
76
- event_emitter_proxy.off(event, callback)
77
- end
78
-
79
73
  # -- inherited from EventEmitter --
80
74
  # @nodoc
81
75
  def once(event, callback)
@@ -88,6 +82,12 @@ module Playwright
88
82
  event_emitter_proxy.on(event, callback)
89
83
  end
90
84
 
85
+ # -- inherited from EventEmitter --
86
+ # @nodoc
87
+ def off(event, callback)
88
+ event_emitter_proxy.off(event, callback)
89
+ end
90
+
91
91
  private def event_emitter_proxy
92
92
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
93
93
  end
@@ -32,12 +32,6 @@ module Playwright
32
32
  wrap_impl(@impl.wait_for_event(unwrap_impl(event), predicate: unwrap_impl(predicate), timeout: unwrap_impl(timeout), &wrap_block_call(block)))
33
33
  end
34
34
 
35
- # -- inherited from EventEmitter --
36
- # @nodoc
37
- def off(event, callback)
38
- event_emitter_proxy.off(event, callback)
39
- end
40
-
41
35
  # -- inherited from EventEmitter --
42
36
  # @nodoc
43
37
  def once(event, callback)
@@ -50,6 +44,12 @@ module Playwright
50
44
  event_emitter_proxy.on(event, callback)
51
45
  end
52
46
 
47
+ # -- inherited from EventEmitter --
48
+ # @nodoc
49
+ def off(event, callback)
50
+ event_emitter_proxy.off(event, callback)
51
+ end
52
+
53
53
  private def event_emitter_proxy
54
54
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
55
55
  end
@@ -56,12 +56,6 @@ module Playwright
56
56
  wrap_impl(@impl.context=(unwrap_impl(req)))
57
57
  end
58
58
 
59
- # -- inherited from EventEmitter --
60
- # @nodoc
61
- def off(event, callback)
62
- event_emitter_proxy.off(event, callback)
63
- end
64
-
65
59
  # -- inherited from EventEmitter --
66
60
  # @nodoc
67
61
  def once(event, callback)
@@ -74,6 +68,12 @@ module Playwright
74
68
  event_emitter_proxy.on(event, callback)
75
69
  end
76
70
 
71
+ # -- inherited from EventEmitter --
72
+ # @nodoc
73
+ def off(event, callback)
74
+ event_emitter_proxy.off(event, callback)
75
+ end
76
+
77
77
  private def event_emitter_proxy
78
78
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
79
79
  end
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.1
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-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -404,8 +404,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
404
404
  - !ruby/object:Gem::Version
405
405
  version: '0'
406
406
  requirements: []
407
- rubygems_version: 3.3.26
407
+ rubygems_version: 3.3.27
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: []