playwright-ruby-client 1.28.1 → 1.29.1.alpha1
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/accessibility.md +9 -14
- data/documentation/docs/api/api_request_context.md +44 -41
- data/documentation/docs/api/api_response.md +13 -3
- data/documentation/docs/api/browser.md +24 -23
- data/documentation/docs/api/browser_context.md +71 -45
- data/documentation/docs/api/browser_type.md +21 -14
- data/documentation/docs/api/cdp_session.md +3 -5
- data/documentation/docs/api/console_message.md +7 -4
- data/documentation/docs/api/dialog.md +9 -5
- data/documentation/docs/api/download.md +19 -11
- data/documentation/docs/api/element_handle.md +125 -116
- data/documentation/docs/api/experimental/android.md +4 -5
- data/documentation/docs/api/experimental/android_device.md +11 -2
- data/documentation/docs/api/experimental/android_input.md +5 -0
- data/documentation/docs/api/file_chooser.md +6 -3
- data/documentation/docs/api/frame.md +182 -171
- data/documentation/docs/api/frame_locator.md +27 -38
- data/documentation/docs/api/js_handle.md +16 -10
- data/documentation/docs/api/keyboard.md +29 -16
- data/documentation/docs/api/locator.md +189 -140
- data/documentation/docs/api/mouse.md +9 -4
- data/documentation/docs/api/page.md +304 -289
- data/documentation/docs/api/playwright.md +8 -5
- data/documentation/docs/api/request.md +34 -15
- data/documentation/docs/api/response.md +27 -10
- data/documentation/docs/api/route.md +44 -12
- data/documentation/docs/api/selectors.md +5 -3
- data/documentation/docs/api/touchscreen.md +2 -0
- data/documentation/docs/api/tracing.md +11 -11
- data/documentation/docs/api/web_socket.md +9 -4
- data/documentation/docs/api/worker.md +12 -11
- data/documentation/docs/include/api_coverage.md +2 -0
- data/lib/playwright/channel_owners/api_request_context.rb +37 -2
- data/lib/playwright/channel_owners/browser_context.rb +22 -26
- data/lib/playwright/channel_owners/page.rb +35 -25
- data/lib/playwright/channel_owners/route.rb +28 -8
- data/lib/playwright/event_emitter.rb +6 -1
- data/lib/playwright/locator_impl.rb +8 -0
- data/lib/playwright/select_option_values.rb +2 -0
- data/lib/playwright/version.rb +2 -2
- data/lib/playwright_api/accessibility.rb +9 -13
- data/lib/playwright_api/android.rb +14 -12
- data/lib/playwright_api/android_device.rb +38 -13
- data/lib/playwright_api/android_input.rb +5 -0
- data/lib/playwright_api/android_socket.rb +4 -2
- data/lib/playwright_api/android_web_view.rb +5 -2
- data/lib/playwright_api/api_request.rb +6 -3
- data/lib/playwright_api/api_request_context.rb +52 -42
- data/lib/playwright_api/api_response.rb +13 -2
- data/lib/playwright_api/browser.rb +30 -22
- data/lib/playwright_api/browser_context.rb +82 -45
- data/lib/playwright_api/browser_type.rb +29 -19
- data/lib/playwright_api/cdp_session.rb +9 -10
- data/lib/playwright_api/console_message.rb +13 -8
- data/lib/playwright_api/dialog.rb +14 -10
- data/lib/playwright_api/download.rb +19 -9
- data/lib/playwright_api/element_handle.rb +122 -99
- data/lib/playwright_api/file_chooser.rb +6 -1
- data/lib/playwright_api/frame.rb +186 -141
- data/lib/playwright_api/frame_locator.rb +29 -32
- data/lib/playwright_api/js_handle.rb +22 -12
- data/lib/playwright_api/keyboard.rb +29 -14
- data/lib/playwright_api/locator.rb +183 -112
- data/lib/playwright_api/mouse.rb +9 -2
- data/lib/playwright_api/page.rb +307 -259
- data/lib/playwright_api/playwright.rb +17 -10
- data/lib/playwright_api/request.rb +40 -13
- data/lib/playwright_api/response.rb +33 -16
- data/lib/playwright_api/route.rb +50 -17
- data/lib/playwright_api/selectors.rb +12 -7
- data/lib/playwright_api/touchscreen.rb +2 -0
- data/lib/playwright_api/tracing.rb +17 -11
- data/lib/playwright_api/web_socket.rb +15 -10
- data/lib/playwright_api/worker.rb +20 -17
- data/playwright.gemspec +2 -2
- data/sig/playwright.rbs +559 -0
- metadata +10 -9
@@ -6,10 +6,8 @@ module Playwright
|
|
6
6
|
# - protocol events can be subscribed to with `session.on` method.
|
7
7
|
#
|
8
8
|
# Useful links:
|
9
|
-
# - Documentation on DevTools Protocol can be found here:
|
10
|
-
#
|
11
|
-
# - Getting Started with DevTools Protocol:
|
12
|
-
# https://github.com/aslushnikov/getting-started-with-cdp/blob/master/README.md
|
9
|
+
# - Documentation on DevTools Protocol can be found here: [DevTools Protocol Viewer](https://chromedevtools.github.io/devtools-protocol/).
|
10
|
+
# - Getting Started with DevTools Protocol: https://github.com/aslushnikov/getting-started-with-cdp/blob/master/README.md
|
13
11
|
#
|
14
12
|
# ```python sync
|
15
13
|
# client = page.context.new_cdp_session(page)
|
@@ -23,6 +21,7 @@ module Playwright
|
|
23
21
|
# ```
|
24
22
|
class CDPSession < PlaywrightApi
|
25
23
|
|
24
|
+
#
|
26
25
|
# Detaches the CDPSession from the target. Once detached, the CDPSession object won't emit any events and can't be used to
|
27
26
|
# send messages.
|
28
27
|
def detach
|
@@ -35,20 +34,20 @@ module Playwright
|
|
35
34
|
|
36
35
|
# -- inherited from EventEmitter --
|
37
36
|
# @nodoc
|
38
|
-
def
|
39
|
-
event_emitter_proxy.
|
37
|
+
def off(event, callback)
|
38
|
+
event_emitter_proxy.off(event, callback)
|
40
39
|
end
|
41
40
|
|
42
41
|
# -- inherited from EventEmitter --
|
43
42
|
# @nodoc
|
44
|
-
def
|
45
|
-
event_emitter_proxy.
|
43
|
+
def once(event, callback)
|
44
|
+
event_emitter_proxy.once(event, callback)
|
46
45
|
end
|
47
46
|
|
48
47
|
# -- inherited from EventEmitter --
|
49
48
|
# @nodoc
|
50
|
-
def
|
51
|
-
event_emitter_proxy.
|
49
|
+
def on(event, callback)
|
50
|
+
event_emitter_proxy.on(event, callback)
|
52
51
|
end
|
53
52
|
|
54
53
|
private def event_emitter_proxy
|
@@ -1,6 +1,8 @@
|
|
1
1
|
module Playwright
|
2
|
-
#
|
3
|
-
#
|
2
|
+
#
|
3
|
+
# `ConsoleMessage` objects are dispatched by page via the [`event: Page.console`] event.
|
4
|
+
# For each console messages logged in the page there will be corresponding event in the Playwright
|
5
|
+
# context.
|
4
6
|
#
|
5
7
|
# ```python sync
|
6
8
|
# # Listen for all console logs
|
@@ -21,6 +23,7 @@ module Playwright
|
|
21
23
|
# ```
|
22
24
|
class ConsoleMessage < PlaywrightApi
|
23
25
|
|
26
|
+
#
|
24
27
|
# List of arguments passed to a `console` function call. See also [`event: Page.console`].
|
25
28
|
def args
|
26
29
|
wrap_impl(@impl.args)
|
@@ -30,11 +33,13 @@ module Playwright
|
|
30
33
|
wrap_impl(@impl.location)
|
31
34
|
end
|
32
35
|
|
36
|
+
#
|
33
37
|
# The text of the console message.
|
34
38
|
def text
|
35
39
|
wrap_impl(@impl.text)
|
36
40
|
end
|
37
41
|
|
42
|
+
#
|
38
43
|
# One of the following values: `'log'`, `'debug'`, `'info'`, `'error'`, `'warning'`, `'dir'`, `'dirxml'`, `'table'`,
|
39
44
|
# `'trace'`, `'clear'`, `'startGroup'`, `'startGroupCollapsed'`, `'endGroup'`, `'assert'`, `'profile'`, `'profileEnd'`,
|
40
45
|
# `'count'`, `'timeEnd'`.
|
@@ -44,20 +49,20 @@ module Playwright
|
|
44
49
|
|
45
50
|
# -- inherited from EventEmitter --
|
46
51
|
# @nodoc
|
47
|
-
def
|
48
|
-
event_emitter_proxy.
|
52
|
+
def off(event, callback)
|
53
|
+
event_emitter_proxy.off(event, callback)
|
49
54
|
end
|
50
55
|
|
51
56
|
# -- inherited from EventEmitter --
|
52
57
|
# @nodoc
|
53
|
-
def
|
54
|
-
event_emitter_proxy.
|
58
|
+
def once(event, callback)
|
59
|
+
event_emitter_proxy.once(event, callback)
|
55
60
|
end
|
56
61
|
|
57
62
|
# -- inherited from EventEmitter --
|
58
63
|
# @nodoc
|
59
|
-
def
|
60
|
-
event_emitter_proxy.
|
64
|
+
def on(event, callback)
|
65
|
+
event_emitter_proxy.on(event, callback)
|
61
66
|
end
|
62
67
|
|
63
68
|
private def event_emitter_proxy
|
@@ -1,4 +1,5 @@
|
|
1
1
|
module Playwright
|
2
|
+
#
|
2
3
|
# `Dialog` objects are dispatched by page via the [`event: Page.dialog`] event.
|
3
4
|
#
|
4
5
|
# An example of using `Dialog` class:
|
@@ -22,32 +23,35 @@ module Playwright
|
|
22
23
|
# run(playwright)
|
23
24
|
# ```
|
24
25
|
#
|
25
|
-
#
|
26
|
-
# present, it **must** either [`method: Dialog.accept`] or [`method: Dialog.dismiss`] the dialog - otherwise the page will
|
27
|
-
# [freeze](https://developer.mozilla.org/en-US/docs/Web/JavaScript/EventLoop#never_blocking) waiting for the dialog, and
|
28
|
-
# actions like click will never finish.
|
26
|
+
# **NOTE**: Dialogs are dismissed automatically, unless there is a [`event: Page.dialog`] listener.
|
27
|
+
# When listener is present, it **must** either [`method: Dialog.accept`] or [`method: Dialog.dismiss`] the dialog - otherwise the page will [freeze](https://developer.mozilla.org/en-US/docs/Web/JavaScript/EventLoop#never_blocking) waiting for the dialog, and actions like click will never finish.
|
29
28
|
class Dialog < PlaywrightApi
|
30
29
|
|
30
|
+
#
|
31
31
|
# Returns when the dialog has been accepted.
|
32
32
|
def accept(promptText: nil)
|
33
33
|
wrap_impl(@impl.accept(promptText: unwrap_impl(promptText)))
|
34
34
|
end
|
35
35
|
|
36
|
+
#
|
36
37
|
# If dialog is prompt, returns default prompt value. Otherwise, returns empty string.
|
37
38
|
def default_value
|
38
39
|
wrap_impl(@impl.default_value)
|
39
40
|
end
|
40
41
|
|
42
|
+
#
|
41
43
|
# Returns when the dialog has been dismissed.
|
42
44
|
def dismiss
|
43
45
|
wrap_impl(@impl.dismiss)
|
44
46
|
end
|
45
47
|
|
48
|
+
#
|
46
49
|
# A message displayed in the dialog.
|
47
50
|
def message
|
48
51
|
wrap_impl(@impl.message)
|
49
52
|
end
|
50
53
|
|
54
|
+
#
|
51
55
|
# Returns dialog's type, can be one of `alert`, `beforeunload`, `confirm` or `prompt`.
|
52
56
|
def type
|
53
57
|
wrap_impl(@impl.type)
|
@@ -60,20 +64,20 @@ module Playwright
|
|
60
64
|
|
61
65
|
# -- inherited from EventEmitter --
|
62
66
|
# @nodoc
|
63
|
-
def
|
64
|
-
event_emitter_proxy.
|
67
|
+
def off(event, callback)
|
68
|
+
event_emitter_proxy.off(event, callback)
|
65
69
|
end
|
66
70
|
|
67
71
|
# -- inherited from EventEmitter --
|
68
72
|
# @nodoc
|
69
|
-
def
|
70
|
-
event_emitter_proxy.
|
73
|
+
def once(event, callback)
|
74
|
+
event_emitter_proxy.once(event, callback)
|
71
75
|
end
|
72
76
|
|
73
77
|
# -- inherited from EventEmitter --
|
74
78
|
# @nodoc
|
75
|
-
def
|
76
|
-
event_emitter_proxy.
|
79
|
+
def on(event, callback)
|
80
|
+
event_emitter_proxy.on(event, callback)
|
77
81
|
end
|
78
82
|
|
79
83
|
private def event_emitter_proxy
|
@@ -1,7 +1,9 @@
|
|
1
1
|
module Playwright
|
2
|
+
#
|
2
3
|
# `Download` objects are dispatched by page via the [`event: Page.download`] event.
|
3
4
|
#
|
4
|
-
# All the downloaded files belonging to the browser context are deleted when the
|
5
|
+
# All the downloaded files belonging to the browser context are deleted when the
|
6
|
+
# browser context is closed.
|
5
7
|
#
|
6
8
|
# Download event is emitted once the download starts. Download path becomes available once download completes:
|
7
9
|
#
|
@@ -14,42 +16,49 @@ module Playwright
|
|
14
16
|
# ```
|
15
17
|
class Download < PlaywrightApi
|
16
18
|
|
17
|
-
#
|
18
|
-
#
|
19
|
+
#
|
20
|
+
# Cancels a download. Will not fail if the download is already finished or canceled.
|
21
|
+
# Upon successful cancellations, `download.failure()` would resolve to `'canceled'`.
|
19
22
|
def cancel
|
20
23
|
wrap_impl(@impl.cancel)
|
21
24
|
end
|
22
25
|
|
26
|
+
#
|
23
27
|
# Deletes the downloaded file. Will wait for the download to finish if necessary.
|
24
28
|
def delete
|
25
29
|
wrap_impl(@impl.delete)
|
26
30
|
end
|
27
31
|
|
32
|
+
#
|
28
33
|
# Returns download error if any. Will wait for the download to finish if necessary.
|
29
34
|
def failure
|
30
35
|
wrap_impl(@impl.failure)
|
31
36
|
end
|
32
37
|
|
38
|
+
#
|
33
39
|
# Get the page that the download belongs to.
|
34
40
|
def page
|
35
41
|
wrap_impl(@impl.page)
|
36
42
|
end
|
37
43
|
|
38
|
-
# Returns path to the downloaded file in case of successful download. The method will wait for the download to finish if
|
39
|
-
# necessary. The method throws when connected remotely.
|
40
44
|
#
|
41
|
-
#
|
42
|
-
#
|
45
|
+
# Returns path to the downloaded file in case of successful download. The method will
|
46
|
+
# wait for the download to finish if necessary. The method throws when connected remotely.
|
47
|
+
#
|
48
|
+
# Note that the download's file name is a random GUID, use [`method: Download.suggestedFilename`]
|
49
|
+
# to get suggested file name.
|
43
50
|
def path
|
44
51
|
wrap_impl(@impl.path)
|
45
52
|
end
|
46
53
|
|
47
|
-
#
|
48
|
-
#
|
54
|
+
#
|
55
|
+
# Copy the download to a user-specified path. It is safe to call this method while the download
|
56
|
+
# is still in progress. Will wait for the download to finish if necessary.
|
49
57
|
def save_as(path)
|
50
58
|
wrap_impl(@impl.save_as(unwrap_impl(path)))
|
51
59
|
end
|
52
60
|
|
61
|
+
#
|
53
62
|
# Returns suggested filename for this download. It is typically computed by the browser from the
|
54
63
|
# [`Content-Disposition`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition) response header
|
55
64
|
# or the `download` attribute. See the spec on [whatwg](https://html.spec.whatwg.org/#downloading-resources). Different
|
@@ -58,6 +67,7 @@ module Playwright
|
|
58
67
|
wrap_impl(@impl.suggested_filename)
|
59
68
|
end
|
60
69
|
|
70
|
+
#
|
61
71
|
# Returns downloaded url.
|
62
72
|
def url
|
63
73
|
wrap_impl(@impl.url)
|