playwright-ruby-client 1.24.0 → 1.26.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4e87b002bd3cd1dfaf592f6be37902b0a0604553d419b8b7516e0e887584125a
4
- data.tar.gz: 5b956c57000f12dc8399df4382dd301a7ef1d47551782afff0fae0871892c630
3
+ metadata.gz: beca54a9f8e488cefb33f9266bd227bdb002ea5e379f6525733375f30a26aad2
4
+ data.tar.gz: a8cb017751e740755cb92a7525a59afde927b9393ed13d71e0af2797c857496e
5
5
  SHA512:
6
- metadata.gz: e3a418d6d40392a157016b164455e8cdc83bffb696c182d68d2ce10cb1e7315be151fb4be78e5b985871ba75ef1882be262d05c93a0b3a65a3c3b8b9c7373fb2
7
- data.tar.gz: db086e5ff1cdbc8cee9d1aea80601e2f9664c4806478aa556fd91e6b647bc71d23b9f0862ed60711365e06e67d513717c5e01b3d7b60c1a5b9438535ef8394e5
6
+ metadata.gz: f7ede551835e7916acf830ef26664cd6421910c966d96f9e85c599383c48fc7707467f2d095a848c6f23071310e6072cde47b7412b4d83d1f381373dc42b6011
7
+ data.tar.gz: c4aa082a27871b37b64236c0fc40c17083884696fb2ceef8a3bd9e6c72d5089081a81ac616fd1a8116cf7052575888fa63abc47866d2cff413b21aee9a695f10
@@ -4,6 +4,10 @@ sidebar_position: 10
4
4
 
5
5
  # Accessibility
6
6
 
7
+ **DEPRECATED** This class is deprecated. Please use other libraries such as [Axe](https://www.deque.com/axe/) if you
8
+ need to test page accessibility. See our Node.js [guide](https://playwright.dev/docs/accessibility-testing) for
9
+ integration with Axe.
10
+
7
11
  The Accessibility class provides methods for inspecting Chromium's accessibility tree. The accessibility tree is used by
8
12
  assistive technology such as [screen readers](https://en.wikipedia.org/wiki/Screen_reader) or
9
13
  [switches](https://en.wikipedia.org/wiki/Switch_access).
@@ -24,6 +28,10 @@ only the "interesting" nodes of the tree.
24
28
  def snapshot(interestingOnly: nil, root: nil)
25
29
  ```
26
30
 
31
+ **DEPRECATED** This method is deprecated. Please use other libraries such as [Axe](https://www.deque.com/axe/) if you
32
+ need to test page accessibility. See our Node.js [guide](https://playwright.dev/docs/accessibility-testing) for
33
+ integration with Axe.
34
+
27
35
  Captures the current state of the accessibility tree. The returned object represents the root accessible node of the
28
36
  page.
29
37
 
@@ -13,14 +13,14 @@ possible to create a new APIRequestContext instance manually by calling [APIRequ
13
13
 
14
14
  **Cookie management**
15
15
 
16
- [APIRequestContext](./api_request_context) retuned by [BrowserContext#request](./browser_context#request) and [Page#request](./page#request) shares cookie storage
17
- with the corresponding [BrowserContext](./browser_context). Each API request will have `Cookie` header populated with the values from the
18
- browser context. If the API response contains `Set-Cookie` header it will automatically update [BrowserContext](./browser_context) cookies
19
- and requests made from the page will pick them up. This means that if you log in using this API, your e2e test will be
20
- logged in and vice versa.
16
+ [APIRequestContext](./api_request_context) returned by [BrowserContext#request](./browser_context#request) and [Page#request](./page#request) shares cookie
17
+ storage with the corresponding [BrowserContext](./browser_context). Each API request will have `Cookie` header populated with the values
18
+ from the browser context. If the API response contains `Set-Cookie` header it will automatically update [BrowserContext](./browser_context)
19
+ cookies and requests made from the page will pick them up. This means that if you log in using this API, your e2e test
20
+ will be logged in and vice versa.
21
21
 
22
- If you want API requests to not interfere with the browser cookies you shoud create a new [APIRequestContext](./api_request_context) by calling
23
- [APIRequest#new_context](./api_request#new_context). Such [APIRequestContext](./api_request_context) object will have its own isolated cookie storage.
22
+ If you want API requests to not interfere with the browser cookies you should create a new [APIRequestContext](./api_request_context) by
23
+ calling [APIRequest#new_context](./api_request#new_context). Such [APIRequestContext](./api_request_context) object will have its own isolated cookie storage.
24
24
 
25
25
  ```ruby
26
26
  playwright.chromium.launch do |browser|
@@ -66,6 +66,7 @@ def delete(
66
66
  form: nil,
67
67
  headers: nil,
68
68
  ignoreHTTPSErrors: nil,
69
+ maxRedirects: nil,
69
70
  multipart: nil,
70
71
  params: nil,
71
72
  timeout: nil)
@@ -95,6 +96,7 @@ def fetch(
95
96
  form: nil,
96
97
  headers: nil,
97
98
  ignoreHTTPSErrors: nil,
99
+ maxRedirects: nil,
98
100
  method: nil,
99
101
  multipart: nil,
100
102
  params: nil,
@@ -112,6 +114,7 @@ def get(
112
114
  failOnStatusCode: nil,
113
115
  headers: nil,
114
116
  ignoreHTTPSErrors: nil,
117
+ maxRedirects: nil,
115
118
  params: nil,
116
119
  timeout: nil)
117
120
  ```
@@ -128,6 +131,7 @@ def head(
128
131
  failOnStatusCode: nil,
129
132
  headers: nil,
130
133
  ignoreHTTPSErrors: nil,
134
+ maxRedirects: nil,
131
135
  params: nil,
132
136
  timeout: nil)
133
137
  ```
@@ -146,6 +150,7 @@ def patch(
146
150
  form: nil,
147
151
  headers: nil,
148
152
  ignoreHTTPSErrors: nil,
153
+ maxRedirects: nil,
149
154
  multipart: nil,
150
155
  params: nil,
151
156
  timeout: nil)
@@ -165,6 +170,7 @@ def post(
165
170
  form: nil,
166
171
  headers: nil,
167
172
  ignoreHTTPSErrors: nil,
173
+ maxRedirects: nil,
168
174
  multipart: nil,
169
175
  params: nil,
170
176
  timeout: nil)
@@ -184,6 +190,7 @@ def put(
184
190
  form: nil,
185
191
  headers: nil,
186
192
  ignoreHTTPSErrors: nil,
193
+ maxRedirects: nil,
187
194
  multipart: nil,
188
195
  params: nil,
189
196
  timeout: nil)
@@ -125,7 +125,7 @@ def new_context(
125
125
 
126
126
  Creates a new browser context. It won't share cookies/cache with other browser contexts.
127
127
 
128
- > NOTE: If directly using this method to create [BrowserContext](./browser_context)s, it is best practice to explicilty close the returned
128
+ > NOTE: If directly using this method to create [BrowserContext](./browser_context)s, it is best practice to explicitly close the returned
129
129
  context via [BrowserContext#close](./browser_context#close) when your code is done with the [BrowserContext](./browser_context), and before calling
130
130
  [Browser#close](./browser#close). This will ensure the `context` is closed gracefully and any artifacts—like HARs and
131
131
  videos—are fully flushed and saved.
@@ -37,6 +37,14 @@ The default browser context is accessible via [Browser#contexts](./browser#conte
37
37
 
38
38
  > NOTE: Connecting over the Chrome DevTools Protocol is only supported for Chromium-based browsers.
39
39
 
40
+ ```ruby
41
+ browser = playwright.chromium.connect_over_cdp("http://localhost:9222")
42
+ default_context = browser.contexts.first
43
+ page = default_context.pages.first
44
+ ```
45
+
46
+
47
+
40
48
  ## executable_path
41
49
 
42
50
  ```
@@ -16,7 +16,7 @@ locator.click
16
16
  **Strictness**
17
17
 
18
18
  Frame locators are strict. This means that all operations on frame locators will throw if more than one element matches
19
- given selector.
19
+ a given selector.
20
20
 
21
21
  ```ruby
22
22
  # Throws if there are several frames in DOM:
@@ -1541,7 +1541,7 @@ Returns when element specified by selector satisfies `state` option. Returns `nu
1541
1541
  `detached`.
1542
1542
 
1543
1543
  > NOTE: Playwright automatically waits for element to be ready before performing an action. Using [Locator](./locator) objects and
1544
- web-first assertions make the code wait-for-selector-free.
1544
+ web-first assertions makes the code wait-for-selector-free.
1545
1545
 
1546
1546
  Wait for the `selector` to satisfy `state` option (either appear/disappear from dom, or become visible/hidden). If at
1547
1547
  the moment of calling the method `selector` already satisfies the condition, the method will return immediately. If the
@@ -1622,6 +1622,10 @@ associated with the page.
1622
1622
 
1623
1623
  ## accessibility
1624
1624
 
1625
+ **DEPRECATED** This property is deprecated. Please use other libraries such as [Axe](https://www.deque.com/axe/) if you
1626
+ need to test page accessibility. See our Node.js [guide](https://playwright.dev/docs/accessibility-testing) for
1627
+ integration with Axe.
1628
+
1625
1629
  ## keyboard
1626
1630
 
1627
1631
  ## mouse
@@ -44,7 +44,7 @@ Returns the [Frame](./frame) that initiated this response.
44
44
  def from_service_worker
45
45
  ```
46
46
 
47
- Indicates whether this Response was fullfilled by a Service Worker's Fetch Handler (i.e. via
47
+ Indicates whether this Response was fulfilled by a Service Worker's Fetch Handler (i.e. via
48
48
  [FetchEvent.respondWith](https://developer.mozilla.org/en-US/docs/Web/API/FetchEvent/respondWith)).
49
49
 
50
50
  ## headers
@@ -13,7 +13,7 @@ const FeatureList = [
13
13
  ),
14
14
  },
15
15
  {
16
- title: 'Make more relyable tests',
16
+ title: 'Make more reliable tests',
17
17
  Svg: require('../../static/img/undraw_dropdown_menu.svg').default,
18
18
  description: (
19
19
  <>
@@ -42,10 +42,16 @@ module Playwright
42
42
 
43
43
  attr_reader :channel
44
44
 
45
+ private def adopt!(child)
46
+ unless child.is_a?(ChannelOwner)
47
+ raise ArgumentError.new("child must be a ChannelOwner: #{child.inspect}")
48
+ end
49
+ child.send(:update_parent, self)
50
+ end
51
+
45
52
  # used only from Connection. Not intended for public use. So keep private.
46
53
  private def dispose!
47
54
  # Clean up from parent and connection.
48
- @parent&.send(:delete_object_from_child, @guid)
49
55
  @connection.send(:delete_object_from_channel_owner, @guid)
50
56
 
51
57
  # Dispose all children.
@@ -65,6 +71,12 @@ module Playwright
65
71
  private def after_initialize
66
72
  end
67
73
 
74
+ private def update_parent(new_parent)
75
+ @parent.send(:delete_object_from_child, @guid)
76
+ new_parent.send(:update_object_from_child, @guid, self)
77
+ @parent = new_parent
78
+ end
79
+
68
80
  private def update_object_from_child(guid, child)
69
81
  @objects[guid] = child
70
82
  end
@@ -10,136 +10,34 @@ module Playwright
10
10
  @channel.send_message_to_server('dispose')
11
11
  end
12
12
 
13
- def delete(
14
- url,
15
- data: nil,
16
- failOnStatusCode: nil,
17
- form: nil,
18
- headers: nil,
19
- ignoreHTTPSErrors: nil,
20
- multipart: nil,
21
- params: nil,
22
- timeout: nil)
23
- fetch(
24
- url,
25
- method: 'DELETE',
26
- data: data,
27
- failOnStatusCode: failOnStatusCode,
28
- form: form,
29
- headers: headers,
30
- ignoreHTTPSErrors: ignoreHTTPSErrors,
31
- multipart: multipart,
32
- params: params,
33
- timeout: timeout,
34
- )
13
+ def delete(url, **options)
14
+ fetch_options = options.merge(method: 'DELETE')
15
+ fetch(url, **fetch_options)
35
16
  end
36
17
 
37
- def head(
38
- url,
39
- failOnStatusCode: nil,
40
- headers: nil,
41
- ignoreHTTPSErrors: nil,
42
- params: nil,
43
- timeout: nil)
44
- fetch(
45
- url,
46
- method: 'HEAD',
47
- failOnStatusCode: failOnStatusCode,
48
- headers: headers,
49
- ignoreHTTPSErrors: ignoreHTTPSErrors,
50
- params: params,
51
- timeout: timeout,
52
- )
18
+ def head(url, **options)
19
+ fetch_options = options.merge(method: 'HEAD')
20
+ fetch(url, **fetch_options)
53
21
  end
54
22
 
55
- def get(
56
- url,
57
- failOnStatusCode: nil,
58
- headers: nil,
59
- ignoreHTTPSErrors: nil,
60
- params: nil,
61
- timeout: nil)
62
- fetch(
63
- url,
64
- method: 'GET',
65
- failOnStatusCode: failOnStatusCode,
66
- headers: headers,
67
- ignoreHTTPSErrors: ignoreHTTPSErrors,
68
- params: params,
69
- timeout: timeout,
70
- )
23
+ def get(url, **options)
24
+ fetch_options = options.merge(method: 'GET')
25
+ fetch(url, **fetch_options)
71
26
  end
72
27
 
73
- def patch(
74
- url,
75
- data: nil,
76
- failOnStatusCode: nil,
77
- form: nil,
78
- headers: nil,
79
- ignoreHTTPSErrors: nil,
80
- multipart: nil,
81
- params: nil,
82
- timeout: nil)
83
- fetch(
84
- url,
85
- method: 'PATCH',
86
- data: data,
87
- failOnStatusCode: failOnStatusCode,
88
- form: form,
89
- headers: headers,
90
- ignoreHTTPSErrors: ignoreHTTPSErrors,
91
- multipart: multipart,
92
- params: params,
93
- timeout: timeout,
94
- )
28
+ def patch(url, **options)
29
+ fetch_options = options.merge(method: 'PATCH')
30
+ fetch(url, **fetch_options)
95
31
  end
96
32
 
97
- def put(
98
- url,
99
- data: nil,
100
- failOnStatusCode: nil,
101
- form: nil,
102
- headers: nil,
103
- ignoreHTTPSErrors: nil,
104
- multipart: nil,
105
- params: nil,
106
- timeout: nil)
107
- fetch(
108
- url,
109
- method: 'PUT',
110
- data: data,
111
- failOnStatusCode: failOnStatusCode,
112
- form: form,
113
- headers: headers,
114
- ignoreHTTPSErrors: ignoreHTTPSErrors,
115
- multipart: multipart,
116
- params: params,
117
- timeout: timeout,
118
- )
33
+ def put(url, **options)
34
+ fetch_options = options.merge(method: 'PUT')
35
+ fetch(url, **fetch_options)
119
36
  end
120
37
 
121
- def post(
122
- url,
123
- data: nil,
124
- failOnStatusCode: nil,
125
- form: nil,
126
- headers: nil,
127
- ignoreHTTPSErrors: nil,
128
- multipart: nil,
129
- params: nil,
130
- timeout: nil)
131
- fetch(
132
- url,
133
- method: 'POST',
134
- data: data,
135
- failOnStatusCode: failOnStatusCode,
136
- form: form,
137
- headers: headers,
138
- ignoreHTTPSErrors: ignoreHTTPSErrors,
139
- multipart: multipart,
140
- params: params,
141
- timeout: timeout,
142
- )
38
+ def post(url, **options)
39
+ fetch_options = options.merge(method: 'POST')
40
+ fetch(url, **fetch_options)
143
41
  end
144
42
 
145
43
  def fetch(
@@ -149,6 +47,7 @@ module Playwright
149
47
  form: nil,
150
48
  headers: nil,
151
49
  ignoreHTTPSErrors: nil,
50
+ maxRedirects: nil,
152
51
  method: nil,
153
52
  multipart: nil,
154
53
  params: nil,
@@ -160,6 +59,9 @@ module Playwright
160
59
  if [data, form, multipart].compact.count > 1
161
60
  raise ArgumentError.new("Only one of 'data', 'form' or 'multipart' can be specified")
162
61
  end
62
+ if maxRedirects && maxRedirects < 0
63
+ raise ArgumentError.new("'maxRedirects' should be greater than or equal to '0'")
64
+ end
163
65
 
164
66
  request = urlOrRequest.is_a?(ChannelOwners::Request) ? urlOrRequest : nil
165
67
  headers_obj = headers || request&.headers
@@ -212,6 +114,7 @@ module Playwright
212
114
  fetch_params[:timeout] = timeout
213
115
  fetch_params[:failOnStatusCode] = failOnStatusCode
214
116
  fetch_params[:ignoreHTTPSErrors] = ignoreHTTPSErrors
117
+ fetch_params[:maxRedirects] = maxRedirects
215
118
  fetch_params.compact!
216
119
  response = @channel.send_message_to_server('fetch', fetch_params)
217
120
 
@@ -18,7 +18,7 @@ module Playwright
18
18
  @owner_page = nil
19
19
 
20
20
  @tracing = ChannelOwners::Tracing.from(@initializer['tracing'])
21
- @request = ChannelOwners::APIRequestContext.from(@initializer['APIRequestContext'])
21
+ @request = ChannelOwners::APIRequestContext.from(@initializer['requestContext'])
22
22
  @har_recorders = {}
23
23
 
24
24
  @channel.on('bindingCall', ->(params) { on_binding(ChannelOwners::BindingCall.from(params['binding'])) })
@@ -26,7 +26,7 @@ module Playwright
26
26
  @channel.on('page', ->(params) { on_page(ChannelOwners::Page.from(params['page']) )})
27
27
  @channel.on('route', ->(params) {
28
28
  Concurrent::Promises.future {
29
- on_route(ChannelOwners::Route.from(params['route']), ChannelOwners::Request.from(params['request']))
29
+ on_route(ChannelOwners::Route.from(params['route']))
30
30
  }.rescue do |err|
31
31
  puts err, err.backtrace
32
32
  end
@@ -83,22 +83,21 @@ module Playwright
83
83
  emit(Events::BrowserContext::BackgroundPage, page)
84
84
  end
85
85
 
86
- private def on_route(route, request)
86
+ private def on_route(route)
87
87
  # It is not desired to use PlaywrightApi.wrap directly.
88
88
  # However it is a little difficult to define wrapper for `handler` parameter in generate_api.
89
89
  # Just a workaround...
90
90
  wrapped_route = PlaywrightApi.wrap(route)
91
- wrapped_request = PlaywrightApi.wrap(request)
92
91
 
93
92
  handled = @routes.any? do |handler_entry|
94
- next false unless handler_entry.match?(request.url)
93
+ next false unless handler_entry.match?(route.request.url)
95
94
 
96
95
  promise = Concurrent::Promises.resolvable_future
97
96
  route.send(:set_handling_future, promise)
98
97
 
99
98
  promise_handled = Concurrent::Promises.zip(
100
99
  promise,
101
- handler_entry.async_handle(wrapped_route, wrapped_request)
100
+ handler_entry.async_handle(wrapped_route)
102
101
  ).value!.first
103
102
 
104
103
  promise_handled
@@ -13,7 +13,7 @@ module Playwright
13
13
  end
14
14
 
15
15
  def accept(promptText: nil)
16
- accept_async(prompt_text: promptText).value!
16
+ accept_async(promptText: promptText).value!
17
17
  end
18
18
 
19
19
  def accept_async(promptText: nil)
@@ -58,7 +58,7 @@ module Playwright
58
58
  })
59
59
  @channel.on('route', ->(params) {
60
60
  Concurrent::Promises.future {
61
- on_route(ChannelOwners::Route.from(params['route']), ChannelOwners::Request.from(params['request']))
61
+ on_route(ChannelOwners::Route.from(params['route']))
62
62
  }.rescue do |err|
63
63
  puts err, err.backtrace
64
64
  end
@@ -93,22 +93,21 @@ module Playwright
93
93
  emit(Events::Page::FrameDetached, frame)
94
94
  end
95
95
 
96
- private def on_route(route, request)
96
+ private def on_route(route)
97
97
  # It is not desired to use PlaywrightApi.wrap directly.
98
98
  # However it is a little difficult to define wrapper for `handler` parameter in generate_api.
99
99
  # Just a workaround...
100
100
  wrapped_route = PlaywrightApi.wrap(route)
101
- wrapped_request = PlaywrightApi.wrap(request)
102
101
 
103
102
  handled = @routes.any? do |handler_entry|
104
- next false unless handler_entry.match?(request.url)
103
+ next false unless handler_entry.match?(route.request.url)
105
104
 
106
105
  promise = Concurrent::Promises.resolvable_future
107
106
  route.send(:set_handling_future, promise)
108
107
 
109
108
  promise_handled = Concurrent::Promises.zip(
110
109
  promise,
111
- handler_entry.async_handle(wrapped_route, wrapped_request)
110
+ handler_entry.async_handle(wrapped_route)
112
111
  ).value!.first
113
112
 
114
113
  promise_handled
@@ -120,7 +119,7 @@ module Playwright
120
119
  end
121
120
 
122
121
  unless handled
123
- @browser_context.send(:on_route, route, request)
122
+ @browser_context.send(:on_route, route)
124
123
  end
125
124
  end
126
125
 
@@ -141,19 +141,25 @@ module Playwright
141
141
  return
142
142
  end
143
143
 
144
- if method == "__dispose__"
145
- object = @objects[guid]
146
- unless object
147
- raise "Cannot find object to dispose: #{guid}"
144
+ object = @objects[guid]
145
+ unless object
146
+ raise "Cannot find object to \"#{method}\": #{guid}"
147
+ end
148
+
149
+ if method == "__adopt__"
150
+ child = @objects[params["guid"]]
151
+ unless child
152
+ raise "Unknown new child: #{params['guid']}"
148
153
  end
149
- object.send(:dispose!)
154
+ object.send(:adopt!, child)
150
155
  return
151
156
  end
152
157
 
153
- object = @objects[guid]
154
- unless object
155
- raise "Cannot find object to emit \"#{method}\": #{guid}"
158
+ if method == "__dispose__"
159
+ object.send(:dispose!)
160
+ return
156
161
  end
162
+
157
163
  object.channel.emit(method, replace_guids_with_channels(params))
158
164
  end
159
165
 
@@ -47,10 +47,10 @@ module Playwright
47
47
  @url_matcher.match?(url)
48
48
  end
49
49
 
50
- def async_handle(route, request)
50
+ def async_handle(route)
51
51
  @counter.increment
52
52
 
53
- Concurrent::Promises.future { @handler.call(route, request) }.rescue do |err|
53
+ Concurrent::Promises.future { @handler.call(route, route.request) }.rescue do |err|
54
54
  puts err, err.backtrace
55
55
  end
56
56
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Playwright
4
- VERSION = '1.24.0'
5
- COMPATIBLE_PLAYWRIGHT_VERSION = '1.24.2'
4
+ VERSION = '1.26.0'
5
+ COMPATIBLE_PLAYWRIGHT_VERSION = '1.26.0'
6
6
  end
@@ -1,4 +1,8 @@
1
1
  module Playwright
2
+ # **DEPRECATED** This class is deprecated. Please use other libraries such as [Axe](https://www.deque.com/axe/) if you
3
+ # need to test page accessibility. See our Node.js [guide](https://playwright.dev/docs/accessibility-testing) for
4
+ # integration with Axe.
5
+ #
2
6
  # The Accessibility class provides methods for inspecting Chromium's accessibility tree. The accessibility tree is used by
3
7
  # assistive technology such as [screen readers](https://en.wikipedia.org/wiki/Screen_reader) or
4
8
  # [switches](https://en.wikipedia.org/wiki/Switch_access).
@@ -14,6 +18,10 @@ module Playwright
14
18
  # only the "interesting" nodes of the tree.
15
19
  class Accessibility < PlaywrightApi
16
20
 
21
+ # **DEPRECATED** This method is deprecated. Please use other libraries such as [Axe](https://www.deque.com/axe/) if you
22
+ # need to test page accessibility. See our Node.js [guide](https://playwright.dev/docs/accessibility-testing) for
23
+ # integration with Axe.
24
+ #
17
25
  # Captures the current state of the accessibility tree. The returned object represents the root accessible node of the
18
26
  # page.
19
27
  #
@@ -8,14 +8,14 @@ module Playwright
8
8
  #
9
9
  # **Cookie management**
10
10
  #
11
- # `APIRequestContext` retuned by [`property: BrowserContext.request`] and [`property: Page.request`] shares cookie storage
12
- # with the corresponding `BrowserContext`. Each API request will have `Cookie` header populated with the values from the
13
- # browser context. If the API response contains `Set-Cookie` header it will automatically update `BrowserContext` cookies
14
- # and requests made from the page will pick them up. This means that if you log in using this API, your e2e test will be
15
- # logged in and vice versa.
11
+ # `APIRequestContext` returned by [`property: BrowserContext.request`] and [`property: Page.request`] shares cookie
12
+ # storage with the corresponding `BrowserContext`. Each API request will have `Cookie` header populated with the values
13
+ # from the browser context. If the API response contains `Set-Cookie` header it will automatically update `BrowserContext`
14
+ # cookies and requests made from the page will pick them up. This means that if you log in using this API, your e2e test
15
+ # will be logged in and vice versa.
16
16
  #
17
- # If you want API requests to not interfere with the browser cookies you shoud create a new `APIRequestContext` by calling
18
- # [`method: APIRequest.newContext`]. Such `APIRequestContext` object will have its own isolated cookie storage.
17
+ # If you want API requests to not interfere with the browser cookies you should create a new `APIRequestContext` by
18
+ # calling [`method: APIRequest.newContext`]. Such `APIRequestContext` object will have its own isolated cookie storage.
19
19
  #
20
20
  # ```python sync
21
21
  # import os
@@ -28,7 +28,7 @@ module Playwright
28
28
  # with sync_playwright() as p:
29
29
  # # This will launch a new browser, create a context and page. When making HTTP
30
30
  # # requests with the internal APIRequestContext (e.g. `context.request` or `page.request`)
31
- # # it will automatically set the cookies to the browser page and vise versa.
31
+ # # it will automatically set the cookies to the browser page and vice versa.
32
32
  # browser = p.chromium.launch()
33
33
  # context = browser.new_context(base_url="https://api.github.com")
34
34
  # api_request_context = context.request
@@ -75,10 +75,11 @@ module Playwright
75
75
  form: nil,
76
76
  headers: nil,
77
77
  ignoreHTTPSErrors: nil,
78
+ maxRedirects: nil,
78
79
  multipart: nil,
79
80
  params: nil,
80
81
  timeout: nil)
81
- wrap_impl(@impl.delete(unwrap_impl(url), data: unwrap_impl(data), failOnStatusCode: unwrap_impl(failOnStatusCode), form: unwrap_impl(form), headers: unwrap_impl(headers), ignoreHTTPSErrors: unwrap_impl(ignoreHTTPSErrors), multipart: unwrap_impl(multipart), params: unwrap_impl(params), timeout: unwrap_impl(timeout)))
82
+ wrap_impl(@impl.delete(unwrap_impl(url), data: unwrap_impl(data), failOnStatusCode: unwrap_impl(failOnStatusCode), form: unwrap_impl(form), headers: unwrap_impl(headers), ignoreHTTPSErrors: unwrap_impl(ignoreHTTPSErrors), maxRedirects: unwrap_impl(maxRedirects), multipart: unwrap_impl(multipart), params: unwrap_impl(params), timeout: unwrap_impl(timeout)))
82
83
  end
83
84
 
84
85
  # All responses returned by [`method: APIRequestContext.get`] and similar methods are stored in the memory, so that you
@@ -97,11 +98,12 @@ module Playwright
97
98
  form: nil,
98
99
  headers: nil,
99
100
  ignoreHTTPSErrors: nil,
101
+ maxRedirects: nil,
100
102
  method: nil,
101
103
  multipart: nil,
102
104
  params: nil,
103
105
  timeout: nil)
104
- wrap_impl(@impl.fetch(unwrap_impl(urlOrRequest), data: unwrap_impl(data), failOnStatusCode: unwrap_impl(failOnStatusCode), form: unwrap_impl(form), headers: unwrap_impl(headers), ignoreHTTPSErrors: unwrap_impl(ignoreHTTPSErrors), method: unwrap_impl(method), multipart: unwrap_impl(multipart), params: unwrap_impl(params), timeout: unwrap_impl(timeout)))
106
+ wrap_impl(@impl.fetch(unwrap_impl(urlOrRequest), data: unwrap_impl(data), failOnStatusCode: unwrap_impl(failOnStatusCode), form: unwrap_impl(form), headers: unwrap_impl(headers), ignoreHTTPSErrors: unwrap_impl(ignoreHTTPSErrors), maxRedirects: unwrap_impl(maxRedirects), method: unwrap_impl(method), multipart: unwrap_impl(multipart), params: unwrap_impl(params), timeout: unwrap_impl(timeout)))
105
107
  end
106
108
 
107
109
  # Sends HTTP(S) [GET](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GET) request and returns its response. The
@@ -112,9 +114,10 @@ module Playwright
112
114
  failOnStatusCode: nil,
113
115
  headers: nil,
114
116
  ignoreHTTPSErrors: nil,
117
+ maxRedirects: nil,
115
118
  params: nil,
116
119
  timeout: nil)
117
- wrap_impl(@impl.get(unwrap_impl(url), failOnStatusCode: unwrap_impl(failOnStatusCode), headers: unwrap_impl(headers), ignoreHTTPSErrors: unwrap_impl(ignoreHTTPSErrors), params: unwrap_impl(params), timeout: unwrap_impl(timeout)))
120
+ wrap_impl(@impl.get(unwrap_impl(url), failOnStatusCode: unwrap_impl(failOnStatusCode), headers: unwrap_impl(headers), ignoreHTTPSErrors: unwrap_impl(ignoreHTTPSErrors), maxRedirects: unwrap_impl(maxRedirects), params: unwrap_impl(params), timeout: unwrap_impl(timeout)))
118
121
  end
119
122
 
120
123
  # Sends HTTP(S) [HEAD](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD) request and returns its response.
@@ -125,9 +128,10 @@ module Playwright
125
128
  failOnStatusCode: nil,
126
129
  headers: nil,
127
130
  ignoreHTTPSErrors: nil,
131
+ maxRedirects: nil,
128
132
  params: nil,
129
133
  timeout: nil)
130
- wrap_impl(@impl.head(unwrap_impl(url), failOnStatusCode: unwrap_impl(failOnStatusCode), headers: unwrap_impl(headers), ignoreHTTPSErrors: unwrap_impl(ignoreHTTPSErrors), params: unwrap_impl(params), timeout: unwrap_impl(timeout)))
134
+ wrap_impl(@impl.head(unwrap_impl(url), failOnStatusCode: unwrap_impl(failOnStatusCode), headers: unwrap_impl(headers), ignoreHTTPSErrors: unwrap_impl(ignoreHTTPSErrors), maxRedirects: unwrap_impl(maxRedirects), params: unwrap_impl(params), timeout: unwrap_impl(timeout)))
131
135
  end
132
136
 
133
137
  # Sends HTTP(S) [PATCH](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PATCH) request and returns its response.
@@ -140,10 +144,11 @@ module Playwright
140
144
  form: nil,
141
145
  headers: nil,
142
146
  ignoreHTTPSErrors: nil,
147
+ maxRedirects: nil,
143
148
  multipart: nil,
144
149
  params: nil,
145
150
  timeout: nil)
146
- wrap_impl(@impl.patch(unwrap_impl(url), data: unwrap_impl(data), failOnStatusCode: unwrap_impl(failOnStatusCode), form: unwrap_impl(form), headers: unwrap_impl(headers), ignoreHTTPSErrors: unwrap_impl(ignoreHTTPSErrors), multipart: unwrap_impl(multipart), params: unwrap_impl(params), timeout: unwrap_impl(timeout)))
151
+ wrap_impl(@impl.patch(unwrap_impl(url), data: unwrap_impl(data), failOnStatusCode: unwrap_impl(failOnStatusCode), form: unwrap_impl(form), headers: unwrap_impl(headers), ignoreHTTPSErrors: unwrap_impl(ignoreHTTPSErrors), maxRedirects: unwrap_impl(maxRedirects), multipart: unwrap_impl(multipart), params: unwrap_impl(params), timeout: unwrap_impl(timeout)))
147
152
  end
148
153
 
149
154
  # Sends HTTP(S) [POST](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST) request and returns its response.
@@ -156,10 +161,11 @@ module Playwright
156
161
  form: nil,
157
162
  headers: nil,
158
163
  ignoreHTTPSErrors: nil,
164
+ maxRedirects: nil,
159
165
  multipart: nil,
160
166
  params: nil,
161
167
  timeout: nil)
162
- wrap_impl(@impl.post(unwrap_impl(url), data: unwrap_impl(data), failOnStatusCode: unwrap_impl(failOnStatusCode), form: unwrap_impl(form), headers: unwrap_impl(headers), ignoreHTTPSErrors: unwrap_impl(ignoreHTTPSErrors), multipart: unwrap_impl(multipart), params: unwrap_impl(params), timeout: unwrap_impl(timeout)))
168
+ wrap_impl(@impl.post(unwrap_impl(url), data: unwrap_impl(data), failOnStatusCode: unwrap_impl(failOnStatusCode), form: unwrap_impl(form), headers: unwrap_impl(headers), ignoreHTTPSErrors: unwrap_impl(ignoreHTTPSErrors), maxRedirects: unwrap_impl(maxRedirects), multipart: unwrap_impl(multipart), params: unwrap_impl(params), timeout: unwrap_impl(timeout)))
163
169
  end
164
170
 
165
171
  # Sends HTTP(S) [PUT](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PUT) request and returns its response. The
@@ -172,10 +178,11 @@ module Playwright
172
178
  form: nil,
173
179
  headers: nil,
174
180
  ignoreHTTPSErrors: nil,
181
+ maxRedirects: nil,
175
182
  multipart: nil,
176
183
  params: nil,
177
184
  timeout: nil)
178
- wrap_impl(@impl.put(unwrap_impl(url), data: unwrap_impl(data), failOnStatusCode: unwrap_impl(failOnStatusCode), form: unwrap_impl(form), headers: unwrap_impl(headers), ignoreHTTPSErrors: unwrap_impl(ignoreHTTPSErrors), multipart: unwrap_impl(multipart), params: unwrap_impl(params), timeout: unwrap_impl(timeout)))
185
+ wrap_impl(@impl.put(unwrap_impl(url), data: unwrap_impl(data), failOnStatusCode: unwrap_impl(failOnStatusCode), form: unwrap_impl(form), headers: unwrap_impl(headers), ignoreHTTPSErrors: unwrap_impl(ignoreHTTPSErrors), maxRedirects: unwrap_impl(maxRedirects), multipart: unwrap_impl(multipart), params: unwrap_impl(params), timeout: unwrap_impl(timeout)))
179
186
  end
180
187
 
181
188
  # Returns storage state for this request context, contains current cookies and local storage snapshot if it was passed to
@@ -64,7 +64,7 @@ module Playwright
64
64
 
65
65
  # Creates a new browser context. It won't share cookies/cache with other browser contexts.
66
66
  #
67
- # > NOTE: If directly using this method to create `BrowserContext`s, it is best practice to explicilty close the returned
67
+ # > NOTE: If directly using this method to create `BrowserContext`s, it is best practice to explicitly close the returned
68
68
  # context via [`method: BrowserContext.close`] when your code is done with the `BrowserContext`, and before calling
69
69
  # [`method: Browser.close`]. This will ensure the `context` is closed gracefully and any artifacts—like HARs and
70
70
  # videos—are fully flushed and saved.
@@ -18,7 +18,9 @@ module Playwright
18
18
  # ```
19
19
  class BrowserType < PlaywrightApi
20
20
 
21
- # This method attaches Playwright to an existing browser instance.
21
+ # This method attaches Playwright to an existing browser instance. When connecting to another browser launched via
22
+ # `BrowserType.launchServer` in Node.js, the major and minor version needs to match the client version (1.2.3 → is
23
+ # compatible with 1.2.x).
22
24
  def connect(wsEndpoint, headers: nil, slowMo: nil, timeout: nil)
23
25
  raise NotImplementedError.new('connect is not implemented yet.')
24
26
  end
@@ -28,6 +30,12 @@ module Playwright
28
30
  # The default browser context is accessible via [`method: Browser.contexts`].
29
31
  #
30
32
  # > NOTE: Connecting over the Chrome DevTools Protocol is only supported for Chromium-based browsers.
33
+ #
34
+ # ```python sync
35
+ # browser = playwright.chromium.connect_over_cdp("http://localhost:9222")
36
+ # default_context = browser.contexts[0]
37
+ # page = default_context.pages[0]
38
+ # ```
31
39
  def connect_over_cdp(
32
40
  endpointURL,
33
41
  headers: nil,
@@ -11,7 +11,7 @@ module Playwright
11
11
  # **Strictness**
12
12
  #
13
13
  # Frame locators are strict. This means that all operations on frame locators will throw if more than one element matches
14
- # given selector.
14
+ # a given selector.
15
15
  #
16
16
  # ```python sync
17
17
  # # Throws if there are several frames in DOM:
@@ -44,6 +44,9 @@ module Playwright
44
44
  # ```
45
45
  class Page < PlaywrightApi
46
46
 
47
+ # **DEPRECATED** This property is deprecated. Please use other libraries such as [Axe](https://www.deque.com/axe/) if you
48
+ # need to test page accessibility. See our Node.js [guide](https://playwright.dev/docs/accessibility-testing) for
49
+ # integration with Axe.
47
50
  def accessibility # property
48
51
  wrap_impl(@impl.accessibility)
49
52
  end
@@ -1318,7 +1321,7 @@ module Playwright
1318
1321
  # `detached`.
1319
1322
  #
1320
1323
  # > NOTE: Playwright automatically waits for element to be ready before performing an action. Using `Locator` objects and
1321
- # web-first assertions make the code wait-for-selector-free.
1324
+ # web-first assertions makes the code wait-for-selector-free.
1322
1325
  #
1323
1326
  # Wait for the `selector` to satisfy `state` option (either appear/disappear from dom, or become visible/hidden). If at
1324
1327
  # the moment of calling the method `selector` already satisfies the condition, the method will return immediately. If the
@@ -1410,13 +1413,13 @@ module Playwright
1410
1413
  end
1411
1414
 
1412
1415
  # @nodoc
1413
- def start_js_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
1414
- wrap_impl(@impl.start_js_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
1416
+ def guid
1417
+ wrap_impl(@impl.guid)
1415
1418
  end
1416
1419
 
1417
1420
  # @nodoc
1418
- def guid
1419
- wrap_impl(@impl.guid)
1421
+ def start_js_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
1422
+ wrap_impl(@impl.start_js_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
1420
1423
  end
1421
1424
 
1422
1425
  # @nodoc
@@ -22,7 +22,7 @@ module Playwright
22
22
  wrap_impl(@impl.frame)
23
23
  end
24
24
 
25
- # Indicates whether this Response was fullfilled by a Service Worker's Fetch Handler (i.e. via
25
+ # Indicates whether this Response was fulfilled by a Service Worker's Fetch Handler (i.e. via
26
26
  # [FetchEvent.respondWith](https://developer.mozilla.org/en-US/docs/Web/API/FetchEvent/respondWith)).
27
27
  def from_service_worker
28
28
  wrap_impl(@impl.from_service_worker)
@@ -44,13 +44,13 @@ module Playwright
44
44
  end
45
45
 
46
46
  # @nodoc
47
- def context=(req)
48
- wrap_impl(@impl.context=(unwrap_impl(req)))
47
+ def page=(req)
48
+ wrap_impl(@impl.page=(unwrap_impl(req)))
49
49
  end
50
50
 
51
51
  # @nodoc
52
- def page=(req)
53
- wrap_impl(@impl.page=(unwrap_impl(req)))
52
+ def context=(req)
53
+ wrap_impl(@impl.context=(unwrap_impl(req)))
54
54
  end
55
55
 
56
56
  # -- 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.24.0
4
+ version: 1.26.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - YusukeIwaki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-08-13 00:00:00.000000000 Z
11
+ date: 2022-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -399,5 +399,5 @@ requirements: []
399
399
  rubygems_version: 3.3.7
400
400
  signing_key:
401
401
  specification_version: 4
402
- summary: The Ruby binding of playwright driver 1.24.2
402
+ summary: The Ruby binding of playwright driver 1.26.0
403
403
  test_files: []