playwright-ruby-client 1.23.0 → 1.24.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: 5d8cc3ad6fb1bd9c8a42f249085e91f92dbed26ebcbbd310559810299b60ea31
4
- data.tar.gz: 6fb3450345d6f7bcbcbb19e3206244739f8aecf0813a94216e58df03674fb8e1
3
+ metadata.gz: 4e87b002bd3cd1dfaf592f6be37902b0a0604553d419b8b7516e0e887584125a
4
+ data.tar.gz: 5b956c57000f12dc8399df4382dd301a7ef1d47551782afff0fae0871892c630
5
5
  SHA512:
6
- metadata.gz: b4e12e990b3a9df4532154ad62d6064c343664b75d8f29d088e6c28c00b5f22608d3de49c3568af2e2ac8689e9d9769e478e36571e7921d928c21eb3a18d9a56
7
- data.tar.gz: 49f939af824f3affd9bbb011eb389238d5484a3f320fed6ad170bfb8c011ac351f6dba239f4e685d6b9058f4b72461fd5d1b5aee98835e34948eeef90b535dbc
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
- context = browser.new_context
128
-
129
- # create a new page in a pristine context.
130
- page = context.new_page()
131
- page.goto("https://example.com")
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.click("button")
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.click('div')
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.click("button")
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.click('button')
437
+ page.locator('button').click
438
438
  end
439
439
  ```
440
440
 
@@ -12,7 +12,7 @@ Download event is emitted once the download starts. Download path becomes availa
12
12
 
13
13
  ```ruby
14
14
  download = page.expect_download do
15
- page.click('a')
15
+ page.locator('a').click
16
16
  end
17
17
 
18
18
  # wait for download to complete
@@ -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 bonding box, similarly to
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
 
@@ -8,7 +8,7 @@ sidebar_position: 10
8
8
 
9
9
  ```ruby
10
10
  file_chooser = page.expect_file_chooser do
11
- page.click("upload") # action to trigger file uploading
11
+ page.locator("upload").click # action to trigger file uploading
12
12
  end
13
13
  file_chooser.set_files("myfile.pdf")
14
14
  ```
@@ -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 bonding box, similarly to
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.click("button")
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.click('div')
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.click("button")
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 previos ones. In the example below, request will be handled by 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.query_selector('tag=button')
39
+ button = page.locator('tag=button')
40
40
  # Combine it with other selector engines.
41
- page.click('tag=div >> text="Click me"')
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.click("text=Get Started")
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
 
@@ -14,11 +14,11 @@
14
14
  "write-heading-ids": "docusaurus write-heading-ids"
15
15
  },
16
16
  "dependencies": {
17
- "@docusaurus/core": "^2.0.0-beta.18",
18
- "@docusaurus/preset-classic": "^2.0.0-beta.18",
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.2.1",
21
- "clsx": "^1.1.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",