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.
@@ -48,6 +48,10 @@ module Playwright
48
48
  return DateTime.parse(hash['d'])
49
49
  end
50
50
 
51
+ if hash.key?('u')
52
+ return URI(hash['u'])
53
+ end
54
+
51
55
  if hash.key?('r')
52
56
  # @see https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/RegExp
53
57
  # @see https://docs.ruby-lang.org/ja/latest/class/Regexp.html
@@ -40,6 +40,8 @@ module Playwright
40
40
  when Time
41
41
  require 'time'
42
42
  { d: value.utc.iso8601 }
43
+ when URI
44
+ { u: value.to_s }
43
45
  when Regexp
44
46
  regex_value = Regex.new(value)
45
47
  { r: { p: regex_value.source, f: regex_value.flag } }
@@ -33,7 +33,7 @@ module Playwright
33
33
  when Regexp
34
34
  regex = JavaScript::Regex.new(hasText)
35
35
  source = EscapeWithQuotes.new(regex.source, '"')
36
- selector_scopes << ":scope:text-matches(#{source}, \"#{regex.flag}\")"
36
+ selector_scopes << "has=#{"text=/#{regex.source}/#{regex.flag}".to_json}"
37
37
  when String
38
38
  text = EscapeWithQuotes.new(hasText, '"')
39
39
  selector_scopes << ":scope:has-text(#{text})"
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Playwright
4
- VERSION = '1.23.0'
5
- COMPATIBLE_PLAYWRIGHT_VERSION = '1.23.4'
4
+ VERSION = '1.24.0'
5
+ COMPATIBLE_PLAYWRIGHT_VERSION = '1.24.2'
6
6
  end
@@ -29,6 +29,10 @@ module Playwright
29
29
  # In case this browser is connected to, clears all created contexts belonging to this browser and disconnects from the
30
30
  # browser server.
31
31
  #
32
+ # > NOTE: This is similar to force quitting the browser. Therefore, you should call [`method: BrowserContext.close`] on
33
+ # any `BrowserContext`'s you explicitly created earlier with [`method: Browser.newContext`] **before** calling
34
+ # [`method: Browser.close`].
35
+ #
32
36
  # The `Browser` object itself is considered to be disposed and cannot be used anymore.
33
37
  def close
34
38
  wrap_impl(@impl.close)
@@ -60,6 +64,11 @@ module Playwright
60
64
 
61
65
  # Creates a new browser context. It won't share cookies/cache with other browser contexts.
62
66
  #
67
+ # > NOTE: If directly using this method to create `BrowserContext`s, it is best practice to explicilty close the returned
68
+ # context via [`method: BrowserContext.close`] when your code is done with the `BrowserContext`, and before calling
69
+ # [`method: Browser.close`]. This will ensure the `context` is closed gracefully and any artifacts—like HARs and
70
+ # videos—are fully flushed and saved.
71
+ #
63
72
  # ```python sync
64
73
  # browser = playwright.firefox.launch() # or "chromium" or "webkit".
65
74
  # # create a new incognito browser context.
@@ -67,6 +76,10 @@ module Playwright
67
76
  # # create a new page in a pristine context.
68
77
  # page = context.new_page()
69
78
  # page.goto("https://example.com")
79
+ #
80
+ # # gracefully close up everything
81
+ # context.close()
82
+ # browser.close()
70
83
  # ```
71
84
  def new_context(
72
85
  acceptDownloads: nil,
@@ -131,7 +131,7 @@ module Playwright
131
131
  # <button onclick="onClick()">Click me</button>
132
132
  # <div></div>
133
133
  # """)
134
- # page.click("button")
134
+ # page.locator("button").click()
135
135
  #
136
136
  # with sync_playwright() as playwright:
137
137
  # run(playwright)
@@ -190,7 +190,7 @@ module Playwright
190
190
  # <button onclick="onClick()">Click me</button>
191
191
  # <div></div>
192
192
  # """)
193
- # page.click("button")
193
+ # page.locator("button").click()
194
194
  #
195
195
  # with sync_playwright() as playwright:
196
196
  # run(playwright)
@@ -358,7 +358,7 @@ module Playwright
358
358
  #
359
359
  # ```python sync
360
360
  # with context.expect_event("page") as event_info:
361
- # page.click("button")
361
+ # page.locator("button").click()
362
362
  # page = event_info.value
363
363
  # ```
364
364
  def expect_event(event, predicate: nil, timeout: nil, &block)
@@ -7,7 +7,7 @@ module Playwright
7
7
  #
8
8
  # ```python sync
9
9
  # with page.expect_download() as download_info:
10
- # page.click("a")
10
+ # page.locator("a").click()
11
11
  # download = download_info.value
12
12
  # # wait for download to complete
13
13
  # path = download.path()
@@ -45,7 +45,7 @@ module Playwright
45
45
  # This method returns the bounding box of the element, or `null` if the element is not visible. The bounding box is
46
46
  # calculated relative to the main frame viewport - which is usually the same as the browser window.
47
47
  #
48
- # Scrolling affects the returned bonding box, similarly to
48
+ # Scrolling affects the returned bounding box, similarly to
49
49
  # [Element.getBoundingClientRect](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect). That
50
50
  # means `x` and/or `y` may be negative.
51
51
  #
@@ -3,7 +3,7 @@ module Playwright
3
3
  #
4
4
  # ```python sync
5
5
  # with page.expect_file_chooser() as fc_info:
6
- # page.click("upload")
6
+ # page.locator("upload").click()
7
7
  # file_chooser = fc_info.value
8
8
  # file_chooser.set_files("myfile.pdf")
9
9
  # ```
@@ -18,7 +18,7 @@ module Playwright
18
18
  # This method returns the bounding box of the element, or `null` if the element is not visible. The bounding box is
19
19
  # calculated relative to the main frame viewport - which is usually the same as the browser window.
20
20
  #
21
- # Scrolling affects the returned bonding box, similarly to
21
+ # Scrolling affects the returned bounding box, similarly to
22
22
  # [Element.getBoundingClientRect](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect). That
23
23
  # means `x` and/or `y` may be negative.
24
24
  #
@@ -228,7 +228,7 @@ module Playwright
228
228
  # multiple times.
229
229
  #
230
230
  # ```python sync
231
- # row_locator = page.lsocator("tr")
231
+ # row_locator = page.locator("tr")
232
232
  # # ...
233
233
  # row_locator
234
234
  # .filter(has_text="text in column 1")
@@ -264,6 +264,7 @@ module Playwright
264
264
  def get_attribute(name, timeout: nil)
265
265
  wrap_impl(@impl.get_attribute(unwrap_impl(name), timeout: unwrap_impl(timeout)))
266
266
  end
267
+ alias_method :[], :get_attribute
267
268
 
268
269
  # Highlight the corresponding element(s) on the screen. Useful for debugging, don't commit the code that uses
269
270
  # [`method: Locator.highlight`].
@@ -29,7 +29,7 @@ module Playwright
29
29
  end
30
30
 
31
31
  # When several routes match the given pattern, they run in the order opposite to their registration. That way the last
32
- # registered route can always override all the previos ones. In the example below, request will be handled by the
32
+ # registered route can always override all the previous ones. In the example below, request will be handled by the
33
33
  # bottom-most handler first, then it'll fall back to the previous one and in the end will be aborted by the first
34
34
  # registered route.
35
35
  #
@@ -30,7 +30,7 @@ module Playwright
30
30
  # # Use the selector prefixed with its name.
31
31
  # button = page.locator('tag=button')
32
32
  # # Combine it with other selector engines.
33
- # page.click('tag=div >> text="Click me"')
33
+ # page.locator('tag=div >> text="Click me"').click()
34
34
  # # Can use it in any methods supporting selectors.
35
35
  # button_count = page.locator('tag=button').count()
36
36
  # print(button_count)
@@ -41,7 +41,7 @@ module Playwright
41
41
  # page.goto("https://playwright.dev")
42
42
  #
43
43
  # context.tracing.start_chunk()
44
- # page.click("text=Get Started")
44
+ # page.locator("text=Get Started").click()
45
45
  # # Everything between start_chunk and stop_chunk will be recorded in the trace.
46
46
  # context.tracing.stop_chunk(path = "trace1.zip")
47
47
  #
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.23.0
4
+ version: 1.24.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-11 00:00:00.000000000 Z
11
+ date: 2022-08-13 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.23.4
402
+ summary: The Ruby binding of playwright driver 1.24.2
403
403
  test_files: []