playwright-ruby-client 1.31.1 → 1.32.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 409785017cb92188415f2e06c7ed8f369cd95723a60b70dcf86b1e4e110ff07b
4
- data.tar.gz: 79a75b15a818e32ec1cb2f6dda2f64b0eb0f18316373ec8c84cab208efae6593
3
+ metadata.gz: 495cb2986f254eece67f5db9b5f7f528e6ee4ce450d8cb9f33710fffd33f6f36
4
+ data.tar.gz: a77adbc84c2b816988262c71a44772d314c9a6fef5420d8122b71ee698c1bd43
5
5
  SHA512:
6
- metadata.gz: 26e88e610f09aba2993c26866e5927ce972a9c63f50dda6b00f91d221d1925a70ee8820ecddcfa69579d29346a53e9a150e5dfa81d36f19f6c9da74d8135bb48
7
- data.tar.gz: 8e25217e4425a3d3376710a872748d6acd966a1e941dbc5728bd8e63f05dd08cb04a1487fdda96cc5879db1b1e0ad2b5c8730bb0e057ca7ac416748ace60cea7
6
+ metadata.gz: 6b4a172fe40f17bd6b6177b623eeb8397d2e696e65c1a84a318dfcd6df6cd134460e1924b30ebf030402d8ba0c20823d178d9a9eef822e66ea39801cf63fa2a7
7
+ data.tar.gz: 5682df9be25bd8ff3a97f9b85d925c4ca410c12570f18f238dee17188a3520357b32ad5265f49bcfab371bfb83ae12723c8a039c56608c79832661f7c65c9221
@@ -333,7 +333,13 @@ To remove a route with its handler you can use [BrowserContext#unroute](./browse
333
333
  ## route_from_har
334
334
 
335
335
  ```
336
- def route_from_har(har, notFound: nil, update: nil, url: nil)
336
+ def route_from_har(
337
+ har,
338
+ notFound: nil,
339
+ update: nil,
340
+ updateContent: nil,
341
+ updateMode: nil,
342
+ url: nil)
337
343
  ```
338
344
 
339
345
 
@@ -439,18 +439,20 @@ def get_by_label(text, exact: nil)
439
439
  ```
440
440
 
441
441
 
442
- Allows locating input elements by the text of the associated label.
442
+ Allows locating input elements by the text of the associated `<label>` or `aria-labelledby` element, or by the `aria-label` attribute.
443
443
 
444
444
  **Usage**
445
445
 
446
- For example, this method will find the input by label text "Password" in the following DOM:
446
+ For example, this method will find inputs by label "Username" and "Password" in the following DOM:
447
447
 
448
448
  ```html
449
+ <input aria-label="Username">
449
450
  <label for="password-input">Password:</label>
450
451
  <input id="password-input">
451
452
  ```
452
453
 
453
454
  ```ruby
455
+ page.get_by_label("Username").fill("john")
454
456
  page.get_by_label("Password").fill("secret")
455
457
  ```
456
458
 
@@ -79,18 +79,20 @@ def get_by_label(text, exact: nil)
79
79
  ```
80
80
 
81
81
 
82
- Allows locating input elements by the text of the associated label.
82
+ Allows locating input elements by the text of the associated `<label>` or `aria-labelledby` element, or by the `aria-label` attribute.
83
83
 
84
84
  **Usage**
85
85
 
86
- For example, this method will find the input by label text "Password" in the following DOM:
86
+ For example, this method will find inputs by label "Username" and "Password" in the following DOM:
87
87
 
88
88
  ```html
89
+ <input aria-label="Username">
89
90
  <label for="password-input">Password:</label>
90
91
  <input id="password-input">
91
92
  ```
92
93
 
93
94
  ```ruby
95
+ page.get_by_label("Username").fill("john")
94
96
  page.get_by_label("Password").fill("secret")
95
97
  ```
96
98
 
@@ -282,7 +284,7 @@ Returns locator to the last matching frame.
282
284
  ## locator
283
285
 
284
286
  ```
285
- def locator(selector, has: nil, hasText: nil)
287
+ def locator(selectorOrLocator, has: nil, hasText: nil)
286
288
  ```
287
289
 
288
290
 
@@ -20,6 +20,8 @@ def all
20
20
  When locator points to a list of elements, returns array of locators, pointing
21
21
  to respective elements.
22
22
 
23
+ Note that [Locator#all](./locator#all) does not wait for elements to match the locator, and instead immediately returns whatever is present in the page. To avoid flakiness when elements are loaded dynamically, wait for the loading to finish before calling [Locator#all](./locator#all).
24
+
23
25
  **Usage**
24
26
 
25
27
  ```ruby
@@ -532,18 +534,20 @@ def get_by_label(text, exact: nil)
532
534
  ```
533
535
 
534
536
 
535
- Allows locating input elements by the text of the associated label.
537
+ Allows locating input elements by the text of the associated `<label>` or `aria-labelledby` element, or by the `aria-label` attribute.
536
538
 
537
539
  **Usage**
538
540
 
539
- For example, this method will find the input by label text "Password" in the following DOM:
541
+ For example, this method will find inputs by label "Username" and "Password" in the following DOM:
540
542
 
541
543
  ```html
544
+ <input aria-label="Username">
542
545
  <label for="password-input">Password:</label>
543
546
  <input id="password-input">
544
547
  ```
545
548
 
546
549
  ```ruby
550
+ page.get_by_label("Username").fill("john")
547
551
  page.get_by_label("Password").fill("secret")
548
552
  ```
549
553
 
@@ -911,7 +915,7 @@ banana = page.get_by_role("listitem").last
911
915
  ## locator
912
916
 
913
917
  ```
914
- def locator(selector, has: nil, hasText: nil)
918
+ def locator(selectorOrLocator, has: nil, hasText: nil)
915
919
  ```
916
920
 
917
921
 
@@ -651,18 +651,20 @@ def get_by_label(text, exact: nil)
651
651
  ```
652
652
 
653
653
 
654
- Allows locating input elements by the text of the associated label.
654
+ Allows locating input elements by the text of the associated `<label>` or `aria-labelledby` element, or by the `aria-label` attribute.
655
655
 
656
656
  **Usage**
657
657
 
658
- For example, this method will find the input by label text "Password" in the following DOM:
658
+ For example, this method will find inputs by label "Username" and "Password" in the following DOM:
659
659
 
660
660
  ```html
661
+ <input aria-label="Username">
661
662
  <label for="password-input">Password:</label>
662
663
  <input id="password-input">
663
664
  ```
664
665
 
665
666
  ```ruby
667
+ page.get_by_label("Username").fill("john")
666
668
  page.get_by_label("Password").fill("secret")
667
669
  ```
668
670
 
@@ -1256,7 +1258,13 @@ To remove a route with its handler you can use [Page#unroute](./page#unroute).
1256
1258
  ## route_from_har
1257
1259
 
1258
1260
  ```
1259
- def route_from_har(har, notFound: nil, update: nil, url: nil)
1261
+ def route_from_har(
1262
+ har,
1263
+ notFound: nil,
1264
+ update: nil,
1265
+ updateContent: nil,
1266
+ updateMode: nil,
1267
+ url: nil)
1260
1268
  ```
1261
1269
 
1262
1270
 
@@ -44,7 +44,7 @@ context.tracing.stop(path: 'trace.zip')
44
44
  ## start_chunk
45
45
 
46
46
  ```
47
- def start_chunk(title: nil)
47
+ def start_chunk(name: nil, title: nil)
48
48
  ```
49
49
 
50
50
 
@@ -67,6 +67,7 @@ module Playwright
67
67
 
68
68
  private def build_metadata_payload_from(api_name, stacks)
69
69
  {
70
+ wallTime: (Time.now.to_f * 1000).to_i,
70
71
  apiName: api_name,
71
72
  stack: stacks.map do |loc|
72
73
  { file: loc.absolute_path || '', line: loc.lineno, function: loc.label }
@@ -32,10 +32,7 @@ module Playwright
32
32
 
33
33
  resp = @channel.send_message_to_server('newContext', params.compact)
34
34
  context = ChannelOwners::BrowserContext.from(resp)
35
- @contexts << context
36
- context.browser = self
37
- context.options = params
38
- context.send(:update_browser_type, @browser_type)
35
+ @browser_type.send(:did_create_context, context, params)
39
36
  return context unless block
40
37
 
41
38
  begin
@@ -62,9 +59,6 @@ module Playwright
62
59
 
63
60
  private def update_browser_type(browser_type)
64
61
  @browser_type = browser_type
65
- @contexts.each do |context|
66
- context.send(:update_browser_type, browser_type)
67
- end
68
62
  end
69
63
 
70
64
  def close
@@ -110,7 +104,7 @@ module Playwright
110
104
  @closed_or_closing = true
111
105
  end
112
106
 
113
- # called from BrowserType#connectOverCDP
107
+ # called from BrowserContext#initialize, BrowserType#connectOverCDP
114
108
  private def add_context(context)
115
109
  @contexts << context
116
110
  end
@@ -9,6 +9,10 @@ module Playwright
9
9
  attr_reader :tracing, :request
10
10
 
11
11
  private def after_initialize
12
+ if @parent.is_a?(ChannelOwners::Browser)
13
+ @browser = @parent
14
+ @browser.send(:add_context, self)
15
+ end
12
16
  @pages = Set.new
13
17
  @routes = []
14
18
  @bindings = {}
@@ -62,14 +66,15 @@ module Playwright
62
66
  @closed_promise = Concurrent::Promises.resolvable_future
63
67
  end
64
68
 
65
- private def update_browser_type(browser_type)
66
- @browser_type = browser_type
69
+ private def update_options(context_options:, browser_options:)
70
+ @options = context_options
67
71
  if @options[:recordHar]
68
72
  @har_recorders[''] = {
69
73
  path: @options[:recordHar][:path],
70
74
  content: @options[:recordHar][:content]
71
75
  }
72
76
  end
77
+ @tracing.send(:update_traces_dir, browser_options[:tracesDir])
73
78
  end
74
79
 
75
80
  private def on_page(page)
@@ -290,12 +295,12 @@ module Playwright
290
295
  update_interception_patterns
291
296
  end
292
297
 
293
- private def record_into_har(har, page, notFound:, url:)
298
+ private def record_into_har(har, page, notFound:, url:, updateContent:, updateMode:)
294
299
  params = {
295
300
  options: prepare_record_har_options(
296
301
  record_har_path: har,
297
- record_har_content: "attach",
298
- record_har_mode: "minimal",
302
+ record_har_content: updateContent || 'attach',
303
+ record_har_mode: updateMode || 'minimal',
299
304
  record_har_url_filter: url,
300
305
  )
301
306
  }
@@ -306,9 +311,9 @@ module Playwright
306
311
  @har_recorders[har_id] = { path: har, content: 'attach' }
307
312
  end
308
313
 
309
- def route_from_har(har, notFound: nil, update: nil, url: nil)
314
+ def route_from_har(har, notFound: nil, update: nil, updateContent: nil, updateMode: nil, url: nil)
310
315
  if update
311
- record_into_har(har, nil, notFound: notFound, url: url)
316
+ record_into_har(har, nil, notFound: notFound, url: url, updateContent: updateContent, updateMode: updateMode)
312
317
  return
313
318
  end
314
319
 
@@ -13,7 +13,7 @@ module Playwright
13
13
  def launch(options, &block)
14
14
  resp = @channel.send_message_to_server('launch', options.compact)
15
15
  browser = ChannelOwners::Browser.from(resp)
16
- browser.send(:update_browser_type, self)
16
+ did_launch_browser(browser)
17
17
  return browser unless block
18
18
 
19
19
  begin
@@ -30,8 +30,7 @@ module Playwright
30
30
 
31
31
  resp = @channel.send_message_to_server('launchPersistentContext', params.compact)
32
32
  context = ChannelOwners::Browser.from(resp)
33
- context.options = params
34
- context.send(:update_browser_type, self)
33
+ did_create_context(context, params, params)
35
34
  return context unless block
36
35
 
37
36
  begin
@@ -57,11 +56,11 @@ module Playwright
57
56
 
58
57
  result = @channel.send_message_to_server_result('connectOverCDP', params)
59
58
  browser = ChannelOwners::Browser.from(result['browser'])
60
- browser.send(:update_browser_type, self)
59
+ did_launch_browser(browser)
61
60
 
62
61
  if result['defaultContext']
63
- context = ChannelOwners::BrowserContext.from(result['defaultContext'])
64
- browser.send(:add_context, context)
62
+ default_context = ChannelOwners::BrowserContext.from(result['defaultContext'])
63
+ did_create_context(default_context)
65
64
  end
66
65
 
67
66
  if block
@@ -74,5 +73,13 @@ module Playwright
74
73
  browser
75
74
  end
76
75
  end
76
+
77
+ private def did_create_context(context, context_options = {}, browser_options = {})
78
+ context.send(:update_options, context_options: context_options, browser_options: browser_options)
79
+ end
80
+
81
+ private def did_launch_browser(browser)
82
+ browser.send(:update_browser_type, self)
83
+ end
77
84
  end
78
85
  end
@@ -1,12 +1,7 @@
1
1
  module Playwright
2
2
  define_channel_owner :LocalUtils do
3
3
  # @param zip_file [String]
4
- # @param name_value_array [Array<Hash<{name: string, value: string}>>]
5
- def zip(zip_file, name_value_array)
6
- params = {
7
- zipFile: zip_file,
8
- entries: name_value_array,
9
- }
4
+ def zip(params)
10
5
  @channel.send_message_to_server('zip', params)
11
6
  nil
12
7
  end
@@ -39,5 +34,22 @@ module Playwright
39
34
  def har_unzip(zip_file, har_file)
40
35
  @channel.send_message_to_server('harUnzip', zipFile: zip_file, harFile: har_file)
41
36
  end
37
+
38
+ def tracing_started(traces_dir, trace_name)
39
+ params = {
40
+ tracesDir: traces_dir,
41
+ traceName: trace_name,
42
+ }.compact
43
+ @channel.send_message_to_server('tracingStarted', params)
44
+ end
45
+
46
+ def tracing_discarded(stacks_id)
47
+ @channel.send_message_to_server('traceDiscarded', stacksId: stacks_id)
48
+ end
49
+
50
+ def add_stack_to_tracing_no_reply(id, stack)
51
+ @channel.async_send_message_to_server('addStackToTracingNoReply', callData: { id: id, stack: stack })
52
+ nil
53
+ end
42
54
  end
43
55
  end
@@ -417,9 +417,9 @@ module Playwright
417
417
  update_interception_patterns
418
418
  end
419
419
 
420
- def route_from_har(har, notFound: nil, update: nil, url: nil)
420
+ def route_from_har(har, notFound: nil, update: nil, url: nil, updateContent: nil, updateMode: nil)
421
421
  if update
422
- @browser_context.send(:record_into_har, har, self, notFound: notFound, url: url)
422
+ @browser_context.send(:record_into_har, har, self, notFound: notFound, url: url, updateContent: updateContent, updateMode: updateMode)
423
423
  return
424
424
  end
425
425
 
@@ -7,12 +7,23 @@ module Playwright
7
7
  snapshots: snapshots,
8
8
  sources: sources,
9
9
  }.compact
10
+ @include_sources = params[:sources] || false
10
11
  @channel.send_message_to_server('tracingStart', params)
11
- @channel.send_message_to_server('tracingStartChunk', { title: title }.compact)
12
+ trace_name = @channel.send_message_to_server('tracingStartChunk', { title: title, name: name }.compact)
13
+ start_collecting_stacks(trace_name)
12
14
  end
13
15
 
14
- def start_chunk(title: nil)
15
- @channel.send_message_to_server('tracingStartChunk', { title: title }.compact)
16
+ def start_chunk(title: nil, name: nil)
17
+ trace_name = @channel.send_message_to_server('tracingStartChunk', { title: title, name: name }.compact)
18
+ start_collecting_stacks(trace_name)
19
+ end
20
+
21
+ private def start_collecting_stacks(trace_name)
22
+ unless @is_tracing
23
+ @is_tracing = true
24
+ @connection.set_in_tracing(true)
25
+ end
26
+ @stacks_id = @connection.local_utils.tracing_started(@traces_dir, trace_name)
16
27
  end
17
28
 
18
29
  def stop_chunk(path: nil)
@@ -25,26 +36,61 @@ module Playwright
25
36
  end
26
37
 
27
38
  private def do_stop_chunk(file_path:)
28
- mode = 'doNotSave'
29
- if file_path
30
- if @connection.remote?
31
- mode = 'compressTrace'
32
- else
33
- mode = 'compressTraceAndSources'
39
+ if @is_tracing
40
+ @is_tracing = false
41
+ @connection.set_in_tracing(false)
42
+ end
43
+
44
+ unless file_path
45
+ # Not interested in any artifacts
46
+ @channel.send_message_to_server('tracingStopChunk', mode: 'discard')
47
+ if @stacks_id
48
+ @connection.local_utils.trace_discarded(@stacks_id)
34
49
  end
50
+
51
+ return
35
52
  end
36
53
 
37
- result = @channel.send_message_to_server_result('tracingStopChunk', mode: mode)
38
- return unless file_path # Not interested in artifacts.
39
- return unless result['artifact'] # The artifact may be missing if the browser closed while stopping tracing.
54
+ unless @connection.remote?
55
+ result = @channel.send_message_to_server_result('tracingStopChunk', mode: 'entries')
56
+ @connection.local_utils.zip(
57
+ zipFile: file_path,
58
+ entries: result['entries'],
59
+ stacksId: @stacks_id,
60
+ mode: 'write',
61
+ includeSources: @include_sources,
62
+ )
63
+
64
+ return
65
+ end
40
66
 
67
+
68
+ result = @channel.send_message_to_server_result('tracingStopChunk', mode: 'archive')
69
+ # The artifact may be missing if the browser closed while stopping tracing.
70
+ unless result['artifact']
71
+ if @stacks_id
72
+ @connection.local_utils.trace_discarded(@stacks_id)
73
+ end
74
+
75
+ return
76
+ end
77
+
78
+ # Save trace to the final local file.
41
79
  artifact = ChannelOwners::Artifact.from(result['artifact'])
42
80
  artifact.save_as(file_path)
43
81
  artifact.delete
44
82
 
45
- # // Add local sources to the remote trace if necessary.
46
- # if (result.sourceEntries?.length)
47
- # await this._context._localUtils.zip(filePath, result.sourceEntries);
83
+ @connection.local_utils.zip(
84
+ zipFile: file_path,
85
+ entries: [],
86
+ stacksId: @stacks_id,
87
+ mode: 'append',
88
+ includeSources: @include_sources,
89
+ )
90
+ end
91
+
92
+ private def update_traces_dir(traces_dir)
93
+ @traces_dir = traces_dir
48
94
  end
49
95
  end
50
96
  end
@@ -22,6 +22,7 @@ module Playwright
22
22
  @callbacks = {} # Hash [ guid => Promise<ChannelOwner> ]
23
23
  @root_object = RootChannelOwner.new(self)
24
24
  @remote = false
25
+ @tracing_count = 0
25
26
  end
26
27
 
27
28
  attr_reader :local_utils
@@ -50,6 +51,14 @@ module Playwright
50
51
  ChannelOwners::Playwright.from(result['playwright'])
51
52
  end
52
53
 
54
+ def set_in_tracing(value)
55
+ if value
56
+ @tracing_count += 1
57
+ else
58
+ @tracing_count -= 1
59
+ end
60
+ end
61
+
53
62
  def async_send_message_to_server(guid, method, params, metadata: nil)
54
63
  callback = Concurrent::Promises.resolvable_future
55
64
 
@@ -58,12 +67,21 @@ module Playwright
58
67
  # @see https://github.com/YusukeIwaki/puppeteer-ruby/pull/34
59
68
  @callbacks[id] = callback
60
69
 
70
+ _metadata = {}
71
+ if metadata
72
+ _metadata[:wallTime] = metadata[:wallTime]
73
+ _metadata[:apiName] = metadata[:apiName]
74
+ _metadata[:location] = metadata[:stack].first
75
+ _metadata[:internal] = !metadata[:apiName]
76
+ end
77
+ _metadata.compact!
78
+
61
79
  message = {
62
80
  id: id,
63
81
  guid: guid,
64
82
  method: method,
65
83
  params: replace_channels_with_guids(params),
66
- metadata: metadata || {},
84
+ metadata: _metadata,
67
85
  }
68
86
 
69
87
  begin
@@ -73,6 +91,10 @@ module Playwright
73
91
  callback.reject(err)
74
92
  raise unless err.is_a?(Transport::AlreadyDisconnectedError)
75
93
  end
94
+
95
+ if @tracing_count > 0 && !metadata[:stack].empty? && guid != 'localUtils'
96
+ @local_utils.add_stack_to_tracing_no_reply(id, metadata[:stack])
97
+ end
76
98
  end
77
99
 
78
100
  callback
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Playwright
4
- VERSION = '1.31.1'
5
- COMPATIBLE_PLAYWRIGHT_VERSION = '1.31.1'
4
+ VERSION = '1.32.0'
5
+ COMPATIBLE_PLAYWRIGHT_VERSION = '1.32.2'
6
6
  end
data/lib/playwright.rb CHANGED
@@ -159,8 +159,8 @@ module Playwright
159
159
  begin
160
160
  playwright = connection.initialize_playwright
161
161
  browser = playwright.send(:pre_launched_browser)
162
+ browser.browser_type.send(:did_launch_browser, browser)
162
163
  browser.should_close_connection_on_close!
163
- browser.send(:update_browser_type, browser.browser_type)
164
164
  Execution.new(connection, PlaywrightApi.wrap(playwright), PlaywrightApi.wrap(browser))
165
165
  rescue
166
166
  connection.stop
@@ -194,13 +194,13 @@ module Playwright
194
194
  end
195
195
 
196
196
  # @nodoc
197
- def should_close_connection_on_close!
198
- wrap_impl(@impl.should_close_connection_on_close!)
197
+ def tap_on(selector, duration: nil, timeout: nil)
198
+ wrap_impl(@impl.tap_on(unwrap_impl(selector), duration: unwrap_impl(duration), timeout: unwrap_impl(timeout)))
199
199
  end
200
200
 
201
201
  # @nodoc
202
- def tap_on(selector, duration: nil, timeout: nil)
203
- wrap_impl(@impl.tap_on(unwrap_impl(selector), duration: unwrap_impl(duration), timeout: unwrap_impl(timeout)))
202
+ def should_close_connection_on_close!
203
+ wrap_impl(@impl.should_close_connection_on_close!)
204
204
  end
205
205
 
206
206
  # -- inherited from EventEmitter --
@@ -302,8 +302,14 @@ module Playwright
302
302
  # If specified the network requests that are made in the context will be served from the HAR file. Read more about [Replaying from HAR](../network.md#replaying-from-har).
303
303
  #
304
304
  # Playwright will not serve requests intercepted by Service Worker from the HAR file. See [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using request interception by setting `Browser.newContext.serviceWorkers` to `'block'`.
305
- def route_from_har(har, notFound: nil, update: nil, url: nil)
306
- wrap_impl(@impl.route_from_har(unwrap_impl(har), notFound: unwrap_impl(notFound), update: unwrap_impl(update), url: unwrap_impl(url)))
305
+ def route_from_har(
306
+ har,
307
+ notFound: nil,
308
+ update: nil,
309
+ updateContent: nil,
310
+ updateMode: nil,
311
+ url: nil)
312
+ wrap_impl(@impl.route_from_har(unwrap_impl(har), notFound: unwrap_impl(notFound), update: unwrap_impl(update), updateContent: unwrap_impl(updateContent), updateMode: unwrap_impl(updateMode), url: unwrap_impl(url)))
307
313
  end
308
314
 
309
315
  #
@@ -428,11 +434,6 @@ module Playwright
428
434
  wrap_impl(@impl.options=(unwrap_impl(req)))
429
435
  end
430
436
 
431
- # @nodoc
432
- def browser=(req)
433
- wrap_impl(@impl.browser=(unwrap_impl(req)))
434
- end
435
-
436
437
  # @nodoc
437
438
  def owner_page=(req)
438
439
  wrap_impl(@impl.owner_page=(unwrap_impl(req)))
@@ -443,6 +444,11 @@ module Playwright
443
444
  wrap_impl(@impl.enable_debug_console!)
444
445
  end
445
446
 
447
+ # @nodoc
448
+ def browser=(req)
449
+ wrap_impl(@impl.browser=(unwrap_impl(req)))
450
+ end
451
+
446
452
  # -- inherited from EventEmitter --
447
453
  # @nodoc
448
454
  def off(event, callback)
@@ -378,18 +378,20 @@ module Playwright
378
378
  end
379
379
 
380
380
  #
381
- # Allows locating input elements by the text of the associated label.
381
+ # Allows locating input elements by the text of the associated `<label>` or `aria-labelledby` element, or by the `aria-label` attribute.
382
382
  #
383
383
  # **Usage**
384
384
  #
385
- # For example, this method will find the input by label text "Password" in the following DOM:
385
+ # For example, this method will find inputs by label "Username" and "Password" in the following DOM:
386
386
  #
387
387
  # ```html
388
+ # <input aria-label="Username">
388
389
  # <label for="password-input">Password:</label>
389
390
  # <input id="password-input">
390
391
  # ```
391
392
  #
392
393
  # ```python sync
394
+ # page.get_by_label("Username").fill("john")
393
395
  # page.get_by_label("Password").fill("secret")
394
396
  # ```
395
397
  def get_by_label(text, exact: nil)
@@ -1031,13 +1033,13 @@ module Playwright
1031
1033
  end
1032
1034
 
1033
1035
  # @nodoc
1034
- def detached=(req)
1035
- wrap_impl(@impl.detached=(unwrap_impl(req)))
1036
+ def highlight(selector)
1037
+ wrap_impl(@impl.highlight(unwrap_impl(selector)))
1036
1038
  end
1037
1039
 
1038
1040
  # @nodoc
1039
- def highlight(selector)
1040
- wrap_impl(@impl.highlight(unwrap_impl(selector)))
1041
+ def detached=(req)
1042
+ wrap_impl(@impl.detached=(unwrap_impl(req)))
1041
1043
  end
1042
1044
 
1043
1045
  # -- inherited from EventEmitter --
@@ -60,18 +60,20 @@ module Playwright
60
60
  end
61
61
 
62
62
  #
63
- # Allows locating input elements by the text of the associated label.
63
+ # Allows locating input elements by the text of the associated `<label>` or `aria-labelledby` element, or by the `aria-label` attribute.
64
64
  #
65
65
  # **Usage**
66
66
  #
67
- # For example, this method will find the input by label text "Password" in the following DOM:
67
+ # For example, this method will find inputs by label "Username" and "Password" in the following DOM:
68
68
  #
69
69
  # ```html
70
+ # <input aria-label="Username">
70
71
  # <label for="password-input">Password:</label>
71
72
  # <input id="password-input">
72
73
  # ```
73
74
  #
74
75
  # ```python sync
76
+ # page.get_by_label("Username").fill("john")
75
77
  # page.get_by_label("Password").fill("secret")
76
78
  # ```
77
79
  def get_by_label(text, exact: nil)
@@ -239,8 +241,8 @@ module Playwright
239
241
  # The method finds an element matching the specified selector in the locator's subtree. It also accepts filter options, similar to [`method: Locator.filter`] method.
240
242
  #
241
243
  # [Learn more about locators](../locators.md).
242
- def locator(selector, has: nil, hasText: nil)
243
- wrap_impl(@impl.locator(unwrap_impl(selector), has: unwrap_impl(has), hasText: unwrap_impl(hasText)))
244
+ def locator(selectorOrLocator, has: nil, hasText: nil)
245
+ wrap_impl(@impl.locator(unwrap_impl(selectorOrLocator), has: unwrap_impl(has), hasText: unwrap_impl(hasText)))
244
246
  end
245
247
 
246
248
  #
@@ -10,6 +10,8 @@ module Playwright
10
10
  # When locator points to a list of elements, returns array of locators, pointing
11
11
  # to respective elements.
12
12
  #
13
+ # Note that [`method: Locator.all`] does not wait for elements to match the locator, and instead immediately returns whatever is present in the page. To avoid flakiness when elements are loaded dynamically, wait for the loading to finish before calling [`method: Locator.all`].
14
+ #
13
15
  # **Usage**
14
16
  #
15
17
  # ```python sync
@@ -447,18 +449,20 @@ module Playwright
447
449
  end
448
450
 
449
451
  #
450
- # Allows locating input elements by the text of the associated label.
452
+ # Allows locating input elements by the text of the associated `<label>` or `aria-labelledby` element, or by the `aria-label` attribute.
451
453
  #
452
454
  # **Usage**
453
455
  #
454
- # For example, this method will find the input by label text "Password" in the following DOM:
456
+ # For example, this method will find inputs by label "Username" and "Password" in the following DOM:
455
457
  #
456
458
  # ```html
459
+ # <input aria-label="Username">
457
460
  # <label for="password-input">Password:</label>
458
461
  # <input id="password-input">
459
462
  # ```
460
463
  #
461
464
  # ```python sync
465
+ # page.get_by_label("Username").fill("john")
462
466
  # page.get_by_label("Password").fill("secret")
463
467
  # ```
464
468
  def get_by_label(text, exact: nil)
@@ -769,8 +773,8 @@ module Playwright
769
773
  # The method finds an element matching the specified selector in the locator's subtree. It also accepts filter options, similar to [`method: Locator.filter`] method.
770
774
  #
771
775
  # [Learn more about locators](../locators.md).
772
- def locator(selector, has: nil, hasText: nil)
773
- wrap_impl(@impl.locator(unwrap_impl(selector), has: unwrap_impl(has), hasText: unwrap_impl(hasText)))
776
+ def locator(selectorOrLocator, has: nil, hasText: nil)
777
+ wrap_impl(@impl.locator(unwrap_impl(selectorOrLocator), has: unwrap_impl(has), hasText: unwrap_impl(hasText)))
774
778
  end
775
779
 
776
780
  #
@@ -614,18 +614,20 @@ module Playwright
614
614
  end
615
615
 
616
616
  #
617
- # Allows locating input elements by the text of the associated label.
617
+ # Allows locating input elements by the text of the associated `<label>` or `aria-labelledby` element, or by the `aria-label` attribute.
618
618
  #
619
619
  # **Usage**
620
620
  #
621
- # For example, this method will find the input by label text "Password" in the following DOM:
621
+ # For example, this method will find inputs by label "Username" and "Password" in the following DOM:
622
622
  #
623
623
  # ```html
624
+ # <input aria-label="Username">
624
625
  # <label for="password-input">Password:</label>
625
626
  # <input id="password-input">
626
627
  # ```
627
628
  #
628
629
  # ```python sync
630
+ # page.get_by_label("Username").fill("john")
629
631
  # page.get_by_label("Password").fill("secret")
630
632
  # ```
631
633
  def get_by_label(text, exact: nil)
@@ -1129,8 +1131,14 @@ module Playwright
1129
1131
  # If specified the network requests that are made in the page will be served from the HAR file. Read more about [Replaying from HAR](../network.md#replaying-from-har).
1130
1132
  #
1131
1133
  # Playwright will not serve requests intercepted by Service Worker from the HAR file. See [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using request interception by setting `Browser.newContext.serviceWorkers` to `'block'`.
1132
- def route_from_har(har, notFound: nil, update: nil, url: nil)
1133
- wrap_impl(@impl.route_from_har(unwrap_impl(har), notFound: unwrap_impl(notFound), update: unwrap_impl(update), url: unwrap_impl(url)))
1134
+ def route_from_har(
1135
+ har,
1136
+ notFound: nil,
1137
+ update: nil,
1138
+ updateContent: nil,
1139
+ updateMode: nil,
1140
+ url: nil)
1141
+ wrap_impl(@impl.route_from_har(unwrap_impl(har), notFound: unwrap_impl(notFound), update: unwrap_impl(update), updateContent: unwrap_impl(updateContent), updateMode: unwrap_impl(updateMode), url: unwrap_impl(url)))
1134
1142
  end
1135
1143
 
1136
1144
  #
@@ -179,13 +179,13 @@ module Playwright
179
179
  end
180
180
 
181
181
  # @nodoc
182
- def header_values(name)
183
- wrap_impl(@impl.header_values(unwrap_impl(name)))
182
+ def apply_fallback_overrides(overrides)
183
+ wrap_impl(@impl.apply_fallback_overrides(unwrap_impl(overrides)))
184
184
  end
185
185
 
186
186
  # @nodoc
187
- def apply_fallback_overrides(overrides)
188
- wrap_impl(@impl.apply_fallback_overrides(unwrap_impl(overrides)))
187
+ def header_values(name)
188
+ wrap_impl(@impl.header_values(unwrap_impl(name)))
189
189
  end
190
190
 
191
191
  # -- inherited from EventEmitter --
@@ -54,8 +54,8 @@ module Playwright
54
54
  # # Save a second trace file with different actions.
55
55
  # context.tracing.stop_chunk(path = "trace2.zip")
56
56
  # ```
57
- def start_chunk(title: nil)
58
- wrap_impl(@impl.start_chunk(title: unwrap_impl(title)))
57
+ def start_chunk(name: nil, title: nil)
58
+ wrap_impl(@impl.start_chunk(name: unwrap_impl(name), title: unwrap_impl(title)))
59
59
  end
60
60
 
61
61
  #
data/sig/playwright.rbs CHANGED
@@ -303,7 +303,7 @@ module Playwright
303
303
  def query_selector_all: (String selector) -> Array[untyped]
304
304
  def reload: (?timeout: Float, ?waitUntil: ("load" | "domcontentloaded" | "networkidle" | "commit")) -> (nil | Response)
305
305
  def route: ((String | Regexp | function) url, function handler, ?times: Integer) -> void
306
- def route_from_har: ((String | File) har, ?notFound: ("abort" | "fallback"), ?update: bool, ?url: (String | Regexp)) -> void
306
+ def route_from_har: ((String | File) har, ?notFound: ("abort" | "fallback"), ?update: bool, ?updateContent: ("embed" | "attach"), ?updateMode: ("full" | "minimal"), ?url: (String | Regexp)) -> void
307
307
  def screenshot: (?animations: ("disabled" | "allow"), ?caret: ("hide" | "initial"), ?clip: Hash[untyped, untyped], ?fullPage: bool, ?mask: Array[untyped], ?omitBackground: bool, ?path: (String | File), ?quality: Integer, ?scale: ("css" | "device"), ?timeout: Float, ?type: ("png" | "jpeg")) -> String
308
308
  def select_option: (String selector, ?element: (ElementHandle | Array[untyped]), ?index: (Integer | Array[untyped]), ?value: (String | Array[untyped]), ?label: (String | Array[untyped]), ?force: bool, ?noWaitAfter: bool, ?strict: bool, ?timeout: Float) -> Array[untyped]
309
309
  def set_checked: (String selector, bool checked, ?force: bool, ?noWaitAfter: bool, ?position: Hash[untyped, untyped], ?strict: bool, ?timeout: Float, ?trial: bool) -> void
@@ -368,7 +368,7 @@ module Playwright
368
368
  def new_page: () ?{ (Page) -> untyped } -> Page
369
369
  def pages: -> Array[untyped]
370
370
  def route: ((String | Regexp | function) url, function handler, ?times: Integer) -> void
371
- def route_from_har: ((String | File) har, ?notFound: ("abort" | "fallback"), ?update: bool, ?url: (String | Regexp)) -> void
371
+ def route_from_har: ((String | File) har, ?notFound: ("abort" | "fallback"), ?update: bool, ?updateContent: ("embed" | "attach"), ?updateMode: ("full" | "minimal"), ?url: (String | Regexp)) -> void
372
372
  def service_workers: -> Array[untyped]
373
373
  def set_default_navigation_timeout: (Float timeout) -> void
374
374
  def default_navigation_timeout=: (Float timeout) -> void
@@ -425,7 +425,7 @@ module Playwright
425
425
 
426
426
  class Tracing
427
427
  def start: (?name: String, ?screenshots: bool, ?snapshots: bool, ?sources: bool, ?title: String) -> void
428
- def start_chunk: (?title: String) -> void
428
+ def start_chunk: (?name: String, ?title: String) -> void
429
429
  def stop: (?path: (String | File)) -> void
430
430
  def stop_chunk: (?path: (String | File)) -> void
431
431
  end
@@ -474,7 +474,7 @@ module Playwright
474
474
  def hidden?: (?timeout: Float) -> bool
475
475
  def visible?: (?timeout: Float) -> bool
476
476
  def last: -> Locator
477
- def locator: (String selector, ?has: Locator, ?hasText: (String | Regexp)) -> Locator
477
+ def locator: ((String | Locator) selectorOrLocator, ?has: Locator, ?hasText: (String | Regexp)) -> Locator
478
478
  def nth: (Integer index) -> Locator
479
479
  def page: -> Page
480
480
  def press: (String key, ?delay: Float, ?noWaitAfter: bool, ?timeout: Float) -> void
@@ -504,7 +504,7 @@ module Playwright
504
504
  def get_by_text: ((String | Regexp) text, ?exact: bool) -> Locator
505
505
  def get_by_title: ((String | Regexp) text, ?exact: bool) -> Locator
506
506
  def last: -> FrameLocator
507
- def locator: (String selector, ?has: Locator, ?hasText: (String | Regexp)) -> Locator
507
+ def locator: ((String | Locator) selectorOrLocator, ?has: Locator, ?hasText: (String | Regexp)) -> Locator
508
508
  def nth: (Integer index) -> FrameLocator
509
509
  end
510
510
 
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.31.1
4
+ version: 1.32.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - YusukeIwaki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-04 00:00:00.000000000 Z
11
+ date: 2023-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -401,5 +401,5 @@ requirements: []
401
401
  rubygems_version: 3.3.26
402
402
  signing_key:
403
403
  specification_version: 4
404
- summary: The Ruby binding of playwright driver 1.31.1
404
+ summary: The Ruby binding of playwright driver 1.32.2
405
405
  test_files: []