playwright-ruby-client 1.23.0 → 1.24.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/documentation/docs/api/browser.md +14 -5
- data/documentation/docs/api/browser_context.md +5 -5
- data/documentation/docs/api/download.md +1 -1
- data/documentation/docs/api/element_handle.md +1 -1
- data/documentation/docs/api/file_chooser.md +1 -1
- data/documentation/docs/api/locator.md +2 -1
- data/documentation/docs/api/page.md +3 -3
- data/documentation/docs/api/route.md +1 -1
- data/documentation/docs/api/selectors.md +2 -2
- data/documentation/docs/api/tracing.md +1 -1
- data/documentation/package.json +4 -4
- data/documentation/yarn.lock +1876 -1304
- data/lib/playwright/javascript/value_parser.rb +4 -0
- data/lib/playwright/javascript/value_serializer.rb +2 -0
- data/lib/playwright/locator_impl.rb +1 -1
- data/lib/playwright/version.rb +2 -2
- data/lib/playwright_api/browser.rb +13 -0
- data/lib/playwright_api/browser_context.rb +3 -3
- data/lib/playwright_api/download.rb +1 -1
- data/lib/playwright_api/element_handle.rb +1 -1
- data/lib/playwright_api/file_chooser.rb +1 -1
- data/lib/playwright_api/locator.rb +3 -2
- data/lib/playwright_api/route.rb +1 -1
- data/lib/playwright_api/selectors.rb +1 -1
- data/lib/playwright_api/tracing.rb +1 -1
- 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: 4e87b002bd3cd1dfaf592f6be37902b0a0604553d419b8b7516e0e887584125a
|
4
|
+
data.tar.gz: 5b956c57000f12dc8399df4382dd301a7ef1d47551782afff0fae0871892c630
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3a418d6d40392a157016b164455e8cdc83bffb696c182d68d2ce10cb1e7315be151fb4be78e5b985871ba75ef1882be262d05c93a0b3a65a3c3b8b9c7373fb2
|
7
|
+
data.tar.gz: db086e5ff1cdbc8cee9d1aea80601e2f9664c4806478aa556fd91e6b647bc71d23b9f0862ed60711365e06e67d513717c5e01b3d7b60c1a5b9438535ef8394e5
|
@@ -41,6 +41,10 @@ were opened).
|
|
41
41
|
In case this browser is connected to, clears all created contexts belonging to this browser and disconnects from the
|
42
42
|
browser server.
|
43
43
|
|
44
|
+
> NOTE: This is similar to force quitting the browser. Therefore, you should call [BrowserContext#close](./browser_context#close) on
|
45
|
+
any [BrowserContext](./browser_context)'s you explicitly created earlier with [Browser#new_context](./browser#new_context) **before** calling
|
46
|
+
[Browser#close](./browser#close).
|
47
|
+
|
44
48
|
The [Browser](./browser) object itself is considered to be disposed and cannot be used anymore.
|
45
49
|
|
46
50
|
## contexts
|
@@ -121,14 +125,19 @@ def new_context(
|
|
121
125
|
|
122
126
|
Creates a new browser context. It won't share cookies/cache with other browser contexts.
|
123
127
|
|
128
|
+
> NOTE: If directly using this method to create [BrowserContext](./browser_context)s, it is best practice to explicilty close the returned
|
129
|
+
context via [BrowserContext#close](./browser_context#close) when your code is done with the [BrowserContext](./browser_context), and before calling
|
130
|
+
[Browser#close](./browser#close). This will ensure the `context` is closed gracefully and any artifacts—like HARs and
|
131
|
+
videos—are fully flushed and saved.
|
132
|
+
|
124
133
|
```ruby
|
125
134
|
playwright.firefox.launch do |browser| # or "chromium.launch" or "webkit.launch".
|
126
135
|
# create a new incognito browser context.
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
136
|
+
browser.new_context do |context|
|
137
|
+
# create a new page in a pristine context.
|
138
|
+
page = context.new_page
|
139
|
+
page.goto("https://example.com")
|
140
|
+
end
|
132
141
|
end
|
133
142
|
```
|
134
143
|
|
@@ -23,7 +23,7 @@ page = context.new_page
|
|
23
23
|
page.goto("https://example.com")
|
24
24
|
|
25
25
|
# dispose context once it is no longer needed.
|
26
|
-
context.close
|
26
|
+
context.close
|
27
27
|
```
|
28
28
|
|
29
29
|
|
@@ -161,7 +161,7 @@ page.content = <<~HTML
|
|
161
161
|
<div></div>
|
162
162
|
HTML
|
163
163
|
|
164
|
-
page.
|
164
|
+
page.locator("button").click
|
165
165
|
```
|
166
166
|
|
167
167
|
An example of passing an element handle:
|
@@ -184,7 +184,7 @@ page.content = <<~HTML
|
|
184
184
|
<div>Or click me</div>
|
185
185
|
HTML
|
186
186
|
|
187
|
-
page.
|
187
|
+
page.locator('div').first.click
|
188
188
|
```
|
189
189
|
|
190
190
|
|
@@ -222,7 +222,7 @@ page.content = <<~HTML
|
|
222
222
|
<button onclick="onClick()">Click me</button>
|
223
223
|
<div></div>
|
224
224
|
HTML
|
225
|
-
page.
|
225
|
+
page.locator("button").click
|
226
226
|
```
|
227
227
|
|
228
228
|
|
@@ -434,7 +434,7 @@ value. Will throw an error if the context closes before the event is fired. Retu
|
|
434
434
|
|
435
435
|
```ruby
|
436
436
|
new_page = browser_context.expect_event('page') do
|
437
|
-
page.
|
437
|
+
page.locator('button').click
|
438
438
|
end
|
439
439
|
```
|
440
440
|
|
@@ -55,7 +55,7 @@ def bounding_box
|
|
55
55
|
This method returns the bounding box of the element, or `null` if the element is not visible. The bounding box is
|
56
56
|
calculated relative to the main frame viewport - which is usually the same as the browser window.
|
57
57
|
|
58
|
-
Scrolling affects the returned
|
58
|
+
Scrolling affects the returned bounding box, similarly to
|
59
59
|
[Element.getBoundingClientRect](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect). That
|
60
60
|
means `x` and/or `y` may be negative.
|
61
61
|
|
@@ -34,7 +34,7 @@ def bounding_box(timeout: nil)
|
|
34
34
|
This method returns the bounding box of the element, or `null` if the element is not visible. The bounding box is
|
35
35
|
calculated relative to the main frame viewport - which is usually the same as the browser window.
|
36
36
|
|
37
|
-
Scrolling affects the returned
|
37
|
+
Scrolling affects the returned bounding box, similarly to
|
38
38
|
[Element.getBoundingClientRect](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect). That
|
39
39
|
means `x` and/or `y` may be negative.
|
40
40
|
|
@@ -342,6 +342,7 @@ locator.click
|
|
342
342
|
```
|
343
343
|
def get_attribute(name, timeout: nil)
|
344
344
|
```
|
345
|
+
alias: `[]`
|
345
346
|
|
346
347
|
Returns element attribute value.
|
347
348
|
|
@@ -462,7 +462,7 @@ page.content = <<~HTML
|
|
462
462
|
<button onclick="onClick()">Click me</button>
|
463
463
|
<div></div>
|
464
464
|
HTML
|
465
|
-
page.
|
465
|
+
page.locator("button").click
|
466
466
|
```
|
467
467
|
|
468
468
|
An example of passing an element handle:
|
@@ -483,7 +483,7 @@ page.content = <<~HTML
|
|
483
483
|
<div>Or click me</div>
|
484
484
|
HTML
|
485
485
|
|
486
|
-
page.
|
486
|
+
page.locator('div').first.click
|
487
487
|
```
|
488
488
|
|
489
489
|
|
@@ -522,7 +522,7 @@ page.content = <<~HTML
|
|
522
522
|
<button onclick="onClick()">Click me</button>
|
523
523
|
<div></div>
|
524
524
|
HTML
|
525
|
-
page.
|
525
|
+
page.locator("button").click
|
526
526
|
```
|
527
527
|
|
528
528
|
|
@@ -47,7 +47,7 @@ def fallback(headers: nil, method: nil, postData: nil, url: nil)
|
|
47
47
|
```
|
48
48
|
|
49
49
|
When several routes match the given pattern, they run in the order opposite to their registration. That way the last
|
50
|
-
registered route can always override all the
|
50
|
+
registered route can always override all the previous ones. In the example below, request will be handled by the
|
51
51
|
bottom-most handler first, then it'll fall back to the previous one and in the end will be aborted by the first
|
52
52
|
registered route.
|
53
53
|
|
@@ -36,9 +36,9 @@ playwright.chromium.launch do |browser|
|
|
36
36
|
page.content = '<div><button>Click me</button></div>'
|
37
37
|
|
38
38
|
# Use the selector prefixed with its name.
|
39
|
-
button = page.
|
39
|
+
button = page.locator('tag=button')
|
40
40
|
# Combine it with other selector engines.
|
41
|
-
page.
|
41
|
+
page.locator('tag=div >> text="Click me"').click
|
42
42
|
|
43
43
|
# Can use it in any methods supporting selectors.
|
44
44
|
button_count = page.locator('tag=button').count
|
@@ -58,7 +58,7 @@ page = context.new_page
|
|
58
58
|
page.goto("https://playwright.dev")
|
59
59
|
|
60
60
|
context.tracing.start_chunk
|
61
|
-
page.
|
61
|
+
page.locator("text=Get Started").click
|
62
62
|
# Everything between start_chunk and stop_chunk will be recorded in the trace.
|
63
63
|
context.tracing.stop_chunk(path: "trace1.zip")
|
64
64
|
|
data/documentation/package.json
CHANGED
@@ -14,11 +14,11 @@
|
|
14
14
|
"write-heading-ids": "docusaurus write-heading-ids"
|
15
15
|
},
|
16
16
|
"dependencies": {
|
17
|
-
"@docusaurus/core": "^2.0.
|
18
|
-
"@docusaurus/preset-classic": "^2.0.
|
17
|
+
"@docusaurus/core": "^2.0.1",
|
18
|
+
"@docusaurus/preset-classic": "^2.0.1",
|
19
19
|
"@mdx-js/react": "^1.6.22",
|
20
|
-
"@svgr/webpack": "^6.
|
21
|
-
"clsx": "^1.
|
20
|
+
"@svgr/webpack": "^6.3.1",
|
21
|
+
"clsx": "^1.2.1",
|
22
22
|
"file-loader": "^6.2.0",
|
23
23
|
"react": "^18.0.0",
|
24
24
|
"react-dom": "^18.0.0",
|