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
@@ -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
|
@@ -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 << "
|
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})"
|
data/lib/playwright/version.rb
CHANGED
@@ -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.
|
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.
|
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.
|
361
|
+
# page.locator("button").click()
|
362
362
|
# page = event_info.value
|
363
363
|
# ```
|
364
364
|
def expect_event(event, predicate: nil, timeout: nil, &block)
|
@@ -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
|
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
|
#
|
@@ -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
|
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.
|
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`].
|
data/lib/playwright_api/route.rb
CHANGED
@@ -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
|
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.
|
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.
|
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.
|
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
|
+
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.
|
402
|
+
summary: The Ruby binding of playwright driver 1.24.2
|
403
403
|
test_files: []
|