playwright-ruby-client 1.36.1 → 1.37.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: 1cc19f1c59e1531ea8cef976b3992b9770bb2003f6580bbe86ca6b3b0660610f
4
- data.tar.gz: 2e298d2a003093a4bf523992d54796605eea00f531b4d890415d3dc5b8ebd232
3
+ metadata.gz: 72247024abd6cfc5a96eb203f8f1bcbbca18dafacb48e83802dd464ed93f7d21
4
+ data.tar.gz: 2496de7896c09b6395f5d4c958617cfb03111f0a111ef7e50acadf8a90069e53
5
5
  SHA512:
6
- metadata.gz: bc1d1208314cf332e3e1a0f085c39c38f176c1b3a81d7d586d4603aa45969ba484cc2b42938f43994d9e7ee85bd2606b7aed76125eaf76079d6eb2c915f9edbe
7
- data.tar.gz: 93a116d228b3c517480ab16c013fc9d2fd830b0f45692f299f72b0f59158b3bf9eb2148ff92f67cff188bcd9e763b5b526adf834bd6da1c61938cd7f2ea20ce6
6
+ metadata.gz: c6e622cc2a84154728e92f524982cd5c5b62e82ce74c3c48e2806b168b9c828af3e864e99d9f4f880a394cfb9a0c911f4c9db10296fe78071038ef8fa609cb84
7
+ data.tar.gz: 41d756ca2590f37fffbc81fdb0306a76c06a462e1aa33aaad81e871aacc0e9d12fc6f2fb6df514f2a013fbc2afc82d1737100bfcf34f4ca4ef10c78502f2acf7
@@ -343,7 +343,7 @@ def route_from_har(
343
343
  ```
344
344
 
345
345
 
346
- If specified the network requests that are made in the context will be served from the HAR file. Read more about [Replaying from HAR](https://playwright.dev/python/docs/network#replaying-from-har).
346
+ If specified the network requests that are made in the context will be served from the HAR file. Read more about [Replaying from HAR](https://playwright.dev/python/docs/mock#replaying-from-har).
347
347
 
348
348
  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'`.
349
349
 
@@ -956,6 +956,7 @@ def set_content(html, timeout: nil, waitUntil: nil)
956
956
  alias: `content=`
957
957
 
958
958
 
959
+ This method internally calls [document.write()](https://developer.mozilla.org/en-US/docs/Web/API/Document/write), inheriting all its specific characteristics and behaviors.
959
960
 
960
961
  ## set_input_files
961
962
 
@@ -6,7 +6,7 @@ sidebar_position: 10
6
6
 
7
7
 
8
8
  Locators are the central piece of Playwright's auto-waiting and retry-ability. In a nutshell, locators represent
9
- a way to find element(s) on the page at any moment. Locator can be created with the [Page#locator](./page#locator) method.
9
+ a way to find element(s) on the page at any moment. A locator can be created with the [Page#locator](./page#locator) method.
10
10
 
11
11
  [Learn more about locators](https://playwright.dev/python/docs/locators).
12
12
 
@@ -17,8 +17,7 @@ def all
17
17
  ```
18
18
 
19
19
 
20
- When locator points to a list of elements, returns array of locators, pointing
21
- to respective elements.
20
+ When the locator points to a list of elements, this returns an array of locators, pointing to their respective elements.
22
21
 
23
22
  **NOTE**: [Locator#all](./locator#all) does not wait for elements to match the locator, and instead immediately returns whatever is present in the page.
24
23
 
@@ -1255,6 +1254,8 @@ def type(text, delay: nil, noWaitAfter: nil, timeout: nil)
1255
1254
  ```
1256
1255
 
1257
1256
 
1257
+ **NOTE**: In most cases, you should use [Locator#fill](./locator#fill) instead. You only need to type characters if there is special keyboard handling on the page.
1258
+
1258
1259
  Focuses the element, and then sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text.
1259
1260
 
1260
1261
  To press a special key, like `Control` or `ArrowDown`, use [Locator#press](./locator#press).
@@ -1273,7 +1273,7 @@ def route_from_har(
1273
1273
  ```
1274
1274
 
1275
1275
 
1276
- If specified the network requests that are made in the page will be served from the HAR file. Read more about [Replaying from HAR](https://playwright.dev/python/docs/network#replaying-from-har).
1276
+ If specified the network requests that are made in the page will be served from the HAR file. Read more about [Replaying from HAR](https://playwright.dev/python/docs/mock#replaying-from-har).
1277
1277
 
1278
1278
  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'`.
1279
1279
 
@@ -1369,6 +1369,7 @@ def set_content(html, timeout: nil, waitUntil: nil)
1369
1369
  alias: `content=`
1370
1370
 
1371
1371
 
1372
+ This method internally calls [document.write()](https://developer.mozilla.org/en-US/docs/Web/API/Document/write), inheriting all its specific characteristics and behaviors.
1372
1373
 
1373
1374
  ## set_default_navigation_timeout
1374
1375
 
@@ -1,3 +1,5 @@
1
+ require 'stringio'
2
+
1
3
  module Playwright
2
4
  define_channel_owner :Artifact do
3
5
  private def after_initialize
@@ -18,6 +20,11 @@ module Playwright
18
20
  stream.save_as(path)
19
21
  end
20
22
 
23
+ def read_into_buffer
24
+ stream = ChannelOwners::Stream.from(@channel.send_message_to_server('stream'))
25
+ stream.read_all
26
+ end
27
+
21
28
  def failure
22
29
  @channel.send_message_to_server('failure')
23
30
  end
@@ -1,3 +1,5 @@
1
+ require 'fileutils'
2
+
1
3
  module Playwright
2
4
  # @ref https://github.com/microsoft/playwright-python/blob/master/playwright/_impl/_browser.py
3
5
  define_channel_owner :Browser do
@@ -86,16 +88,23 @@ module Playwright
86
88
  params = {
87
89
  page: page&.channel,
88
90
  categories: categories,
89
- path: path,
90
91
  screenshots: screenshots,
91
92
  }.compact
93
+ @cr_tracing_path = path
92
94
 
93
95
  @channel.send_message_to_server('startTracing', params)
94
96
  end
95
97
 
96
98
  def stop_tracing
97
- encoded_binary = @channel.send_message_to_server("stopTracing")
98
- return Base64.strict_decode64(encoded_binary)
99
+ artifact = ChannelOwners::Artifact.from(@channel.send_message_to_server("stopTracing"))
100
+ data = artifact.read_into_buffer
101
+ if @cr_tracing_path
102
+ File.dirname(@cr_tracing_path).tap do |dir|
103
+ FileUtils.mkdir_p(dir) unless File.exist?(dir)
104
+ end
105
+ File.open(@cr_tracing_path, 'wb') { |f| f.write(data) }
106
+ end
107
+ data
99
108
  end
100
109
 
101
110
  private def on_close(_ = {})
@@ -43,7 +43,7 @@ module Playwright
43
43
  @channel.send_message_to_server('tracingStarted', params)
44
44
  end
45
45
 
46
- def trace_discarded(stacks_id)
46
+ def tracing_discarded(stacks_id)
47
47
  @channel.send_message_to_server('traceDiscarded', stacksId: stacks_id)
48
48
  end
49
49
 
@@ -4,12 +4,27 @@ module Playwright
4
4
  define_channel_owner :Stream do
5
5
  def save_as(path)
6
6
  File.open(path, 'wb') do |f|
7
- loop do
8
- binary = @channel.send_message_to_server('read')
9
- break if !binary || binary.length == 0
10
- f.write(Base64.strict_decode64(binary))
7
+ read_with_block do |chunk|
8
+ f.write(chunk)
11
9
  end
12
10
  end
13
11
  end
12
+
13
+ def read_all(&block)
14
+ out = StringIO.new
15
+ read_with_block do |chunk|
16
+ out.write(chunk)
17
+ end
18
+ out.string
19
+ end
20
+
21
+ private def read_with_block(&block)
22
+ loop do
23
+ binary = @channel.send_message_to_server('read', size: 1024 * 1024)
24
+ break if !binary || binary.length == 0
25
+ decoded_chunk = Base64.strict_decode64(binary)
26
+ block.call(decoded_chunk)
27
+ end
28
+ end
14
29
  end
15
30
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Playwright
4
- VERSION = '1.36.1'
5
- COMPATIBLE_PLAYWRIGHT_VERSION = '1.36.1'
4
+ VERSION = '1.37.0'
5
+ COMPATIBLE_PLAYWRIGHT_VERSION = '1.37.0'
6
6
  end
@@ -299,7 +299,7 @@ module Playwright
299
299
  end
300
300
 
301
301
  #
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).
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](../mock.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
305
  def route_from_har(
@@ -21,7 +21,12 @@ module Playwright
21
21
 
22
22
  #
23
23
  # This method attaches Playwright to an existing browser instance. When connecting to another browser launched via `BrowserType.launchServer` in Node.js, the major and minor version needs to match the client version (1.2.3 → is compatible with 1.2.x).
24
- def connect(wsEndpoint, headers: nil, slowMo: nil, timeout: nil)
24
+ def connect(
25
+ wsEndpoint,
26
+ exposeNetwork: nil,
27
+ headers: nil,
28
+ slowMo: nil,
29
+ timeout: nil)
25
30
  raise NotImplementedError.new('connect is not implemented yet.')
26
31
  end
27
32
 
@@ -802,6 +802,8 @@ module Playwright
802
802
  wrap_impl(@impl.set_checked(unwrap_impl(selector), unwrap_impl(checked), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
803
803
  end
804
804
 
805
+ #
806
+ # This method internally calls [document.write()](https://developer.mozilla.org/en-US/docs/Web/API/Document/write), inheriting all its specific characteristics and behaviors.
805
807
  def set_content(html, timeout: nil, waitUntil: nil)
806
808
  wrap_impl(@impl.set_content(unwrap_impl(html), timeout: unwrap_impl(timeout), waitUntil: unwrap_impl(waitUntil)))
807
809
  end
@@ -1,14 +1,13 @@
1
1
  module Playwright
2
2
  #
3
3
  # Locators are the central piece of Playwright's auto-waiting and retry-ability. In a nutshell, locators represent
4
- # a way to find element(s) on the page at any moment. Locator can be created with the [`method: Page.locator`] method.
4
+ # a way to find element(s) on the page at any moment. A locator can be created with the [`method: Page.locator`] method.
5
5
  #
6
6
  # [Learn more about locators](../locators.md).
7
7
  class Locator < PlaywrightApi
8
8
 
9
9
  #
10
- # When locator points to a list of elements, returns array of locators, pointing
11
- # to respective elements.
10
+ # When the locator points to a list of elements, this returns an array of locators, pointing to their respective elements.
12
11
  #
13
12
  # **NOTE**: [`method: Locator.all`] does not wait for elements to match the locator, and instead immediately returns whatever is present in the page.
14
13
  #
@@ -1067,6 +1066,8 @@ module Playwright
1067
1066
  wrap_impl(@impl.text_content(timeout: unwrap_impl(timeout)))
1068
1067
  end
1069
1068
 
1069
+ #
1070
+ # **NOTE**: In most cases, you should use [`method: Locator.fill`] instead. You only need to type characters if there is special keyboard handling on the page.
1070
1071
  #
1071
1072
  # Focuses the element, and then sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text.
1072
1073
  #
@@ -1133,7 +1133,7 @@ module Playwright
1133
1133
  end
1134
1134
 
1135
1135
  #
1136
- # 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).
1136
+ # If specified the network requests that are made in the page will be served from the HAR file. Read more about [Replaying from HAR](../mock.md#replaying-from-har).
1137
1137
  #
1138
1138
  # 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'`.
1139
1139
  def route_from_har(
@@ -1221,6 +1221,8 @@ module Playwright
1221
1221
  wrap_impl(@impl.set_checked(unwrap_impl(selector), unwrap_impl(checked), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), position: unwrap_impl(position), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
1222
1222
  end
1223
1223
 
1224
+ #
1225
+ # This method internally calls [document.write()](https://developer.mozilla.org/en-US/docs/Web/API/Document/write), inheriting all its specific characteristics and behaviors.
1224
1226
  def set_content(html, timeout: nil, waitUntil: nil)
1225
1227
  wrap_impl(@impl.set_content(unwrap_impl(html), timeout: unwrap_impl(timeout), waitUntil: unwrap_impl(waitUntil)))
1226
1228
  end
@@ -118,13 +118,13 @@ module Playwright
118
118
  end
119
119
 
120
120
  # @nodoc
121
- def from_service_worker?
122
- wrap_impl(@impl.from_service_worker?)
121
+ def ok?
122
+ wrap_impl(@impl.ok?)
123
123
  end
124
124
 
125
125
  # @nodoc
126
- def ok?
127
- wrap_impl(@impl.ok?)
126
+ def from_service_worker?
127
+ wrap_impl(@impl.from_service_worker?)
128
128
  end
129
129
 
130
130
  # -- inherited from EventEmitter --
@@ -47,13 +47,13 @@ module Playwright
47
47
  end
48
48
 
49
49
  # @nodoc
50
- def context=(req)
51
- wrap_impl(@impl.context=(unwrap_impl(req)))
50
+ def page=(req)
51
+ wrap_impl(@impl.page=(unwrap_impl(req)))
52
52
  end
53
53
 
54
54
  # @nodoc
55
- def page=(req)
56
- wrap_impl(@impl.page=(unwrap_impl(req)))
55
+ def context=(req)
56
+ wrap_impl(@impl.context=(unwrap_impl(req)))
57
57
  end
58
58
 
59
59
  # -- inherited from EventEmitter --
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.36.1
4
+ version: 1.37.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-08-16 00:00:00.000000000 Z
11
+ date: 2023-08-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.36.1
404
+ summary: The Ruby binding of playwright driver 1.37.0
405
405
  test_files: []