playwright-ruby-client 1.46.0 → 1.47.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: d4dfaaa01a0911c2ec833a1c484a0c4823e83fcc871b51aa9e1775b483d7dc4f
4
- data.tar.gz: 63c4c3f3b3965192380d8a54cfb2fe4010af6aef5dee5bf5b88e3a68407e638b
3
+ metadata.gz: 4ba01989399fc2a5a939b0471703384bafe37c0dda1e303dfb4f5c187d1e2f32
4
+ data.tar.gz: 98ab56b3079b654287aa4521b261745892222b699e696f016b90c09258796b1e
5
5
  SHA512:
6
- metadata.gz: 6708627d5d398fd5250d519000d2a11668bca206de9d99e52b4c560b38db41755165ead1382ef9c9996d8253a01628a2450960b6c0abc787dce5c346631c69a3
7
- data.tar.gz: 8c81aff0857d03e40f9397ec2735c1dfc5d93068831b35b0b15466d016968c318f6b3c2f7d556470bd3cc0d274befcdfa9eb880d482cea11cef1bd91c62ef94d
6
+ metadata.gz: 24d8ef9d5fb812b46494ebdec1adf2412e7a129368ea1b6e58883e73f028af1b2912e8a14a56e204a5d01c094a75c9e812b2a7df9fc42a3039f736ca267389a9
7
+ data.tar.gz: fdcd1a66ec8a5db98e094126e3bfde6c0d0c43aae68c56926f8779ebab4d394cb4715f66bb69c7b37e21c0daea4cf1c92723123e9263342b42a6b6721052c52e
@@ -54,7 +54,7 @@ def headers_array
54
54
  ```
55
55
 
56
56
 
57
- An array with all the request HTTP headers associated with this response. Header names are not lower-cased.
57
+ An array with all the response HTTP headers associated with this response. Header names are not lower-cased.
58
58
  Headers with multiple entries, such as `Set-Cookie`, appear in the array multiple times.
59
59
 
60
60
  ## json
@@ -4,7 +4,6 @@ sidebar_position: 10
4
4
 
5
5
  # Browser
6
6
 
7
- - extends: [EventEmitter]
8
7
 
9
8
  A Browser is created via [BrowserType#launch](./browser_type#launch). An example of using a [Browser](./browser) to create a [Page](./page):
10
9
 
@@ -4,14 +4,13 @@ sidebar_position: 10
4
4
 
5
5
  # BrowserContext
6
6
 
7
- - extends: [EventEmitter]
8
7
 
9
8
  BrowserContexts provide a way to operate multiple independent browser sessions.
10
9
 
11
10
  If a page opens another page, e.g. with a `window.open` call, the popup will belong to the parent page's browser
12
11
  context.
13
12
 
14
- Playwright allows creating "incognito" browser contexts with [Browser#new_context](./browser#new_context) method. "Incognito" browser
13
+ Playwright allows creating isolated non-persistent browser contexts with [Browser#new_context](./browser#new_context) method. Non-persistent browser
15
14
  contexts don't write any browsing data to disk.
16
15
 
17
16
  ```ruby
@@ -4,7 +4,6 @@ sidebar_position: 10
4
4
 
5
5
  # CDPSession
6
6
 
7
- - extends: [EventEmitter]
8
7
 
9
8
  The [CDPSession](./cdp_session) instances are used to talk raw Chrome Devtools Protocol:
10
9
  - protocol methods can be called with `session.send_message` method.
@@ -4,7 +4,6 @@ sidebar_position: 10
4
4
 
5
5
  # Page
6
6
 
7
- - extends: [EventEmitter]
8
7
 
9
8
  Page provides methods to interact with a single tab in a [Browser](./browser), or an
10
9
  [extension background page](https://developer.chrome.com/extensions/background_pages) in Chromium. One [Browser](./browser)
@@ -26,7 +26,7 @@ def continue(headers: nil, method: nil, postData: nil, url: nil)
26
26
  ```
27
27
 
28
28
 
29
- Continues route's request with optional overrides.
29
+ Sends route's request to the network with optional overrides.
30
30
 
31
31
  **Usage**
32
32
 
@@ -47,6 +47,8 @@ page.route("**/*", method(:handle))
47
47
 
48
48
  Note that any overrides such as `url` or `headers` only apply to the request being routed. If this request results in a redirect, overrides will not be applied to the new redirected request. If you want to propagate a header through redirects, use the combination of [Route#fetch](./route#fetch) and [Route#fulfill](./route#fulfill) instead.
49
49
 
50
+ [Route#continue](./route#continue) will immediately send the request to the network, other matching handlers won't be invoked. Use [Route#fallback](./route#fallback) If you want next matching handler in the chain to be invoked.
51
+
50
52
  ## fallback
51
53
 
52
54
  ```
@@ -54,13 +56,15 @@ def fallback(headers: nil, method: nil, postData: nil, url: nil)
54
56
  ```
55
57
 
56
58
 
59
+ Continues route's request with optional overrides. The method is similar to [Route#continue](./route#continue) with the difference that other matching handlers will be invoked before sending the request.
60
+
61
+ **Usage**
62
+
57
63
  When several routes match the given pattern, they run in the order opposite to their registration.
58
64
  That way the last registered route can always override all the previous ones. In the example below,
59
65
  request will be handled by the bottom-most handler first, then it'll fall back to the previous one and
60
66
  in the end will be aborted by the first registered route.
61
67
 
62
- **Usage**
63
-
64
68
  ```ruby
65
69
  page.route("**/*", -> (route,_) { route.abort }) # Runs last.
66
70
  page.route("**/*", -> (route,_) { route.fallback }) # Runs second.
@@ -114,6 +118,8 @@ end
114
118
  page.route("**/*", method(:handle))
115
119
  ```
116
120
 
121
+ Use [Route#continue](./route#continue) to immediately send the request to the network, other matching handlers won't be invoked in that case.
122
+
117
123
  ## fetch
118
124
 
119
125
  ```
@@ -37,7 +37,7 @@ The previous example uses [Dir#mktmpdir](https://docs.ruby-lang.org/ja/latest/me
37
37
 
38
38
  ## Getting video path and recorded video
39
39
 
40
- This is really confising for beginners, but in Playwright
40
+ This is really confusing for beginners, but in Playwright
41
41
 
42
42
  * We can get the video path **only when page is alive (before calling BrowserContext#close or Page#close)**
43
43
  * We can acquire the completely saved video **only after calling BrowserContext#close**
@@ -1,4 +1,5 @@
1
1
  require 'base64'
2
+ require 'cgi'
2
3
 
3
4
  module Playwright
4
5
  define_channel_owner :APIRequestContext do
@@ -112,7 +113,7 @@ module Playwright
112
113
  headers_obj = headers || request&.headers
113
114
  fetch_params = {
114
115
  url: url || request.url,
115
- params: object_to_array(params),
116
+ params: map_params_to_array(params),
116
117
  method: method || request&.method || 'GET',
117
118
  headers: headers_obj ? HttpHeaders.new(headers_obj).as_serialized : nil,
118
119
  }
@@ -179,6 +180,27 @@ module Playwright
179
180
  }
180
181
  end
181
182
 
183
+ private def map_params_to_array(params)
184
+ if params.is_a?(String)
185
+ unless params.start_with?('?')
186
+ raise ArgumentError.new("Query string must start with '?'")
187
+ end
188
+ query_string_to_array(params[1..-1])
189
+ else
190
+ object_to_array(params)
191
+ end
192
+ end
193
+
194
+ private def query_string_to_array(query_string)
195
+ params = CGI.parse(query_string)
196
+
197
+ params.map do |key, values|
198
+ values.map do |value|
199
+ { name: key, value: value }
200
+ end
201
+ end.flatten
202
+ end
203
+
182
204
  private def object_to_array(hash)
183
205
  hash&.map do |key, value|
184
206
  { name: key, value: value.to_s }
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Playwright
4
- VERSION = '1.46.0'
5
- COMPATIBLE_PLAYWRIGHT_VERSION = '1.46.1'
4
+ VERSION = '1.47.0'
5
+ COMPATIBLE_PLAYWRIGHT_VERSION = '1.47.1'
6
6
  end
@@ -35,7 +35,7 @@ module Playwright
35
35
  end
36
36
 
37
37
  #
38
- # An array with all the request HTTP headers associated with this response. Header names are not lower-cased.
38
+ # An array with all the response HTTP headers associated with this response. Header names are not lower-cased.
39
39
  # Headers with multiple entries, such as `Set-Cookie`, appear in the array multiple times.
40
40
  def headers_array
41
41
  wrap_impl(@impl.headers_array)
@@ -1,5 +1,4 @@
1
1
  module Playwright
2
- # - extends: [EventEmitter]
3
2
  #
4
3
  # A Browser is created via [`method: BrowserType.launch`]. An example of using a `Browser` to create a `Page`:
5
4
  #
@@ -1,12 +1,11 @@
1
1
  module Playwright
2
- # - extends: [EventEmitter]
3
2
  #
4
3
  # BrowserContexts provide a way to operate multiple independent browser sessions.
5
4
  #
6
5
  # If a page opens another page, e.g. with a `window.open` call, the popup will belong to the parent page's browser
7
6
  # context.
8
7
  #
9
- # Playwright allows creating "incognito" browser contexts with [`method: Browser.newContext`] method. "Incognito" browser
8
+ # Playwright allows creating isolated non-persistent browser contexts with [`method: Browser.newContext`] method. Non-persistent browser
10
9
  # contexts don't write any browsing data to disk.
11
10
  #
12
11
  # ```python sync
@@ -1,5 +1,4 @@
1
1
  module Playwright
2
- # - extends: [EventEmitter]
3
2
  #
4
3
  # The `CDPSession` instances are used to talk raw Chrome Devtools Protocol:
5
4
  # - protocol methods can be called with `session.send` method.
@@ -1,5 +1,4 @@
1
1
  module Playwright
2
- # - extends: [EventEmitter]
3
2
  #
4
3
  # Page provides methods to interact with a single tab in a `Browser`, or an
5
4
  # [extension background page](https://developer.chrome.com/extensions/background_pages) in Chromium. One `Browser`
@@ -1751,13 +1750,8 @@ module Playwright
1751
1750
  end
1752
1751
 
1753
1752
  # @nodoc
1754
- def owned_context=(req)
1755
- wrap_impl(@impl.owned_context=(unwrap_impl(req)))
1756
- end
1757
-
1758
- # @nodoc
1759
- def guid
1760
- wrap_impl(@impl.guid)
1753
+ def start_js_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
1754
+ wrap_impl(@impl.start_js_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
1761
1755
  end
1762
1756
 
1763
1757
  # @nodoc
@@ -1765,11 +1759,6 @@ module Playwright
1765
1759
  wrap_impl(@impl.start_css_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
1766
1760
  end
1767
1761
 
1768
- # @nodoc
1769
- def start_js_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
1770
- wrap_impl(@impl.start_js_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
1771
- end
1772
-
1773
1762
  # @nodoc
1774
1763
  def stop_js_coverage
1775
1764
  wrap_impl(@impl.stop_js_coverage)
@@ -1780,6 +1769,16 @@ module Playwright
1780
1769
  wrap_impl(@impl.stop_css_coverage)
1781
1770
  end
1782
1771
 
1772
+ # @nodoc
1773
+ def guid
1774
+ wrap_impl(@impl.guid)
1775
+ end
1776
+
1777
+ # @nodoc
1778
+ def owned_context=(req)
1779
+ wrap_impl(@impl.owned_context=(unwrap_impl(req)))
1780
+ end
1781
+
1783
1782
  # -- inherited from EventEmitter --
1784
1783
  # @nodoc
1785
1784
  def once(event, callback)
@@ -94,13 +94,13 @@ module Playwright
94
94
  end
95
95
 
96
96
  # @nodoc
97
- def android
98
- wrap_impl(@impl.android)
97
+ def electron
98
+ wrap_impl(@impl.electron)
99
99
  end
100
100
 
101
101
  # @nodoc
102
- def electron
103
- wrap_impl(@impl.electron)
102
+ def android
103
+ wrap_impl(@impl.android)
104
104
  end
105
105
 
106
106
  # -- inherited from EventEmitter --
@@ -13,7 +13,7 @@ module Playwright
13
13
  end
14
14
 
15
15
  #
16
- # Continues route's request with optional overrides.
16
+ # Sends route's request to the network with optional overrides.
17
17
  #
18
18
  # **Usage**
19
19
  #
@@ -33,18 +33,22 @@ module Playwright
33
33
  # **Details**
34
34
  #
35
35
  # Note that any overrides such as `url` or `headers` only apply to the request being routed. If this request results in a redirect, overrides will not be applied to the new redirected request. If you want to propagate a header through redirects, use the combination of [`method: Route.fetch`] and [`method: Route.fulfill`] instead.
36
+ #
37
+ # [`method: Route.continue`] will immediately send the request to the network, other matching handlers won't be invoked. Use [`method: Route.fallback`] If you want next matching handler in the chain to be invoked.
36
38
  def continue(headers: nil, method: nil, postData: nil, url: nil)
37
39
  wrap_impl(@impl.continue(headers: unwrap_impl(headers), method: unwrap_impl(method), postData: unwrap_impl(postData), url: unwrap_impl(url)))
38
40
  end
39
41
 
42
+ #
43
+ # Continues route's request with optional overrides. The method is similar to [`method: Route.continue`] with the difference that other matching handlers will be invoked before sending the request.
44
+ #
45
+ # **Usage**
40
46
  #
41
47
  # When several routes match the given pattern, they run in the order opposite to their registration.
42
48
  # That way the last registered route can always override all the previous ones. In the example below,
43
49
  # request will be handled by the bottom-most handler first, then it'll fall back to the previous one and
44
50
  # in the end will be aborted by the first registered route.
45
51
  #
46
- # **Usage**
47
- #
48
52
  # ```python sync
49
53
  # page.route("**/*", lambda route: route.abort()) # Runs last.
50
54
  # page.route("**/*", lambda route: route.fallback()) # Runs second.
@@ -91,6 +95,8 @@ module Playwright
91
95
  #
92
96
  # page.route("**/*", handle)
93
97
  # ```
98
+ #
99
+ # Use [`method: Route.continue`] to immediately send the request to the network, other matching handlers won't be invoked in that case.
94
100
  def fallback(headers: nil, method: nil, postData: nil, url: nil)
95
101
  wrap_impl(@impl.fallback(headers: unwrap_impl(headers), method: unwrap_impl(method), postData: unwrap_impl(postData), url: unwrap_impl(url)))
96
102
  end
@@ -47,13 +47,13 @@ module Playwright
47
47
  end
48
48
 
49
49
  # @nodoc
50
- def page=(req)
51
- wrap_impl(@impl.page=(unwrap_impl(req)))
50
+ def context=(req)
51
+ wrap_impl(@impl.context=(unwrap_impl(req)))
52
52
  end
53
53
 
54
54
  # @nodoc
55
- def context=(req)
56
- wrap_impl(@impl.context=(unwrap_impl(req)))
55
+ def page=(req)
56
+ wrap_impl(@impl.page=(unwrap_impl(req)))
57
57
  end
58
58
 
59
59
  # -- inherited from EventEmitter --
data/sig/playwright.rbs CHANGED
@@ -546,14 +546,14 @@ module Playwright
546
546
  end
547
547
 
548
548
  class APIRequestContext
549
- def delete: (String url, ?data: (String | String | untyped), ?failOnStatusCode: bool, ?form: Hash[untyped, untyped], ?headers: Hash[untyped, untyped], ?ignoreHTTPSErrors: bool, ?maxRedirects: Integer, ?maxRetries: Integer, ?multipart: Hash[untyped, untyped], ?params: Hash[untyped, untyped], ?timeout: Float) -> APIResponse
549
+ def delete: (String url, ?data: (String | String | untyped), ?failOnStatusCode: bool, ?form: Hash[untyped, untyped], ?headers: Hash[untyped, untyped], ?ignoreHTTPSErrors: bool, ?maxRedirects: Integer, ?maxRetries: Integer, ?multipart: Hash[untyped, untyped], ?params: (Hash[untyped, untyped] | String), ?timeout: Float) -> APIResponse
550
550
  def dispose: (?reason: String) -> void
551
- def fetch: ((String | Request) urlOrRequest, ?data: (String | String | untyped), ?failOnStatusCode: bool, ?form: Hash[untyped, untyped], ?headers: Hash[untyped, untyped], ?ignoreHTTPSErrors: bool, ?maxRedirects: Integer, ?maxRetries: Integer, ?method: String, ?multipart: Hash[untyped, untyped], ?params: Hash[untyped, untyped], ?timeout: Float) -> APIResponse
552
- def get: (String url, ?data: (String | String | untyped), ?failOnStatusCode: bool, ?form: Hash[untyped, untyped], ?headers: Hash[untyped, untyped], ?ignoreHTTPSErrors: bool, ?maxRedirects: Integer, ?maxRetries: Integer, ?multipart: Hash[untyped, untyped], ?params: Hash[untyped, untyped], ?timeout: Float) -> APIResponse
553
- def head: (String url, ?data: (String | String | untyped), ?failOnStatusCode: bool, ?form: Hash[untyped, untyped], ?headers: Hash[untyped, untyped], ?ignoreHTTPSErrors: bool, ?maxRedirects: Integer, ?maxRetries: Integer, ?multipart: Hash[untyped, untyped], ?params: Hash[untyped, untyped], ?timeout: Float) -> APIResponse
554
- def patch: (String url, ?data: (String | String | untyped), ?failOnStatusCode: bool, ?form: Hash[untyped, untyped], ?headers: Hash[untyped, untyped], ?ignoreHTTPSErrors: bool, ?maxRedirects: Integer, ?maxRetries: Integer, ?multipart: Hash[untyped, untyped], ?params: Hash[untyped, untyped], ?timeout: Float) -> APIResponse
555
- def post: (String url, ?data: (String | String | untyped), ?failOnStatusCode: bool, ?form: Hash[untyped, untyped], ?headers: Hash[untyped, untyped], ?ignoreHTTPSErrors: bool, ?maxRedirects: Integer, ?maxRetries: Integer, ?multipart: Hash[untyped, untyped], ?params: Hash[untyped, untyped], ?timeout: Float) -> APIResponse
556
- def put: (String url, ?data: (String | String | untyped), ?failOnStatusCode: bool, ?form: Hash[untyped, untyped], ?headers: Hash[untyped, untyped], ?ignoreHTTPSErrors: bool, ?maxRedirects: Integer, ?maxRetries: Integer, ?multipart: Hash[untyped, untyped], ?params: Hash[untyped, untyped], ?timeout: Float) -> APIResponse
551
+ def fetch: ((String | Request) urlOrRequest, ?data: (String | String | untyped), ?failOnStatusCode: bool, ?form: Hash[untyped, untyped], ?headers: Hash[untyped, untyped], ?ignoreHTTPSErrors: bool, ?maxRedirects: Integer, ?maxRetries: Integer, ?method: String, ?multipart: Hash[untyped, untyped], ?params: (Hash[untyped, untyped] | String), ?timeout: Float) -> APIResponse
552
+ def get: (String url, ?data: (String | String | untyped), ?failOnStatusCode: bool, ?form: Hash[untyped, untyped], ?headers: Hash[untyped, untyped], ?ignoreHTTPSErrors: bool, ?maxRedirects: Integer, ?maxRetries: Integer, ?multipart: Hash[untyped, untyped], ?params: (Hash[untyped, untyped] | String), ?timeout: Float) -> APIResponse
553
+ def head: (String url, ?data: (String | String | untyped), ?failOnStatusCode: bool, ?form: Hash[untyped, untyped], ?headers: Hash[untyped, untyped], ?ignoreHTTPSErrors: bool, ?maxRedirects: Integer, ?maxRetries: Integer, ?multipart: Hash[untyped, untyped], ?params: (Hash[untyped, untyped] | String), ?timeout: Float) -> APIResponse
554
+ def patch: (String url, ?data: (String | String | untyped), ?failOnStatusCode: bool, ?form: Hash[untyped, untyped], ?headers: Hash[untyped, untyped], ?ignoreHTTPSErrors: bool, ?maxRedirects: Integer, ?maxRetries: Integer, ?multipart: Hash[untyped, untyped], ?params: (Hash[untyped, untyped] | String), ?timeout: Float) -> APIResponse
555
+ def post: (String url, ?data: (String | String | untyped), ?failOnStatusCode: bool, ?form: Hash[untyped, untyped], ?headers: Hash[untyped, untyped], ?ignoreHTTPSErrors: bool, ?maxRedirects: Integer, ?maxRetries: Integer, ?multipart: Hash[untyped, untyped], ?params: (Hash[untyped, untyped] | String), ?timeout: Float) -> APIResponse
556
+ def put: (String url, ?data: (String | String | untyped), ?failOnStatusCode: bool, ?form: Hash[untyped, untyped], ?headers: Hash[untyped, untyped], ?ignoreHTTPSErrors: bool, ?maxRedirects: Integer, ?maxRetries: Integer, ?multipart: Hash[untyped, untyped], ?params: (Hash[untyped, untyped] | String), ?timeout: Float) -> APIResponse
557
557
  end
558
558
 
559
559
  class LocatorAssertions
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.46.0
4
+ version: 1.47.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - YusukeIwaki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-08-27 00:00:00.000000000 Z
11
+ date: 2024-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -413,5 +413,5 @@ requirements: []
413
413
  rubygems_version: 3.3.27
414
414
  signing_key:
415
415
  specification_version: 4
416
- summary: The Ruby binding of playwright driver 1.46.1
416
+ summary: The Ruby binding of playwright driver 1.47.1
417
417
  test_files: []