playwright-ruby-client 0.5.9 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/documentation/README.md +33 -0
- data/documentation/babel.config.js +3 -0
- data/documentation/docs/api/accessibility.md +7 -0
- data/documentation/docs/api/browser.md +187 -0
- data/documentation/docs/api/browser_context.md +397 -0
- data/documentation/docs/api/browser_type.md +105 -0
- data/documentation/docs/api/cdp_session.md +7 -0
- data/documentation/docs/api/console_message.md +41 -0
- data/documentation/docs/api/dialog.md +71 -0
- data/documentation/docs/api/element_handle.md +618 -0
- data/documentation/docs/api/experimental/_category_.yml +3 -0
- data/documentation/docs/api/experimental/android.md +25 -0
- data/documentation/docs/api/experimental/android_device.md +92 -0
- data/documentation/docs/api/experimental/android_input.md +38 -0
- data/documentation/docs/api/experimental/android_socket.md +7 -0
- data/documentation/docs/api/experimental/android_web_view.md +7 -0
- data/documentation/docs/api/file_chooser.md +50 -0
- data/documentation/docs/api/frame.md +866 -0
- data/documentation/docs/api/js_handle.md +113 -0
- data/documentation/docs/api/keyboard.md +157 -0
- data/documentation/docs/api/mouse.md +69 -0
- data/documentation/docs/api/page.md +1402 -0
- data/documentation/docs/api/playwright.md +63 -0
- data/documentation/docs/api/request.md +188 -0
- data/documentation/docs/api/response.md +97 -0
- data/documentation/docs/api/route.md +80 -0
- data/documentation/docs/api/selectors.md +23 -0
- data/documentation/docs/api/touchscreen.md +8 -0
- data/documentation/docs/api/tracing.md +54 -0
- data/documentation/docs/api/web_socket.md +7 -0
- data/documentation/docs/api/worker.md +24 -0
- data/documentation/docs/article/api_coverage.mdx +11 -0
- data/documentation/docs/article/getting_started.md +152 -0
- data/documentation/docs/article/guides/_category_.yml +3 -0
- data/documentation/docs/article/guides/download_playwright_driver.md +49 -0
- data/documentation/docs/article/guides/launch_browser.md +119 -0
- data/documentation/docs/article/guides/rails_integration.md +162 -0
- data/{docs → documentation/docs/include}/api_coverage.md +12 -1
- data/documentation/docusaurus.config.js +107 -0
- data/documentation/package.json +39 -0
- data/documentation/sidebars.js +15 -0
- data/documentation/src/components/HomepageFeatures.js +61 -0
- data/documentation/src/components/HomepageFeatures.module.css +13 -0
- data/documentation/src/css/custom.css +44 -0
- data/documentation/src/pages/index.js +50 -0
- data/documentation/src/pages/index.module.css +41 -0
- data/documentation/src/pages/markdown-page.md +7 -0
- data/documentation/static/.nojekyll +0 -0
- data/documentation/static/img/playwright-logo.svg +9 -0
- data/documentation/static/img/undraw_dropdown_menu.svg +1 -0
- data/documentation/static/img/undraw_web_development.svg +1 -0
- data/documentation/static/img/undraw_windows.svg +1 -0
- data/documentation/yarn.lock +8805 -0
- data/lib/playwright/channel_owners/binding_call.rb +33 -0
- data/lib/playwright/channel_owners/browser.rb +11 -2
- data/lib/playwright/channel_owners/browser_context.rb +58 -6
- data/lib/playwright/channel_owners/browser_type.rb +8 -1
- data/lib/playwright/channel_owners/element_handle.rb +17 -16
- data/lib/playwright/channel_owners/frame.rb +24 -34
- data/lib/playwright/channel_owners/js_handle.rb +2 -10
- data/lib/playwright/channel_owners/page.rb +37 -52
- data/lib/playwright/channel_owners/worker.rb +4 -0
- data/lib/playwright/download.rb +3 -2
- data/lib/playwright/events.rb +4 -0
- data/lib/playwright/input_files.rb +0 -8
- data/lib/playwright/javascript.rb +0 -10
- data/lib/playwright/javascript/expression.rb +2 -7
- data/lib/playwright/playwright_api.rb +16 -1
- data/lib/playwright/tracing_impl.rb +31 -0
- data/lib/playwright/version.rb +2 -1
- data/lib/playwright_api/accessibility.rb +7 -88
- data/lib/playwright_api/android.rb +2 -59
- data/lib/playwright_api/android_device.rb +6 -5
- data/lib/playwright_api/browser.rb +13 -122
- data/lib/playwright_api/browser_context.rb +66 -433
- data/lib/playwright_api/browser_type.rb +28 -78
- data/lib/playwright_api/cdp_session.rb +2 -25
- data/lib/playwright_api/console_message.rb +2 -0
- data/lib/playwright_api/dialog.rb +5 -63
- data/lib/playwright_api/element_handle.rb +96 -294
- data/lib/playwright_api/file_chooser.rb +0 -21
- data/lib/playwright_api/frame.rb +98 -564
- data/lib/playwright_api/js_handle.rb +10 -67
- data/lib/playwright_api/keyboard.rb +22 -166
- data/lib/playwright_api/mouse.rb +1 -45
- data/lib/playwright_api/page.rb +223 -1224
- data/lib/playwright_api/playwright.rb +8 -93
- data/lib/playwright_api/request.rb +9 -87
- data/lib/playwright_api/response.rb +1 -1
- data/lib/playwright_api/route.rb +3 -80
- data/lib/playwright_api/selectors.rb +0 -66
- data/lib/playwright_api/tracing.rb +39 -0
- data/lib/playwright_api/web_socket.rb +1 -1
- data/lib/playwright_api/worker.rb +28 -42
- data/playwright.gemspec +2 -2
- metadata +60 -20
- data/lib/playwright/javascript/function.rb +0 -67
@@ -1,32 +1,16 @@
|
|
1
1
|
module Playwright
|
2
2
|
# JSHandle represents an in-page JavaScript object. JSHandles can be created with the [`method: Page.evaluateHandle`]
|
3
3
|
# method.
|
4
|
-
#
|
5
4
|
#
|
6
|
-
# ```js
|
7
|
-
# const windowHandle = await page.evaluateHandle(() => window);
|
8
|
-
# // ...
|
9
|
-
# ```
|
10
|
-
#
|
11
|
-
# ```java
|
12
|
-
# JSHandle windowHandle = page.evaluateHandle("() => window");
|
13
|
-
# // ...
|
14
|
-
# ```
|
15
|
-
#
|
16
|
-
# ```python async
|
17
|
-
# window_handle = await page.evaluate_handle("window")
|
18
|
-
# # ...
|
19
|
-
# ```
|
20
|
-
#
|
21
5
|
# ```python sync
|
22
6
|
# window_handle = page.evaluate_handle("window")
|
23
7
|
# # ...
|
24
8
|
# ```
|
25
|
-
#
|
9
|
+
#
|
26
10
|
# JSHandle prevents the referenced JavaScript object being garbage collected unless the handle is exposed with
|
27
11
|
# [`method: JSHandle.dispose`]. JSHandles are auto-disposed when their origin frame gets navigated or the parent context
|
28
12
|
# gets destroyed.
|
29
|
-
#
|
13
|
+
#
|
30
14
|
# JSHandle instances can be used as an argument in [`method: Page.evalOnSelector`], [`method: Page.evaluate`] and
|
31
15
|
# [`method: Page.evaluateHandle`] methods.
|
32
16
|
class JSHandle < PlaywrightApi
|
@@ -42,29 +26,13 @@ module Playwright
|
|
42
26
|
end
|
43
27
|
|
44
28
|
# Returns the return value of `expression`.
|
45
|
-
#
|
29
|
+
#
|
46
30
|
# This method passes this handle as the first argument to `expression`.
|
47
|
-
#
|
31
|
+
#
|
48
32
|
# If `expression` returns a [Promise], then `handle.evaluate` would wait for the promise to resolve and return its value.
|
49
|
-
#
|
33
|
+
#
|
50
34
|
# Examples:
|
51
|
-
#
|
52
35
|
#
|
53
|
-
# ```js
|
54
|
-
# const tweetHandle = await page.$('.tweet .retweets');
|
55
|
-
# expect(await tweetHandle.evaluate(node => node.innerText)).toBe('10 retweets');
|
56
|
-
# ```
|
57
|
-
#
|
58
|
-
# ```java
|
59
|
-
# ElementHandle tweetHandle = page.querySelector(".tweet .retweets");
|
60
|
-
# assertEquals("10 retweets", tweetHandle.evaluate("node => node.innerText"));
|
61
|
-
# ```
|
62
|
-
#
|
63
|
-
# ```python async
|
64
|
-
# tweet_handle = await page.query_selector(".tweet .retweets")
|
65
|
-
# assert await tweet_handle.evaluate("node => node.innerText") == "10 retweets"
|
66
|
-
# ```
|
67
|
-
#
|
68
36
|
# ```python sync
|
69
37
|
# tweet_handle = page.query_selector(".tweet .retweets")
|
70
38
|
# assert tweet_handle.evaluate("node => node.innerText") == "10 retweets"
|
@@ -74,47 +42,22 @@ module Playwright
|
|
74
42
|
end
|
75
43
|
|
76
44
|
# Returns the return value of `expression` as a `JSHandle`.
|
77
|
-
#
|
45
|
+
#
|
78
46
|
# This method passes this handle as the first argument to `expression`.
|
79
|
-
#
|
47
|
+
#
|
80
48
|
# The only difference between `jsHandle.evaluate` and `jsHandle.evaluateHandle` is that `jsHandle.evaluateHandle` returns
|
81
49
|
# `JSHandle`.
|
82
|
-
#
|
50
|
+
#
|
83
51
|
# If the function passed to the `jsHandle.evaluateHandle` returns a [Promise], then `jsHandle.evaluateHandle` would wait
|
84
52
|
# for the promise to resolve and return its value.
|
85
|
-
#
|
53
|
+
#
|
86
54
|
# See [`method: Page.evaluateHandle`] for more details.
|
87
55
|
def evaluate_handle(expression, arg: nil)
|
88
56
|
wrap_impl(@impl.evaluate_handle(unwrap_impl(expression), arg: unwrap_impl(arg)))
|
89
57
|
end
|
90
58
|
|
91
59
|
# The method returns a map with **own property names** as keys and JSHandle instances for the property values.
|
92
|
-
#
|
93
60
|
#
|
94
|
-
# ```js
|
95
|
-
# const handle = await page.evaluateHandle(() => ({window, document}));
|
96
|
-
# const properties = await handle.getProperties();
|
97
|
-
# const windowHandle = properties.get('window');
|
98
|
-
# const documentHandle = properties.get('document');
|
99
|
-
# await handle.dispose();
|
100
|
-
# ```
|
101
|
-
#
|
102
|
-
# ```java
|
103
|
-
# JSHandle handle = page.evaluateHandle("() => ({window, document}"););
|
104
|
-
# Map<String, JSHandle> properties = handle.getProperties();
|
105
|
-
# JSHandle windowHandle = properties.get("window");
|
106
|
-
# JSHandle documentHandle = properties.get("document");
|
107
|
-
# handle.dispose();
|
108
|
-
# ```
|
109
|
-
#
|
110
|
-
# ```python async
|
111
|
-
# handle = await page.evaluate_handle("{window, document}")
|
112
|
-
# properties = await handle.get_properties()
|
113
|
-
# window_handle = properties.get("window")
|
114
|
-
# document_handle = properties.get("document")
|
115
|
-
# await handle.dispose()
|
116
|
-
# ```
|
117
|
-
#
|
118
61
|
# ```python sync
|
119
62
|
# handle = page.evaluate_handle("{window, document}")
|
120
63
|
# properties = handle.get_properties()
|
@@ -133,7 +76,7 @@ module Playwright
|
|
133
76
|
end
|
134
77
|
|
135
78
|
# Returns a JSON representation of the object. If the object has a `toJSON` function, it **will not be called**.
|
136
|
-
#
|
79
|
+
#
|
137
80
|
# > NOTE: The method will return an empty JSON object if the referenced object is not stringifiable. It will throw an
|
138
81
|
# error if the object has circular references.
|
139
82
|
def json_value
|
@@ -1,48 +1,12 @@
|
|
1
1
|
module Playwright
|
2
2
|
# Keyboard provides an api for managing a virtual keyboard. The high level api is [`method: Keyboard.type`], which takes
|
3
3
|
# raw characters and generates proper keydown, keypress/input, and keyup events on your page.
|
4
|
-
#
|
4
|
+
#
|
5
5
|
# For finer control, you can use [`method: Keyboard.down`], [`method: Keyboard.up`], and [`method: Keyboard.insertText`]
|
6
6
|
# to manually fire events as if they were generated from a real keyboard.
|
7
|
-
#
|
7
|
+
#
|
8
8
|
# An example of holding down `Shift` in order to select and delete some text:
|
9
|
-
#
|
10
9
|
#
|
11
|
-
# ```js
|
12
|
-
# await page.keyboard.type('Hello World!');
|
13
|
-
# await page.keyboard.press('ArrowLeft');
|
14
|
-
#
|
15
|
-
# await page.keyboard.down('Shift');
|
16
|
-
# for (let i = 0; i < ' World'.length; i++)
|
17
|
-
# await page.keyboard.press('ArrowLeft');
|
18
|
-
# await page.keyboard.up('Shift');
|
19
|
-
#
|
20
|
-
# await page.keyboard.press('Backspace');
|
21
|
-
# // Result text will end up saying 'Hello!'
|
22
|
-
# ```
|
23
|
-
#
|
24
|
-
# ```java
|
25
|
-
# page.keyboard().type("Hello World!");
|
26
|
-
# page.keyboard().press("ArrowLeft");
|
27
|
-
# page.keyboard().down("Shift");
|
28
|
-
# for (int i = 0; i < " World".length(); i++)
|
29
|
-
# page.keyboard().press("ArrowLeft");
|
30
|
-
# page.keyboard().up("Shift");
|
31
|
-
# page.keyboard().press("Backspace");
|
32
|
-
# // Result text will end up saying "Hello!"
|
33
|
-
# ```
|
34
|
-
#
|
35
|
-
# ```python async
|
36
|
-
# await page.keyboard.type("Hello World!")
|
37
|
-
# await page.keyboard.press("ArrowLeft")
|
38
|
-
# await page.keyboard.down("Shift")
|
39
|
-
# for i in range(6):
|
40
|
-
# await page.keyboard.press("ArrowLeft")
|
41
|
-
# await page.keyboard.up("Shift")
|
42
|
-
# await page.keyboard.press("Backspace")
|
43
|
-
# # result text will end up saying "Hello!"
|
44
|
-
# ```
|
45
|
-
#
|
46
10
|
# ```python sync
|
47
11
|
# page.keyboard.type("Hello World!")
|
48
12
|
# page.keyboard.press("ArrowLeft")
|
@@ -53,58 +17,17 @@ module Playwright
|
|
53
17
|
# page.keyboard.press("Backspace")
|
54
18
|
# # result text will end up saying "Hello!"
|
55
19
|
# ```
|
56
|
-
#
|
20
|
+
#
|
57
21
|
# An example of pressing uppercase `A`
|
58
|
-
#
|
59
22
|
#
|
60
|
-
# ```js
|
61
|
-
# await page.keyboard.press('Shift+KeyA');
|
62
|
-
# // or
|
63
|
-
# await page.keyboard.press('Shift+A');
|
64
|
-
# ```
|
65
|
-
#
|
66
|
-
# ```java
|
67
|
-
# page.keyboard().press("Shift+KeyA");
|
68
|
-
# // or
|
69
|
-
# page.keyboard().press("Shift+A");
|
70
|
-
# ```
|
71
|
-
#
|
72
|
-
# ```python async
|
73
|
-
# await page.keyboard.press("Shift+KeyA")
|
74
|
-
# # or
|
75
|
-
# await page.keyboard.press("Shift+A")
|
76
|
-
# ```
|
77
|
-
#
|
78
23
|
# ```python sync
|
79
24
|
# page.keyboard.press("Shift+KeyA")
|
80
25
|
# # or
|
81
26
|
# page.keyboard.press("Shift+A")
|
82
27
|
# ```
|
83
|
-
#
|
28
|
+
#
|
84
29
|
# An example to trigger select-all with the keyboard
|
85
|
-
#
|
86
30
|
#
|
87
|
-
# ```js
|
88
|
-
# // on Windows and Linux
|
89
|
-
# await page.keyboard.press('Control+A');
|
90
|
-
# // on macOS
|
91
|
-
# await page.keyboard.press('Meta+A');
|
92
|
-
# ```
|
93
|
-
#
|
94
|
-
# ```java
|
95
|
-
# // on Windows and Linux
|
96
|
-
# page.keyboard().press("Control+A");
|
97
|
-
# // on macOS
|
98
|
-
# page.keyboard().press("Meta+A");
|
99
|
-
# ```
|
100
|
-
#
|
101
|
-
# ```python async
|
102
|
-
# # on windows and linux
|
103
|
-
# await page.keyboard.press("Control+A")
|
104
|
-
# # on mac_os
|
105
|
-
# await page.keyboard.press("Meta+A")
|
106
|
-
# ```
|
107
|
-
#
|
108
31
|
# ```python sync
|
109
32
|
# # on windows and linux
|
110
33
|
# page.keyboard.press("Control+A")
|
@@ -114,52 +37,39 @@ module Playwright
|
|
114
37
|
class Keyboard < PlaywrightApi
|
115
38
|
|
116
39
|
# Dispatches a `keydown` event.
|
117
|
-
#
|
40
|
+
#
|
118
41
|
# `key` can specify the intended [keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key)
|
119
42
|
# value or a single character to generate the text for. A superset of the `key` values can be found
|
120
43
|
# [here](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values). Examples of the keys are:
|
121
|
-
#
|
44
|
+
#
|
122
45
|
# `F1` - `F12`, `Digit0`- `Digit9`, `KeyA`- `KeyZ`, `Backquote`, `Minus`, `Equal`, `Backslash`, `Backspace`, `Tab`,
|
123
46
|
# `Delete`, `Escape`, `ArrowDown`, `End`, `Enter`, `Home`, `Insert`, `PageDown`, `PageUp`, `ArrowRight`, `ArrowUp`, etc.
|
124
|
-
#
|
47
|
+
#
|
125
48
|
# Following modification shortcuts are also supported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`.
|
126
|
-
#
|
49
|
+
#
|
127
50
|
# Holding down `Shift` will type the text that corresponds to the `key` in the upper case.
|
128
|
-
#
|
51
|
+
#
|
129
52
|
# If `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different respective
|
130
53
|
# texts.
|
131
|
-
#
|
54
|
+
#
|
132
55
|
# If `key` is a modifier key, `Shift`, `Meta`, `Control`, or `Alt`, subsequent key presses will be sent with that modifier
|
133
56
|
# active. To release the modifier key, use [`method: Keyboard.up`].
|
134
|
-
#
|
57
|
+
#
|
135
58
|
# After the key is pressed once, subsequent calls to [`method: Keyboard.down`] will have
|
136
59
|
# [repeat](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/repeat) set to true. To release the key, use
|
137
60
|
# [`method: Keyboard.up`].
|
138
|
-
#
|
61
|
+
#
|
139
62
|
# > NOTE: Modifier keys DO influence `keyboard.down`. Holding down `Shift` will type the text in upper case.
|
140
63
|
def down(key)
|
141
64
|
wrap_impl(@impl.down(unwrap_impl(key)))
|
142
65
|
end
|
143
66
|
|
144
67
|
# Dispatches only `input` event, does not emit the `keydown`, `keyup` or `keypress` events.
|
145
|
-
#
|
146
68
|
#
|
147
|
-
# ```js
|
148
|
-
# page.keyboard.insertText('嗨');
|
149
|
-
# ```
|
150
|
-
#
|
151
|
-
# ```java
|
152
|
-
# page.keyboard().insertText("嗨");
|
153
|
-
# ```
|
154
|
-
#
|
155
|
-
# ```python async
|
156
|
-
# await page.keyboard.insert_text("嗨")
|
157
|
-
# ```
|
158
|
-
#
|
159
69
|
# ```python sync
|
160
70
|
# page.keyboard.insert_text("嗨")
|
161
71
|
# ```
|
162
|
-
#
|
72
|
+
#
|
163
73
|
# > NOTE: Modifier keys DO NOT effect `keyboard.insertText`. Holding down `Shift` will not type the text in upper case.
|
164
74
|
def insert_text(text)
|
165
75
|
wrap_impl(@impl.insert_text(unwrap_impl(text)))
|
@@ -168,57 +78,20 @@ module Playwright
|
|
168
78
|
# `key` can specify the intended [keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key)
|
169
79
|
# value or a single character to generate the text for. A superset of the `key` values can be found
|
170
80
|
# [here](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values). Examples of the keys are:
|
171
|
-
#
|
81
|
+
#
|
172
82
|
# `F1` - `F12`, `Digit0`- `Digit9`, `KeyA`- `KeyZ`, `Backquote`, `Minus`, `Equal`, `Backslash`, `Backspace`, `Tab`,
|
173
83
|
# `Delete`, `Escape`, `ArrowDown`, `End`, `Enter`, `Home`, `Insert`, `PageDown`, `PageUp`, `ArrowRight`, `ArrowUp`, etc.
|
174
|
-
#
|
84
|
+
#
|
175
85
|
# Following modification shortcuts are also supported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`.
|
176
|
-
#
|
86
|
+
#
|
177
87
|
# Holding down `Shift` will type the text that corresponds to the `key` in the upper case.
|
178
|
-
#
|
88
|
+
#
|
179
89
|
# If `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different respective
|
180
90
|
# texts.
|
181
|
-
#
|
91
|
+
#
|
182
92
|
# Shortcuts such as `key: "Control+o"` or `key: "Control+Shift+T"` are supported as well. When specified with the
|
183
93
|
# modifier, modifier is pressed and being held while the subsequent key is being pressed.
|
184
|
-
#
|
185
94
|
#
|
186
|
-
# ```js
|
187
|
-
# const page = await browser.newPage();
|
188
|
-
# await page.goto('https://keycode.info');
|
189
|
-
# await page.keyboard.press('A');
|
190
|
-
# await page.screenshot({ path: 'A.png' });
|
191
|
-
# await page.keyboard.press('ArrowLeft');
|
192
|
-
# await page.screenshot({ path: 'ArrowLeft.png' });
|
193
|
-
# await page.keyboard.press('Shift+O');
|
194
|
-
# await page.screenshot({ path: 'O.png' });
|
195
|
-
# await browser.close();
|
196
|
-
# ```
|
197
|
-
#
|
198
|
-
# ```java
|
199
|
-
# Page page = browser.newPage();
|
200
|
-
# page.navigate("https://keycode.info");
|
201
|
-
# page.keyboard().press("A");
|
202
|
-
# page.screenshot(new Page.ScreenshotOptions().setPath(Paths.get("A.png"));
|
203
|
-
# page.keyboard().press("ArrowLeft");
|
204
|
-
# page.screenshot(new Page.ScreenshotOptions().setPath(Paths.get("ArrowLeft.png")));
|
205
|
-
# page.keyboard().press("Shift+O");
|
206
|
-
# page.screenshot(new Page.ScreenshotOptions().setPath(Paths.get("O.png")));
|
207
|
-
# browser.close();
|
208
|
-
# ```
|
209
|
-
#
|
210
|
-
# ```python async
|
211
|
-
# page = await browser.new_page()
|
212
|
-
# await page.goto("https://keycode.info")
|
213
|
-
# await page.keyboard.press("a")
|
214
|
-
# await page.screenshot(path="a.png")
|
215
|
-
# await page.keyboard.press("ArrowLeft")
|
216
|
-
# await page.screenshot(path="arrow_left.png")
|
217
|
-
# await page.keyboard.press("Shift+O")
|
218
|
-
# await page.screenshot(path="o.png")
|
219
|
-
# await browser.close()
|
220
|
-
# ```
|
221
|
-
#
|
222
95
|
# ```python sync
|
223
96
|
# page = browser.new_page()
|
224
97
|
# page.goto("https://keycode.info")
|
@@ -230,40 +103,23 @@ module Playwright
|
|
230
103
|
# page.screenshot(path="o.png")
|
231
104
|
# browser.close()
|
232
105
|
# ```
|
233
|
-
#
|
106
|
+
#
|
234
107
|
# Shortcut for [`method: Keyboard.down`] and [`method: Keyboard.up`].
|
235
108
|
def press(key, delay: nil)
|
236
109
|
wrap_impl(@impl.press(unwrap_impl(key), delay: unwrap_impl(delay)))
|
237
110
|
end
|
238
111
|
|
239
112
|
# Sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text.
|
240
|
-
#
|
113
|
+
#
|
241
114
|
# To press a special key, like `Control` or `ArrowDown`, use [`method: Keyboard.press`].
|
242
|
-
#
|
243
115
|
#
|
244
|
-
# ```js
|
245
|
-
# await page.keyboard.type('Hello'); // Types instantly
|
246
|
-
# await page.keyboard.type('World', {delay: 100}); // Types slower, like a user
|
247
|
-
# ```
|
248
|
-
#
|
249
|
-
# ```java
|
250
|
-
# // Types instantly
|
251
|
-
# page.keyboard().type("Hello");
|
252
|
-
# // Types slower, like a user
|
253
|
-
# page.keyboard().type("World", new Keyboard.TypeOptions().setDelay(100));
|
254
|
-
# ```
|
255
|
-
#
|
256
|
-
# ```python async
|
257
|
-
# await page.keyboard.type("Hello") # types instantly
|
258
|
-
# await page.keyboard.type("World", delay=100) # types slower, like a user
|
259
|
-
# ```
|
260
|
-
#
|
261
116
|
# ```python sync
|
262
117
|
# page.keyboard.type("Hello") # types instantly
|
263
118
|
# page.keyboard.type("World", delay=100) # types slower, like a user
|
264
119
|
# ```
|
265
|
-
#
|
120
|
+
#
|
266
121
|
# > NOTE: Modifier keys DO NOT effect `keyboard.type`. Holding down `Shift` will not type the text in upper case.
|
122
|
+
# > NOTE: For characters that are not on a US keyboard, only an `input` event will be sent.
|
267
123
|
def type(text, delay: nil)
|
268
124
|
wrap_impl(@impl.type(unwrap_impl(text), delay: unwrap_impl(delay)))
|
269
125
|
end
|
data/lib/playwright_api/mouse.rb
CHANGED
@@ -1,42 +1,8 @@
|
|
1
1
|
module Playwright
|
2
2
|
# The Mouse class operates in main-frame CSS pixels relative to the top-left corner of the viewport.
|
3
|
-
#
|
3
|
+
#
|
4
4
|
# Every `page` object has its own Mouse, accessible with [`property: Page.mouse`].
|
5
|
-
#
|
6
5
|
#
|
7
|
-
# ```js
|
8
|
-
# // Using ‘page.mouse’ to trace a 100x100 square.
|
9
|
-
# await page.mouse.move(0, 0);
|
10
|
-
# await page.mouse.down();
|
11
|
-
# await page.mouse.move(0, 100);
|
12
|
-
# await page.mouse.move(100, 100);
|
13
|
-
# await page.mouse.move(100, 0);
|
14
|
-
# await page.mouse.move(0, 0);
|
15
|
-
# await page.mouse.up();
|
16
|
-
# ```
|
17
|
-
#
|
18
|
-
# ```java
|
19
|
-
# // Using ‘page.mouse’ to trace a 100x100 square.
|
20
|
-
# page.mouse().move(0, 0);
|
21
|
-
# page.mouse().down();
|
22
|
-
# page.mouse().move(0, 100);
|
23
|
-
# page.mouse().move(100, 100);
|
24
|
-
# page.mouse().move(100, 0);
|
25
|
-
# page.mouse().move(0, 0);
|
26
|
-
# page.mouse().up();
|
27
|
-
# ```
|
28
|
-
#
|
29
|
-
# ```python async
|
30
|
-
# # using ‘page.mouse’ to trace a 100x100 square.
|
31
|
-
# await page.mouse.move(0, 0)
|
32
|
-
# await page.mouse.down()
|
33
|
-
# await page.mouse.move(0, 100)
|
34
|
-
# await page.mouse.move(100, 100)
|
35
|
-
# await page.mouse.move(100, 0)
|
36
|
-
# await page.mouse.move(0, 0)
|
37
|
-
# await page.mouse.up()
|
38
|
-
# ```
|
39
|
-
#
|
40
6
|
# ```python sync
|
41
7
|
# # using ‘page.mouse’ to trace a 100x100 square.
|
42
8
|
# page.mouse.move(0, 0)
|
@@ -47,16 +13,6 @@ module Playwright
|
|
47
13
|
# page.mouse.move(0, 0)
|
48
14
|
# page.mouse.up()
|
49
15
|
# ```
|
50
|
-
#
|
51
|
-
# ```csharp
|
52
|
-
# await Page.Mouse.MoveAsync(0, 0);
|
53
|
-
# await Page.Mouse.DownAsync();
|
54
|
-
# await Page.Mouse.MoveAsync(0, 100);
|
55
|
-
# await Page.Mouse.MoveAsync(100, 100);
|
56
|
-
# await Page.Mouse.MoveAsync(100, 0);
|
57
|
-
# await Page.Mouse.MoveAsync(0, 0);
|
58
|
-
# await Page.Mouse.UpAsync();
|
59
|
-
# ```
|
60
16
|
class Mouse < PlaywrightApi
|
61
17
|
|
62
18
|
# Shortcut for [`method: Mouse.move`], [`method: Mouse.down`], [`method: Mouse.up`].
|