playwright-ruby-client 1.36.0 → 1.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/documentation/docs/api/browser_context.md +1 -1
- data/documentation/docs/api/frame.md +1 -0
- data/documentation/docs/api/locator.md +4 -3
- data/documentation/docs/api/page.md +2 -1
- data/lib/playwright/channel_owners/artifact.rb +7 -0
- data/lib/playwright/channel_owners/browser.rb +12 -3
- data/lib/playwright/channel_owners/stream.rb +19 -4
- data/lib/playwright/version.rb +2 -2
- data/lib/playwright_api/browser_context.rb +1 -1
- data/lib/playwright_api/browser_type.rb +6 -1
- data/lib/playwright_api/frame.rb +2 -0
- data/lib/playwright_api/locator.rb +4 -3
- data/lib/playwright_api/page.rb +3 -1
- data/lib/playwright_api/response.rb +4 -4
- data/lib/playwright_api/worker.rb +4 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72247024abd6cfc5a96eb203f8f1bcbbca18dafacb48e83802dd464ed93f7d21
|
4
|
+
data.tar.gz: 2496de7896c09b6395f5d4c958617cfb03111f0a111ef7e50acadf8a90069e53
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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/
|
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.
|
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/
|
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
|
-
|
98
|
-
|
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(_ = {})
|
@@ -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
|
-
|
8
|
-
|
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
|
data/lib/playwright/version.rb
CHANGED
@@ -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](../
|
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(
|
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
|
|
data/lib/playwright_api/frame.rb
CHANGED
@@ -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.
|
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
|
#
|
data/lib/playwright_api/page.rb
CHANGED
@@ -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](../
|
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
|
122
|
-
wrap_impl(@impl.
|
121
|
+
def ok?
|
122
|
+
wrap_impl(@impl.ok?)
|
123
123
|
end
|
124
124
|
|
125
125
|
# @nodoc
|
126
|
-
def
|
127
|
-
wrap_impl(@impl.
|
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
|
51
|
-
wrap_impl(@impl.
|
50
|
+
def page=(req)
|
51
|
+
wrap_impl(@impl.page=(unwrap_impl(req)))
|
52
52
|
end
|
53
53
|
|
54
54
|
# @nodoc
|
55
|
-
def
|
56
|
-
wrap_impl(@impl.
|
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.
|
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-
|
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.
|
404
|
+
summary: The Ruby binding of playwright driver 1.37.0
|
405
405
|
test_files: []
|