playwright-ruby-client 1.55.0 → 1.57.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 +4 -4
- data/CONTRIBUTING.md +5 -0
- data/README.md +4 -0
- data/documentation/docs/api/browser_context.md +6 -2
- data/documentation/docs/api/console_message.md +9 -0
- data/documentation/docs/api/element_handle.md +2 -0
- data/documentation/docs/api/frame.md +1 -0
- data/documentation/docs/api/locator.md +22 -0
- data/documentation/docs/api/page.md +32 -2
- data/documentation/docs/api/worker.md +20 -0
- data/documentation/docs/article/guides/playwright_on_alpine_linux.md +19 -0
- data/documentation/docs/article/guides/rails_integration.md +43 -2
- data/documentation/docs/include/api_coverage.md +6 -5
- data/documentation/package.json +3 -3
- data/documentation/yarn.lock +3754 -3372
- data/lib/playwright/channel_owners/browser_context.rb +7 -16
- data/lib/playwright/channel_owners/element_handle.rb +6 -2
- data/lib/playwright/channel_owners/frame.rb +9 -3
- data/lib/playwright/channel_owners/page.rb +49 -10
- data/lib/playwright/channel_owners/worker.rb +19 -0
- data/lib/playwright/console_message_impl.rb +4 -4
- data/lib/playwright/events.rb +1 -0
- data/lib/playwright/locator_assertions_impl.rb +5 -2
- data/lib/playwright/locator_impl.rb +25 -5
- data/lib/playwright/page_assertions_impl.rb +5 -2
- data/lib/playwright/version.rb +2 -2
- data/lib/playwright/web_socket_transport.rb +1 -1
- data/lib/playwright.rb +4 -0
- data/lib/playwright_api/browser_context.rb +2 -2
- data/lib/playwright_api/console_message.rb +6 -0
- data/lib/playwright_api/element_handle.rb +4 -2
- data/lib/playwright_api/frame.rb +2 -1
- data/lib/playwright_api/locator.rb +23 -4
- data/lib/playwright_api/page.rb +31 -12
- data/lib/playwright_api/worker.rb +20 -3
- data/sig/playwright.rbs +13 -12
- metadata +3 -5
- data/documentation/docs/api/accessibility.md +0 -66
- data/lib/playwright/accessibility_impl.rb +0 -50
- data/lib/playwright_api/accessibility.rb +0 -57
data/lib/playwright_api/page.rb
CHANGED
|
@@ -49,10 +49,6 @@ module Playwright
|
|
|
49
49
|
wrap_impl(@impl.clock)
|
|
50
50
|
end
|
|
51
51
|
|
|
52
|
-
def accessibility # property
|
|
53
|
-
wrap_impl(@impl.accessibility)
|
|
54
|
-
end
|
|
55
|
-
|
|
56
52
|
def keyboard # property
|
|
57
53
|
wrap_impl(@impl.keyboard)
|
|
58
54
|
end
|
|
@@ -278,11 +274,12 @@ module Playwright
|
|
|
278
274
|
force: nil,
|
|
279
275
|
noWaitAfter: nil,
|
|
280
276
|
sourcePosition: nil,
|
|
277
|
+
steps: nil,
|
|
281
278
|
strict: nil,
|
|
282
279
|
targetPosition: nil,
|
|
283
280
|
timeout: nil,
|
|
284
281
|
trial: nil)
|
|
285
|
-
wrap_impl(@impl.drag_and_drop(unwrap_impl(source), unwrap_impl(target), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), sourcePosition: unwrap_impl(sourcePosition), strict: unwrap_impl(strict), targetPosition: unwrap_impl(targetPosition), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
|
|
282
|
+
wrap_impl(@impl.drag_and_drop(unwrap_impl(source), unwrap_impl(target), force: unwrap_impl(force), noWaitAfter: unwrap_impl(noWaitAfter), sourcePosition: unwrap_impl(sourcePosition), steps: unwrap_impl(steps), strict: unwrap_impl(strict), targetPosition: unwrap_impl(targetPosition), timeout: unwrap_impl(timeout), trial: unwrap_impl(trial)))
|
|
286
283
|
end
|
|
287
284
|
|
|
288
285
|
#
|
|
@@ -922,6 +919,18 @@ module Playwright
|
|
|
922
919
|
wrap_impl(@impl.visible?(unwrap_impl(selector), strict: unwrap_impl(strict), timeout: unwrap_impl(timeout)))
|
|
923
920
|
end
|
|
924
921
|
|
|
922
|
+
#
|
|
923
|
+
# Returns up to (currently) 200 last console messages from this page. See [`event: Page.console`] for more details.
|
|
924
|
+
def console_messages
|
|
925
|
+
wrap_impl(@impl.console_messages)
|
|
926
|
+
end
|
|
927
|
+
|
|
928
|
+
#
|
|
929
|
+
# Returns up to (currently) 200 last page errors from this page. See [`event: Page.pageError`] for more details.
|
|
930
|
+
def page_errors
|
|
931
|
+
wrap_impl(@impl.page_errors)
|
|
932
|
+
end
|
|
933
|
+
|
|
925
934
|
#
|
|
926
935
|
# The method returns an element locator that can be used to perform actions on this page / frame.
|
|
927
936
|
# Locator is resolved to the element immediately before performing an action, so a series of actions on the same locator can in fact be performed on different DOM elements. That would happen if the DOM structure between those actions has changed.
|
|
@@ -1085,6 +1094,16 @@ module Playwright
|
|
|
1085
1094
|
wrap_impl(@impl.query_selector_all(unwrap_impl(selector)))
|
|
1086
1095
|
end
|
|
1087
1096
|
|
|
1097
|
+
#
|
|
1098
|
+
# Returns up to (currently) 100 last network request from this page. See [`event: Page.request`] for more details.
|
|
1099
|
+
#
|
|
1100
|
+
# Returned requests should be accessed immediately, otherwise they might be collected to prevent unbounded memory growth as new requests come in. Once collected, retrieving most information about the request is impossible.
|
|
1101
|
+
#
|
|
1102
|
+
# Note that requests reported through the [`event: Page.request`] request are not collected, so there is a trade off between efficient memory usage with [`method: Page.requests`] and the amount of available information reported through [`event: Page.request`].
|
|
1103
|
+
def requests
|
|
1104
|
+
wrap_impl(@impl.requests)
|
|
1105
|
+
end
|
|
1106
|
+
|
|
1088
1107
|
#
|
|
1089
1108
|
# When testing a web page, sometimes unexpected overlays like a "Sign up" dialog appear and block actions you want to automate, e.g. clicking a button. These overlays don't always show up in the same way or at the same time, making them tricky to handle in automated tests.
|
|
1090
1109
|
#
|
|
@@ -1799,8 +1818,8 @@ module Playwright
|
|
|
1799
1818
|
end
|
|
1800
1819
|
|
|
1801
1820
|
# @nodoc
|
|
1802
|
-
def snapshot_for_ai(timeout: nil)
|
|
1803
|
-
wrap_impl(@impl.snapshot_for_ai(timeout: unwrap_impl(timeout)))
|
|
1821
|
+
def snapshot_for_ai(timeout: nil, mode: nil, track: nil)
|
|
1822
|
+
wrap_impl(@impl.snapshot_for_ai(timeout: unwrap_impl(timeout), mode: unwrap_impl(mode), track: unwrap_impl(track)))
|
|
1804
1823
|
end
|
|
1805
1824
|
|
|
1806
1825
|
# @nodoc
|
|
@@ -1808,11 +1827,6 @@ module Playwright
|
|
|
1808
1827
|
wrap_impl(@impl.start_js_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
|
|
1809
1828
|
end
|
|
1810
1829
|
|
|
1811
|
-
# @nodoc
|
|
1812
|
-
def stop_js_coverage
|
|
1813
|
-
wrap_impl(@impl.stop_js_coverage)
|
|
1814
|
-
end
|
|
1815
|
-
|
|
1816
1830
|
# @nodoc
|
|
1817
1831
|
def start_css_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
|
|
1818
1832
|
wrap_impl(@impl.start_css_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
|
|
@@ -1828,6 +1842,11 @@ module Playwright
|
|
|
1828
1842
|
wrap_impl(@impl.owned_context=(unwrap_impl(req)))
|
|
1829
1843
|
end
|
|
1830
1844
|
|
|
1845
|
+
# @nodoc
|
|
1846
|
+
def stop_js_coverage
|
|
1847
|
+
wrap_impl(@impl.stop_js_coverage)
|
|
1848
|
+
end
|
|
1849
|
+
|
|
1831
1850
|
# -- inherited from EventEmitter --
|
|
1832
1851
|
# @nodoc
|
|
1833
1852
|
def once(event, callback)
|
|
@@ -46,9 +46,21 @@ module Playwright
|
|
|
46
46
|
wrap_impl(@impl.url)
|
|
47
47
|
end
|
|
48
48
|
|
|
49
|
-
#
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
#
|
|
50
|
+
# Waits for event to fire and passes its value into the predicate function.
|
|
51
|
+
# Returns when the predicate returns truthy value.
|
|
52
|
+
# Will throw an error if the page is closed before the event is fired.
|
|
53
|
+
# Returns the event data value.
|
|
54
|
+
#
|
|
55
|
+
# **Usage**
|
|
56
|
+
#
|
|
57
|
+
# ```python sync
|
|
58
|
+
# with worker.expect_event("console") as event_info:
|
|
59
|
+
# worker.evaluate("console.log(42)")
|
|
60
|
+
# message = event_info.value
|
|
61
|
+
# ```
|
|
62
|
+
def expect_event(event, predicate: nil, timeout: nil, &block)
|
|
63
|
+
wrap_impl(@impl.expect_event(unwrap_impl(event), predicate: unwrap_impl(predicate), timeout: unwrap_impl(timeout), &wrap_block_call(block)))
|
|
52
64
|
end
|
|
53
65
|
|
|
54
66
|
# @nodoc
|
|
@@ -56,6 +68,11 @@ module Playwright
|
|
|
56
68
|
wrap_impl(@impl.context=(unwrap_impl(req)))
|
|
57
69
|
end
|
|
58
70
|
|
|
71
|
+
# @nodoc
|
|
72
|
+
def page=(req)
|
|
73
|
+
wrap_impl(@impl.page=(unwrap_impl(req)))
|
|
74
|
+
end
|
|
75
|
+
|
|
59
76
|
# -- inherited from EventEmitter --
|
|
60
77
|
# @nodoc
|
|
61
78
|
def once(event, callback)
|
data/sig/playwright.rbs
CHANGED
|
@@ -94,9 +94,9 @@ module Playwright
|
|
|
94
94
|
class ElementHandle < JSHandle
|
|
95
95
|
def bounding_box: -> (nil | Hash[untyped, untyped])
|
|
96
96
|
def check: (?force: bool, ?noWaitAfter: bool, ?position: Hash[untyped, untyped], ?timeout: Float, ?trial: bool) -> void
|
|
97
|
-
def click: (?button: ("left" | "right" | "middle"), ?clickCount: Integer, ?delay: Float, ?force: bool, ?modifiers: Array[untyped], ?noWaitAfter: bool, ?position: Hash[untyped, untyped], ?timeout: Float, ?trial: bool) -> void
|
|
97
|
+
def click: (?button: ("left" | "right" | "middle"), ?clickCount: Integer, ?delay: Float, ?force: bool, ?modifiers: Array[untyped], ?noWaitAfter: bool, ?position: Hash[untyped, untyped], ?steps: Integer, ?timeout: Float, ?trial: bool) -> void
|
|
98
98
|
def content_frame: -> (nil | Frame)
|
|
99
|
-
def dblclick: (?button: ("left" | "right" | "middle"), ?delay: Float, ?force: bool, ?modifiers: Array[untyped], ?noWaitAfter: bool, ?position: Hash[untyped, untyped], ?timeout: Float, ?trial: bool) -> void
|
|
99
|
+
def dblclick: (?button: ("left" | "right" | "middle"), ?delay: Float, ?force: bool, ?modifiers: Array[untyped], ?noWaitAfter: bool, ?position: Hash[untyped, untyped], ?steps: Integer, ?timeout: Float, ?trial: bool) -> void
|
|
100
100
|
def dispatch_event: (String type_, ?eventInit: untyped) -> void
|
|
101
101
|
def eval_on_selector: (String selector, String expression, ?arg: untyped) -> untyped
|
|
102
102
|
def eval_on_selector_all: (String selector, String expression, ?arg: untyped) -> untyped
|
|
@@ -134,10 +134,6 @@ module Playwright
|
|
|
134
134
|
def wait_for_selector: (String selector, ?state: ("attached" | "detached" | "visible" | "hidden"), ?strict: bool, ?timeout: Float) -> (nil | ElementHandle)
|
|
135
135
|
end
|
|
136
136
|
|
|
137
|
-
class Accessibility
|
|
138
|
-
def snapshot: (?interestingOnly: bool, ?root: ElementHandle) -> (nil | Hash[untyped, untyped])
|
|
139
|
-
end
|
|
140
|
-
|
|
141
137
|
class FileChooser
|
|
142
138
|
def element: -> ElementHandle
|
|
143
139
|
def multiple?: -> bool
|
|
@@ -155,7 +151,7 @@ module Playwright
|
|
|
155
151
|
def content: -> String
|
|
156
152
|
def dblclick: (String selector, ?button: ("left" | "right" | "middle"), ?delay: Float, ?force: bool, ?modifiers: Array[untyped], ?noWaitAfter: bool, ?position: Hash[untyped, untyped], ?strict: bool, ?timeout: Float, ?trial: bool) -> void
|
|
157
153
|
def dispatch_event: (String selector, String type_, ?eventInit: untyped, ?strict: bool, ?timeout: Float) -> void
|
|
158
|
-
def drag_and_drop: (String source, String target, ?force: bool, ?noWaitAfter: bool, ?sourcePosition: Hash[untyped, untyped], ?strict: bool, ?targetPosition: Hash[untyped, untyped], ?timeout: Float, ?trial: bool) -> void
|
|
154
|
+
def drag_and_drop: (String source, String target, ?force: bool, ?noWaitAfter: bool, ?sourcePosition: Hash[untyped, untyped], ?steps: Integer, ?strict: bool, ?targetPosition: Hash[untyped, untyped], ?timeout: Float, ?trial: bool) -> void
|
|
159
155
|
def eval_on_selector: (String selector, String expression, ?arg: untyped, ?strict: bool) -> untyped
|
|
160
156
|
def eval_on_selector_all: (String selector, String expression, ?arg: untyped) -> untyped
|
|
161
157
|
def evaluate: (String expression, ?arg: untyped) -> untyped
|
|
@@ -215,6 +211,7 @@ module Playwright
|
|
|
215
211
|
def evaluate: (String expression, ?arg: untyped) -> untyped
|
|
216
212
|
def evaluate_handle: (String expression, ?arg: untyped) -> JSHandle
|
|
217
213
|
def url: -> String
|
|
214
|
+
def expect_event: (String event, ?predicate: function, ?timeout: Float) { () -> void } -> untyped
|
|
218
215
|
end
|
|
219
216
|
|
|
220
217
|
class Selectors
|
|
@@ -241,6 +238,7 @@ module Playwright
|
|
|
241
238
|
def page: -> (nil | Page)
|
|
242
239
|
def text: -> String
|
|
243
240
|
def type: -> ("log" | "debug" | "info" | "error" | "warning" | "dir" | "dirxml" | "table" | "trace" | "clear" | "startGroup" | "startGroupCollapsed" | "endGroup" | "assert" | "profile" | "profileEnd" | "count" | "timeEnd")
|
|
241
|
+
def worker: -> (nil | Worker)
|
|
244
242
|
end
|
|
245
243
|
|
|
246
244
|
class Dialog
|
|
@@ -275,7 +273,7 @@ module Playwright
|
|
|
275
273
|
def context: -> BrowserContext
|
|
276
274
|
def dblclick: (String selector, ?button: ("left" | "right" | "middle"), ?delay: Float, ?force: bool, ?modifiers: Array[untyped], ?noWaitAfter: bool, ?position: Hash[untyped, untyped], ?strict: bool, ?timeout: Float, ?trial: bool) -> void
|
|
277
275
|
def dispatch_event: (String selector, String type_, ?eventInit: untyped, ?strict: bool, ?timeout: Float) -> void
|
|
278
|
-
def drag_and_drop: (String source, String target, ?force: bool, ?noWaitAfter: bool, ?sourcePosition: Hash[untyped, untyped], ?strict: bool, ?targetPosition: Hash[untyped, untyped], ?timeout: Float, ?trial: bool) -> void
|
|
276
|
+
def drag_and_drop: (String source, String target, ?force: bool, ?noWaitAfter: bool, ?sourcePosition: Hash[untyped, untyped], ?steps: Integer, ?strict: bool, ?targetPosition: Hash[untyped, untyped], ?timeout: Float, ?trial: bool) -> void
|
|
279
277
|
def emulate_media: (?colorScheme: ("light" | "dark" | "no-preference" | "null"), ?contrast: ("no-preference" | "more" | "null"), ?forcedColors: ("active" | "none" | "null"), ?media: ("screen" | "print" | "null"), ?reducedMotion: ("reduce" | "no-preference" | "null")) -> void
|
|
280
278
|
def eval_on_selector: (String selector, String expression, ?arg: untyped, ?strict: bool) -> untyped
|
|
281
279
|
def eval_on_selector_all: (String selector, String expression, ?arg: untyped) -> untyped
|
|
@@ -311,6 +309,8 @@ module Playwright
|
|
|
311
309
|
def enabled?: (String selector, ?strict: bool, ?timeout: Float) -> bool
|
|
312
310
|
def hidden?: (String selector, ?strict: bool, ?timeout: Float) -> bool
|
|
313
311
|
def visible?: (String selector, ?strict: bool, ?timeout: Float) -> bool
|
|
312
|
+
def console_messages: -> Array[untyped]
|
|
313
|
+
def page_errors: -> Array[untyped]
|
|
314
314
|
def locator: (String selector, ?has: Locator, ?hasNot: Locator, ?hasNotText: (String | Regexp), ?hasText: (String | Regexp)) -> Locator
|
|
315
315
|
def main_frame: -> Frame
|
|
316
316
|
def opener: -> (nil | Page)
|
|
@@ -319,6 +319,7 @@ module Playwright
|
|
|
319
319
|
def press: (String selector, String key, ?delay: Float, ?noWaitAfter: bool, ?strict: bool, ?timeout: Float) -> void
|
|
320
320
|
def query_selector: (String selector, ?strict: bool) -> (nil | ElementHandle)
|
|
321
321
|
def query_selector_all: (String selector) -> Array[untyped]
|
|
322
|
+
def requests: -> Array[untyped]
|
|
322
323
|
def reload: (?timeout: Float, ?waitUntil: ("load" | "domcontentloaded" | "networkidle" | "commit")) -> (nil | Response)
|
|
323
324
|
def route: ((String | Regexp | function) url, function handler, ?times: Integer) -> void
|
|
324
325
|
def route_from_har: ((String | File) har, ?notFound: ("abort" | "fallback"), ?update: bool, ?updateContent: ("embed" | "attach"), ?updateMode: ("full" | "minimal"), ?url: (String | Regexp)) -> void
|
|
@@ -365,7 +366,6 @@ module Playwright
|
|
|
365
366
|
def workers: -> Array[untyped]
|
|
366
367
|
|
|
367
368
|
attr_reader clock: Clock
|
|
368
|
-
attr_reader accessibility: Accessibility
|
|
369
369
|
attr_reader keyboard: Keyboard
|
|
370
370
|
attr_reader mouse: Mouse
|
|
371
371
|
attr_reader request: APIRequestContext
|
|
@@ -465,12 +465,13 @@ module Playwright
|
|
|
465
465
|
def bounding_box: (?timeout: Float) -> (nil | Hash[untyped, untyped])
|
|
466
466
|
def check: (?force: bool, ?noWaitAfter: bool, ?position: Hash[untyped, untyped], ?timeout: Float, ?trial: bool) -> void
|
|
467
467
|
def clear: (?force: bool, ?noWaitAfter: bool, ?timeout: Float) -> void
|
|
468
|
-
def click: (?button: ("left" | "right" | "middle"), ?clickCount: Integer, ?delay: Float, ?force: bool, ?modifiers: Array[untyped], ?noWaitAfter: bool, ?position: Hash[untyped, untyped], ?timeout: Float, ?trial: bool) -> void
|
|
468
|
+
def click: (?button: ("left" | "right" | "middle"), ?clickCount: Integer, ?delay: Float, ?force: bool, ?modifiers: Array[untyped], ?noWaitAfter: bool, ?position: Hash[untyped, untyped], ?steps: Integer, ?timeout: Float, ?trial: bool) -> void
|
|
469
469
|
def count: -> Integer
|
|
470
|
-
def dblclick: (?button: ("left" | "right" | "middle"), ?delay: Float, ?force: bool, ?modifiers: Array[untyped], ?noWaitAfter: bool, ?position: Hash[untyped, untyped], ?timeout: Float, ?trial: bool) -> void
|
|
470
|
+
def dblclick: (?button: ("left" | "right" | "middle"), ?delay: Float, ?force: bool, ?modifiers: Array[untyped], ?noWaitAfter: bool, ?position: Hash[untyped, untyped], ?steps: Integer, ?timeout: Float, ?trial: bool) -> void
|
|
471
471
|
def describe: (String description) -> Locator
|
|
472
|
+
def description: -> (nil | String)
|
|
472
473
|
def dispatch_event: (String type_, ?eventInit: untyped, ?timeout: Float) -> void
|
|
473
|
-
def drag_to: (Locator target, ?force: bool, ?noWaitAfter: bool, ?sourcePosition: Hash[untyped, untyped], ?targetPosition: Hash[untyped, untyped], ?timeout: Float, ?trial: bool) -> void
|
|
474
|
+
def drag_to: (Locator target, ?force: bool, ?noWaitAfter: bool, ?sourcePosition: Hash[untyped, untyped], ?steps: Integer, ?targetPosition: Hash[untyped, untyped], ?timeout: Float, ?trial: bool) -> void
|
|
474
475
|
def element_handle: (?timeout: Float) -> ElementHandle
|
|
475
476
|
def element_handles: -> Array[untyped]
|
|
476
477
|
def content_frame: -> FrameLocator
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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.57.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- YusukeIwaki
|
|
@@ -199,6 +199,7 @@ extra_rdoc_files: []
|
|
|
199
199
|
files:
|
|
200
200
|
- ".rspec"
|
|
201
201
|
- CODE_OF_CONDUCT.md
|
|
202
|
+
- CONTRIBUTING.md
|
|
202
203
|
- Gemfile
|
|
203
204
|
- LICENSE.txt
|
|
204
205
|
- README.md
|
|
@@ -207,7 +208,6 @@ files:
|
|
|
207
208
|
- bin/setup
|
|
208
209
|
- documentation/README.md
|
|
209
210
|
- documentation/babel.config.js
|
|
210
|
-
- documentation/docs/api/accessibility.md
|
|
211
211
|
- documentation/docs/api/api_request.md
|
|
212
212
|
- documentation/docs/api/api_request_context.md
|
|
213
213
|
- documentation/docs/api/api_response.md
|
|
@@ -276,7 +276,6 @@ files:
|
|
|
276
276
|
- documentation/static/img/undraw_windows.svg
|
|
277
277
|
- documentation/yarn.lock
|
|
278
278
|
- lib/playwright.rb
|
|
279
|
-
- lib/playwright/accessibility_impl.rb
|
|
280
279
|
- lib/playwright/android_input_impl.rb
|
|
281
280
|
- lib/playwright/api_implementation.rb
|
|
282
281
|
- lib/playwright/api_response_impl.rb
|
|
@@ -350,7 +349,6 @@ files:
|
|
|
350
349
|
- lib/playwright/waiter.rb
|
|
351
350
|
- lib/playwright/web_socket_client.rb
|
|
352
351
|
- lib/playwright/web_socket_transport.rb
|
|
353
|
-
- lib/playwright_api/accessibility.rb
|
|
354
352
|
- lib/playwright_api/android.rb
|
|
355
353
|
- lib/playwright_api/android_device.rb
|
|
356
354
|
- lib/playwright_api/android_input.rb
|
|
@@ -409,5 +407,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
409
407
|
requirements: []
|
|
410
408
|
rubygems_version: 3.6.9
|
|
411
409
|
specification_version: 4
|
|
412
|
-
summary: The Ruby binding of playwright driver 1.
|
|
410
|
+
summary: The Ruby binding of playwright driver 1.57.0
|
|
413
411
|
test_files: []
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
sidebar_position: 10
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Accessibility
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
The Accessibility class provides methods for inspecting Chromium's accessibility tree. The accessibility tree is used by
|
|
9
|
-
assistive technology such as [screen readers](https://en.wikipedia.org/wiki/Screen_reader) or
|
|
10
|
-
[switches](https://en.wikipedia.org/wiki/Switch_access).
|
|
11
|
-
|
|
12
|
-
Accessibility is a very platform-specific thing. On different platforms, there are different screen readers that might
|
|
13
|
-
have wildly different output.
|
|
14
|
-
|
|
15
|
-
Rendering engines of Chromium, Firefox and WebKit have a concept of "accessibility tree", which is then translated into different
|
|
16
|
-
platform-specific APIs. Accessibility namespace gives access to this Accessibility Tree.
|
|
17
|
-
|
|
18
|
-
Most of the accessibility tree gets filtered out when converting from internal browser AX Tree to Platform-specific AX-Tree or by
|
|
19
|
-
assistive technologies themselves. By default, Playwright tries to approximate this filtering, exposing only the
|
|
20
|
-
"interesting" nodes of the tree.
|
|
21
|
-
|
|
22
|
-
## snapshot
|
|
23
|
-
|
|
24
|
-
```
|
|
25
|
-
def snapshot(interestingOnly: nil, root: nil)
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
:::warning
|
|
29
|
-
|
|
30
|
-
This method is deprecated. Please use other libraries such as [Axe](https://www.deque.com/axe/) if you need to test page accessibility. See our Node.js [guide](https://playwright.dev/docs/accessibility-testing) for integration with Axe.
|
|
31
|
-
|
|
32
|
-
:::
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
Captures the current state of the accessibility tree. The returned object represents the root accessible node of the
|
|
36
|
-
page.
|
|
37
|
-
|
|
38
|
-
**NOTE**: The Chromium accessibility tree contains nodes that go unused on most platforms and by most screen readers. Playwright
|
|
39
|
-
will discard them as well for an easier to process tree, unless `interestingOnly` is set to `false`.
|
|
40
|
-
|
|
41
|
-
**Usage**
|
|
42
|
-
|
|
43
|
-
An example of dumping the entire accessibility tree:
|
|
44
|
-
|
|
45
|
-
```ruby
|
|
46
|
-
snapshot = page.accessibility.snapshot
|
|
47
|
-
puts snapshot
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
An example of logging the focused node's name:
|
|
51
|
-
|
|
52
|
-
```ruby
|
|
53
|
-
def find_focused_node(node)
|
|
54
|
-
if node['focused']
|
|
55
|
-
node
|
|
56
|
-
else
|
|
57
|
-
node['children']&.find do |child|
|
|
58
|
-
find_focused_node(child)
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
snapshot = page.accessibility.snapshot
|
|
64
|
-
node = find_focused_node(snapshot)
|
|
65
|
-
puts node['name']
|
|
66
|
-
```
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
module Playwright
|
|
2
|
-
define_api_implementation :AccessibilityImpl do
|
|
3
|
-
def initialize(channel)
|
|
4
|
-
@channel = channel
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
def snapshot(interestingOnly: nil, root: nil)
|
|
8
|
-
params = {
|
|
9
|
-
interestingOnly: interestingOnly,
|
|
10
|
-
root: root&.channel,
|
|
11
|
-
}.compact
|
|
12
|
-
result = @channel.send_message_to_server('accessibilitySnapshot', params)
|
|
13
|
-
format_ax_node_from_protocol(result) if result
|
|
14
|
-
result
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
# original JS implementation create a new Hash from ax_node,
|
|
18
|
-
# but this implementation directly modify ax_node and don't return hash.
|
|
19
|
-
private def format_ax_node_from_protocol(ax_node)
|
|
20
|
-
value = ax_node.delete('valueNumber') || ax_node.delete('valueString')
|
|
21
|
-
ax_node['value'] = value unless value.nil?
|
|
22
|
-
|
|
23
|
-
checked =
|
|
24
|
-
case ax_node['checked']
|
|
25
|
-
when 'checked'
|
|
26
|
-
true
|
|
27
|
-
when 'unchecked'
|
|
28
|
-
false
|
|
29
|
-
else
|
|
30
|
-
ax_node['checked']
|
|
31
|
-
end
|
|
32
|
-
ax_node['checked'] = checked unless checked.nil?
|
|
33
|
-
|
|
34
|
-
pressed =
|
|
35
|
-
case ax_node['pressed']
|
|
36
|
-
when 'pressed'
|
|
37
|
-
true
|
|
38
|
-
when 'released'
|
|
39
|
-
false
|
|
40
|
-
else
|
|
41
|
-
ax_node['pressed']
|
|
42
|
-
end
|
|
43
|
-
ax_node['pressed'] = pressed unless pressed.nil?
|
|
44
|
-
|
|
45
|
-
ax_node['children']&.each do |child|
|
|
46
|
-
format_ax_node_from_protocol(child)
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
end
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
module Playwright
|
|
2
|
-
#
|
|
3
|
-
# The Accessibility class provides methods for inspecting Chromium's accessibility tree. The accessibility tree is used by
|
|
4
|
-
# assistive technology such as [screen readers](https://en.wikipedia.org/wiki/Screen_reader) or
|
|
5
|
-
# [switches](https://en.wikipedia.org/wiki/Switch_access).
|
|
6
|
-
#
|
|
7
|
-
# Accessibility is a very platform-specific thing. On different platforms, there are different screen readers that might
|
|
8
|
-
# have wildly different output.
|
|
9
|
-
#
|
|
10
|
-
# Rendering engines of Chromium, Firefox and WebKit have a concept of "accessibility tree", which is then translated into different
|
|
11
|
-
# platform-specific APIs. Accessibility namespace gives access to this Accessibility Tree.
|
|
12
|
-
#
|
|
13
|
-
# Most of the accessibility tree gets filtered out when converting from internal browser AX Tree to Platform-specific AX-Tree or by
|
|
14
|
-
# assistive technologies themselves. By default, Playwright tries to approximate this filtering, exposing only the
|
|
15
|
-
# "interesting" nodes of the tree.
|
|
16
|
-
class Accessibility < PlaywrightApi
|
|
17
|
-
|
|
18
|
-
#
|
|
19
|
-
# Captures the current state of the accessibility tree. The returned object represents the root accessible node of the
|
|
20
|
-
# page.
|
|
21
|
-
#
|
|
22
|
-
# **NOTE**: The Chromium accessibility tree contains nodes that go unused on most platforms and by most screen readers. Playwright
|
|
23
|
-
# will discard them as well for an easier to process tree, unless `interestingOnly` is set to `false`.
|
|
24
|
-
#
|
|
25
|
-
# **Usage**
|
|
26
|
-
#
|
|
27
|
-
# An example of dumping the entire accessibility tree:
|
|
28
|
-
#
|
|
29
|
-
# ```python sync
|
|
30
|
-
# snapshot = page.accessibility.snapshot()
|
|
31
|
-
# print(snapshot)
|
|
32
|
-
# ```
|
|
33
|
-
#
|
|
34
|
-
# An example of logging the focused node's name:
|
|
35
|
-
#
|
|
36
|
-
# ```python sync
|
|
37
|
-
# def find_focused_node(node):
|
|
38
|
-
# if node.get("focused"):
|
|
39
|
-
# return node
|
|
40
|
-
# for child in (node.get("children") or []):
|
|
41
|
-
# found_node = find_focused_node(child)
|
|
42
|
-
# if found_node:
|
|
43
|
-
# return found_node
|
|
44
|
-
# return None
|
|
45
|
-
#
|
|
46
|
-
# snapshot = page.accessibility.snapshot()
|
|
47
|
-
# node = find_focused_node(snapshot)
|
|
48
|
-
# if node:
|
|
49
|
-
# print(node["name"])
|
|
50
|
-
# ```
|
|
51
|
-
#
|
|
52
|
-
# @deprecated This method is deprecated. Please use other libraries such as [Axe](https://www.deque.com/axe/) if you need to test page accessibility. See our Node.js [guide](https://playwright.dev/docs/accessibility-testing) for integration with Axe.
|
|
53
|
-
def snapshot(interestingOnly: nil, root: nil)
|
|
54
|
-
wrap_impl(@impl.snapshot(interestingOnly: unwrap_impl(interestingOnly), root: unwrap_impl(root)))
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
end
|