puppeteer-ruby 0.41.0 → 0.42.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -1
- data/docs/api_coverage.md +221 -206
- data/lib/puppeteer/element_handle.rb +10 -22
- data/lib/puppeteer/frame.rb +4 -0
- data/lib/puppeteer/remote_object.rb +4 -0
- data/lib/puppeteer/version.rb +1 -1
- data/puppeteer-ruby.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b06e1f5f867ef4e7d648e93becc953f660bb707b29019ffe6e93f8e9f02acc4
|
4
|
+
data.tar.gz: ff082c6ba661e0f2d8b0d8bc0f92f5aeecf036f9edcd7bb6f8937db4fd019947
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19b67fb8ef13bac90538e8755905749427a7131bba5088c16f512b51d72833d80ee296ea7537b5122bb531a28d3c95c7924cd199dc6343ab17a1b3d2c391af9b
|
7
|
+
data.tar.gz: c65cb7780075ddea13c60b6c668b8a9a6d53627a8dbfa263f08694777ff10f1a3f3a98eeb2596a6497e0274a3a6d6aafc24a215ee6873c07485dc400444c0c17
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,11 @@
|
|
1
|
-
### main [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.
|
1
|
+
### main [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.42.0...main)]
|
2
2
|
|
3
3
|
- xxx
|
4
4
|
|
5
|
+
### 0.42.0 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.41.0...0.42.0)]
|
6
|
+
|
7
|
+
- Port Puppeteer v15.3-v15.5 features, including `Frame#page`
|
8
|
+
|
5
9
|
### 0.41.0 [[diff](https://github.com/YusukeIwaki/puppeteer-ruby/compare/0.40.7...0.41.0)]
|
6
10
|
|
7
11
|
- Port Puppeteer v14.0-v15.2 features, including `ElementHandle#wait_for_xpath`
|
data/docs/api_coverage.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# API coverages
|
2
|
-
- Puppeteer version: v15.
|
3
|
-
- puppeteer-ruby version: 0.
|
2
|
+
- Puppeteer version: v15.5.0
|
3
|
+
- puppeteer-ruby version: 0.42.0
|
4
4
|
|
5
5
|
## Puppeteer
|
6
6
|
|
@@ -14,20 +14,12 @@
|
|
14
14
|
* executablePath => `#executable_path`
|
15
15
|
* launch
|
16
16
|
* networkConditions => `#network_conditions`
|
17
|
-
* product
|
18
17
|
* ~~registerCustomQueryHandler~~
|
19
18
|
* ~~unregisterCustomQueryHandler~~
|
20
19
|
|
21
|
-
## ~~
|
20
|
+
## ~~Accessibility~~
|
22
21
|
|
23
|
-
* ~~
|
24
|
-
* ~~download~~
|
25
|
-
* ~~host~~
|
26
|
-
* ~~localRevisions~~
|
27
|
-
* ~~platform~~
|
28
|
-
* ~~product~~
|
29
|
-
* ~~remove~~
|
30
|
-
* ~~revisionInfo~~
|
22
|
+
* ~~snapshot~~
|
31
23
|
|
32
24
|
## Browser
|
33
25
|
|
@@ -59,138 +51,55 @@
|
|
59
51
|
* targets
|
60
52
|
* waitForTarget => `#wait_for_target`
|
61
53
|
|
62
|
-
##
|
63
|
-
|
64
|
-
* $ => `#query_selector`
|
65
|
-
* $$ => `#query_selector_all`
|
66
|
-
* $$eval => `#eval_on_selector_all`
|
67
|
-
* $eval => `#eval_on_selector`
|
68
|
-
* $x => `#Sx`
|
69
|
-
* accessibility
|
70
|
-
* addScriptTag => `#add_script_tag`
|
71
|
-
* addStyleTag => `#add_style_tag`
|
72
|
-
* authenticate
|
73
|
-
* bringToFront => `#bring_to_front`
|
74
|
-
* browser
|
75
|
-
* browserContext => `#browser_context`
|
76
|
-
* click
|
77
|
-
* close
|
78
|
-
* content
|
79
|
-
* cookies
|
80
|
-
* coverage
|
81
|
-
* createPDFStream => `#create_pdf_stream`
|
82
|
-
* deleteCookie => `#delete_cookie`
|
83
|
-
* emulate
|
84
|
-
* emulateCPUThrottling => `#emulate_cpu_throttling`
|
85
|
-
* emulateIdleState => `#emulate_idle_state`
|
86
|
-
* emulateMediaFeatures => `#emulate_media_features`
|
87
|
-
* emulateMediaType => `#emulate_media_type`
|
88
|
-
* emulateNetworkConditions => `#emulate_network_conditions`
|
89
|
-
* emulateTimezone => `#emulate_timezone`
|
90
|
-
* emulateVisionDeficiency => `#emulate_vision_deficiency`
|
91
|
-
* evaluate
|
92
|
-
* evaluateHandle => `#evaluate_handle`
|
93
|
-
* evaluateOnNewDocument => `#evaluate_on_new_document`
|
94
|
-
* exposeFunction => `#expose_function`
|
95
|
-
* focus
|
96
|
-
* frames
|
97
|
-
* goBack => `#go_back`
|
98
|
-
* goForward => `#go_forward`
|
99
|
-
* goto
|
100
|
-
* hover
|
101
|
-
* isClosed => `#closed?`
|
102
|
-
* isDragInterceptionEnabled => `#drag_interception_enabled?`
|
103
|
-
* isJavaScriptEnabled => `#javascript_enabled?`
|
104
|
-
* keyboard
|
105
|
-
* mainFrame => `#main_frame`
|
106
|
-
* metrics
|
107
|
-
* mouse
|
108
|
-
* pdf
|
109
|
-
* queryObjects => `#query_objects`
|
110
|
-
* reload
|
111
|
-
* screenshot
|
112
|
-
* select
|
113
|
-
* setBypassCSP => `#bypass_csp=`
|
114
|
-
* setCacheEnabled => `#cache_enabled=`
|
115
|
-
* setContent => `#content=`
|
116
|
-
* setCookie => `#set_cookie`
|
117
|
-
* setDefaultNavigationTimeout => `#default_navigation_timeout=`
|
118
|
-
* setDefaultTimeout => `#default_timeout=`
|
119
|
-
* ~~setDragInterception~~
|
120
|
-
* setExtraHTTPHeaders => `#extra_http_headers=`
|
121
|
-
* setGeolocation => `#geolocation=`
|
122
|
-
* setJavaScriptEnabled => `#javascript_enabled=`
|
123
|
-
* setOfflineMode => `#offline_mode=`
|
124
|
-
* setRequestInterception => `#request_interception=`
|
125
|
-
* setUserAgent => `#user_agent=`
|
126
|
-
* setViewport => `#viewport=`
|
127
|
-
* tap
|
128
|
-
* target
|
129
|
-
* title
|
130
|
-
* ~~touchscreen~~
|
131
|
-
* tracing
|
132
|
-
* type => `#type_text`
|
133
|
-
* url
|
134
|
-
* viewport
|
135
|
-
* ~~waitFor~~
|
136
|
-
* waitForFileChooser => `#wait_for_file_chooser`
|
137
|
-
* waitForFrame => `#wait_for_frame`
|
138
|
-
* waitForFunction => `#wait_for_function`
|
139
|
-
* waitForNavigation => `#wait_for_navigation`
|
140
|
-
* ~~waitForNetworkIdle~~
|
141
|
-
* waitForRequest => `#wait_for_request`
|
142
|
-
* waitForResponse => `#wait_for_response`
|
143
|
-
* waitForSelector => `#wait_for_selector`
|
144
|
-
* waitForTimeout => `#wait_for_timeout`
|
145
|
-
* waitForXPath => `#wait_for_xpath`
|
146
|
-
* workers
|
147
|
-
|
148
|
-
## ~~WebWorker~~
|
54
|
+
## ~~BrowserFetcher~~
|
149
55
|
|
150
|
-
* ~~
|
151
|
-
* ~~
|
152
|
-
* ~~
|
153
|
-
* ~~
|
56
|
+
* ~~canDownload~~
|
57
|
+
* ~~download~~
|
58
|
+
* ~~host~~
|
59
|
+
* ~~localRevisions~~
|
60
|
+
* ~~platform~~
|
61
|
+
* ~~product~~
|
62
|
+
* ~~remove~~
|
63
|
+
* ~~revisionInfo~~
|
154
64
|
|
155
|
-
##
|
65
|
+
## CDPSession
|
156
66
|
|
157
|
-
*
|
67
|
+
* connection
|
68
|
+
* detach
|
69
|
+
* id
|
70
|
+
* send
|
158
71
|
|
159
|
-
##
|
72
|
+
## Connection
|
160
73
|
|
161
|
-
*
|
162
|
-
*
|
163
|
-
*
|
164
|
-
*
|
165
|
-
*
|
74
|
+
* createSession => `#create_session`
|
75
|
+
* dispose
|
76
|
+
* ~~fromSession~~
|
77
|
+
* send
|
78
|
+
* session
|
79
|
+
* url
|
166
80
|
|
167
|
-
##
|
81
|
+
## ConsoleMessage
|
168
82
|
|
169
|
-
*
|
170
|
-
*
|
171
|
-
*
|
172
|
-
*
|
173
|
-
*
|
174
|
-
* dragOver => `#drag_over`
|
175
|
-
* drop
|
176
|
-
* move
|
177
|
-
* up
|
178
|
-
* wheel
|
83
|
+
* args
|
84
|
+
* location
|
85
|
+
* stackTrace => `#stack_trace`
|
86
|
+
* text
|
87
|
+
* ~~type~~
|
179
88
|
|
180
|
-
##
|
89
|
+
## Coverage
|
181
90
|
|
182
|
-
*
|
91
|
+
* startCSSCoverage => `#start_css_coverage`
|
92
|
+
* startJSCoverage => `#start_js_coverage`
|
93
|
+
* stopCSSCoverage => `#stop_css_coverage`
|
94
|
+
* stopJSCoverage => `#stop_js_coverage`
|
183
95
|
|
184
|
-
##
|
96
|
+
## CSSCoverage
|
185
97
|
|
186
98
|
* start
|
187
99
|
* stop
|
188
100
|
|
189
|
-
##
|
101
|
+
## ~~CustomError~~
|
190
102
|
|
191
|
-
* accept
|
192
|
-
* cancel
|
193
|
-
* isMultiple => `#multiple?`
|
194
103
|
|
195
104
|
## Dialog
|
196
105
|
|
@@ -200,49 +109,47 @@
|
|
200
109
|
* message
|
201
110
|
* type
|
202
111
|
|
203
|
-
##
|
204
|
-
|
205
|
-
* args
|
206
|
-
* location
|
207
|
-
* stackTrace => `#stack_trace`
|
208
|
-
* text
|
209
|
-
* ~~type~~
|
210
|
-
|
211
|
-
## Frame
|
112
|
+
## ElementHandle
|
212
113
|
|
213
114
|
* $ => `#query_selector`
|
214
115
|
* $$ => `#query_selector_all`
|
215
116
|
* $$eval => `#eval_on_selector_all`
|
216
117
|
* $eval => `#eval_on_selector`
|
217
118
|
* $x => `#Sx`
|
218
|
-
*
|
219
|
-
*
|
220
|
-
*
|
119
|
+
* asElement => `#as_element`
|
120
|
+
* boundingBox => `#bounding_box`
|
121
|
+
* boxModel => `#box_model`
|
221
122
|
* click
|
222
|
-
*
|
223
|
-
*
|
224
|
-
*
|
225
|
-
*
|
123
|
+
* clickablePoint => `#clickable_point`
|
124
|
+
* contentFrame => `#content_frame`
|
125
|
+
* drag
|
126
|
+
* dragAndDrop => `#drag_and_drop`
|
127
|
+
* dragEnter => `#drag_enter`
|
128
|
+
* dragOver => `#drag_over`
|
129
|
+
* drop
|
226
130
|
* focus
|
227
|
-
* goto
|
228
131
|
* hover
|
229
|
-
*
|
230
|
-
*
|
231
|
-
*
|
232
|
-
* parentFrame => `#parent_frame`
|
132
|
+
* isIntersectingViewport => `#intersecting_viewport?`
|
133
|
+
* press
|
134
|
+
* screenshot
|
233
135
|
* select
|
234
|
-
* setContent => `#set_content`
|
235
136
|
* tap
|
236
|
-
* title
|
237
137
|
* type => `#type_text`
|
238
|
-
*
|
239
|
-
* ~~waitFor~~
|
240
|
-
* waitForFunction => `#wait_for_function`
|
241
|
-
* waitForNavigation => `#wait_for_navigation`
|
138
|
+
* uploadFile => `#upload_file`
|
242
139
|
* waitForSelector => `#wait_for_selector`
|
243
|
-
* waitForTimeout => `#wait_for_timeout`
|
244
140
|
* waitForXPath => `#wait_for_xpath`
|
245
141
|
|
142
|
+
## ~~EventEmitter~~
|
143
|
+
|
144
|
+
* ~~addListener~~
|
145
|
+
* ~~emit~~
|
146
|
+
* ~~listenerCount~~
|
147
|
+
* ~~off~~
|
148
|
+
* ~~on~~
|
149
|
+
* ~~once~~
|
150
|
+
* ~~removeAllListeners~~
|
151
|
+
* ~~removeListener~~
|
152
|
+
|
246
153
|
## ExecutionContext
|
247
154
|
|
248
155
|
* evaluate
|
@@ -250,53 +157,45 @@
|
|
250
157
|
* frame
|
251
158
|
* ~~queryObjects~~
|
252
159
|
|
253
|
-
##
|
160
|
+
## FileChooser
|
254
161
|
|
255
|
-
*
|
256
|
-
*
|
257
|
-
*
|
258
|
-
* evaluateHandle => `#evaluate_handle`
|
259
|
-
* executionContext => `#execution_context`
|
260
|
-
* getProperties => `#properties`
|
261
|
-
* getProperty => `#[]`
|
262
|
-
* jsonValue => `#json_value`
|
162
|
+
* accept
|
163
|
+
* cancel
|
164
|
+
* isMultiple => `#multiple?`
|
263
165
|
|
264
|
-
##
|
166
|
+
## Frame
|
265
167
|
|
266
168
|
* $ => `#query_selector`
|
267
169
|
* $$ => `#query_selector_all`
|
268
170
|
* $$eval => `#eval_on_selector_all`
|
269
171
|
* $eval => `#eval_on_selector`
|
270
172
|
* $x => `#Sx`
|
271
|
-
*
|
272
|
-
*
|
273
|
-
*
|
173
|
+
* addScriptTag => `#add_script_tag`
|
174
|
+
* addStyleTag => `#add_style_tag`
|
175
|
+
* childFrames => `#child_frames`
|
274
176
|
* click
|
275
|
-
*
|
276
|
-
* contentFrame => `#content_frame`
|
277
|
-
* dispose
|
278
|
-
* drag
|
279
|
-
* dragAndDrop => `#drag_and_drop`
|
280
|
-
* dragEnter => `#drag_enter`
|
281
|
-
* dragOver => `#drag_over`
|
282
|
-
* drop
|
177
|
+
* content
|
283
178
|
* evaluate
|
284
179
|
* evaluateHandle => `#evaluate_handle`
|
285
180
|
* executionContext => `#execution_context`
|
286
181
|
* focus
|
287
|
-
*
|
288
|
-
* getProperty => `#[]`
|
182
|
+
* goto
|
289
183
|
* hover
|
290
|
-
*
|
291
|
-
*
|
292
|
-
*
|
293
|
-
*
|
184
|
+
* isDetached => `#detached?`
|
185
|
+
* isOOPFrame => `#oop_frame?`
|
186
|
+
* name
|
187
|
+
* page
|
188
|
+
* parentFrame => `#parent_frame`
|
294
189
|
* select
|
190
|
+
* setContent => `#set_content`
|
295
191
|
* tap
|
296
|
-
*
|
192
|
+
* title
|
297
193
|
* type => `#type_text`
|
298
|
-
*
|
194
|
+
* url
|
195
|
+
* waitForFunction => `#wait_for_function`
|
196
|
+
* waitForNavigation => `#wait_for_navigation`
|
299
197
|
* waitForSelector => `#wait_for_selector`
|
198
|
+
* waitForTimeout => `#wait_for_timeout`
|
300
199
|
* waitForXPath => `#wait_for_xpath`
|
301
200
|
|
302
201
|
## HTTPRequest
|
@@ -341,6 +240,131 @@
|
|
341
240
|
* ~~timing~~
|
342
241
|
* url
|
343
242
|
|
243
|
+
## JSCoverage
|
244
|
+
|
245
|
+
* start
|
246
|
+
* stop
|
247
|
+
|
248
|
+
## JSHandle
|
249
|
+
|
250
|
+
* asElement => `#as_element`
|
251
|
+
* dispose
|
252
|
+
* evaluate
|
253
|
+
* evaluateHandle => `#evaluate_handle`
|
254
|
+
* executionContext => `#execution_context`
|
255
|
+
* getProperties => `#properties`
|
256
|
+
* getProperty => `#[]`
|
257
|
+
* getProperty => `#[]`
|
258
|
+
* jsonValue => `#json_value`
|
259
|
+
* remoteObject => `#remote_object`
|
260
|
+
* ~~toString~~
|
261
|
+
|
262
|
+
## Keyboard
|
263
|
+
|
264
|
+
* down
|
265
|
+
* press
|
266
|
+
* sendCharacter => `#send_character`
|
267
|
+
* type => `#type_text`
|
268
|
+
* up
|
269
|
+
|
270
|
+
## Mouse
|
271
|
+
|
272
|
+
* click
|
273
|
+
* down
|
274
|
+
* drag
|
275
|
+
* dragAndDrop => `#drag_and_drop`
|
276
|
+
* dragEnter => `#drag_enter`
|
277
|
+
* dragOver => `#drag_over`
|
278
|
+
* drop
|
279
|
+
* move
|
280
|
+
* up
|
281
|
+
* wheel
|
282
|
+
|
283
|
+
## Page
|
284
|
+
|
285
|
+
* $ => `#query_selector`
|
286
|
+
* $$ => `#query_selector_all`
|
287
|
+
* $$eval => `#eval_on_selector_all`
|
288
|
+
* $eval => `#eval_on_selector`
|
289
|
+
* $x => `#Sx`
|
290
|
+
* addScriptTag => `#add_script_tag`
|
291
|
+
* addStyleTag => `#add_style_tag`
|
292
|
+
* authenticate
|
293
|
+
* bringToFront => `#bring_to_front`
|
294
|
+
* browser
|
295
|
+
* browserContext => `#browser_context`
|
296
|
+
* click
|
297
|
+
* close
|
298
|
+
* content
|
299
|
+
* cookies
|
300
|
+
* createPDFStream => `#create_pdf_stream`
|
301
|
+
* deleteCookie => `#delete_cookie`
|
302
|
+
* emulate
|
303
|
+
* emulateCPUThrottling => `#emulate_cpu_throttling`
|
304
|
+
* emulateIdleState => `#emulate_idle_state`
|
305
|
+
* emulateMediaFeatures => `#emulate_media_features`
|
306
|
+
* emulateMediaType => `#emulate_media_type`
|
307
|
+
* emulateNetworkConditions => `#emulate_network_conditions`
|
308
|
+
* emulateTimezone => `#emulate_timezone`
|
309
|
+
* emulateVisionDeficiency => `#emulate_vision_deficiency`
|
310
|
+
* evaluate
|
311
|
+
* evaluateHandle => `#evaluate_handle`
|
312
|
+
* evaluateOnNewDocument => `#evaluate_on_new_document`
|
313
|
+
* exposeFunction => `#expose_function`
|
314
|
+
* focus
|
315
|
+
* frames
|
316
|
+
* goBack => `#go_back`
|
317
|
+
* goForward => `#go_forward`
|
318
|
+
* goto
|
319
|
+
* hover
|
320
|
+
* isClosed => `#closed?`
|
321
|
+
* isDragInterceptionEnabled => `#drag_interception_enabled?`
|
322
|
+
* isJavaScriptEnabled => `#javascript_enabled?`
|
323
|
+
* mainFrame => `#main_frame`
|
324
|
+
* metrics
|
325
|
+
* ~~off~~
|
326
|
+
* on
|
327
|
+
* once
|
328
|
+
* pdf
|
329
|
+
* queryObjects => `#query_objects`
|
330
|
+
* reload
|
331
|
+
* screenshot
|
332
|
+
* select
|
333
|
+
* setBypassCSP => `#bypass_csp=`
|
334
|
+
* setCacheEnabled => `#cache_enabled=`
|
335
|
+
* setContent => `#content=`
|
336
|
+
* setCookie => `#set_cookie`
|
337
|
+
* setDefaultNavigationTimeout => `#default_navigation_timeout=`
|
338
|
+
* setDefaultTimeout => `#default_timeout=`
|
339
|
+
* ~~setDragInterception~~
|
340
|
+
* setExtraHTTPHeaders => `#extra_http_headers=`
|
341
|
+
* setGeolocation => `#geolocation=`
|
342
|
+
* setJavaScriptEnabled => `#javascript_enabled=`
|
343
|
+
* setOfflineMode => `#offline_mode=`
|
344
|
+
* setRequestInterception => `#request_interception=`
|
345
|
+
* setUserAgent => `#user_agent=`
|
346
|
+
* setViewport => `#viewport=`
|
347
|
+
* tap
|
348
|
+
* target
|
349
|
+
* title
|
350
|
+
* type => `#type_text`
|
351
|
+
* url
|
352
|
+
* viewport
|
353
|
+
* waitForFileChooser => `#wait_for_file_chooser`
|
354
|
+
* waitForFrame => `#wait_for_frame`
|
355
|
+
* waitForFunction => `#wait_for_function`
|
356
|
+
* waitForNavigation => `#wait_for_navigation`
|
357
|
+
* ~~waitForNetworkIdle~~
|
358
|
+
* waitForRequest => `#wait_for_request`
|
359
|
+
* waitForResponse => `#wait_for_response`
|
360
|
+
* waitForSelector => `#wait_for_selector`
|
361
|
+
* waitForTimeout => `#wait_for_timeout`
|
362
|
+
* waitForXPath => `#wait_for_xpath`
|
363
|
+
* workers
|
364
|
+
|
365
|
+
## ~~ProtocolError~~
|
366
|
+
|
367
|
+
|
344
368
|
## ~~SecurityDetails~~
|
345
369
|
|
346
370
|
* ~~issuer~~
|
@@ -361,30 +385,21 @@
|
|
361
385
|
* url
|
362
386
|
* ~~worker~~
|
363
387
|
|
364
|
-
##
|
388
|
+
## TimeoutError
|
365
389
|
|
366
|
-
* connection
|
367
|
-
* detach
|
368
|
-
* id
|
369
|
-
* send
|
370
390
|
|
371
|
-
##
|
391
|
+
## ~~Touchscreen~~
|
372
392
|
|
373
|
-
*
|
374
|
-
* startJSCoverage => `#start_js_coverage`
|
375
|
-
* stopCSSCoverage => `#stop_css_coverage`
|
376
|
-
* stopJSCoverage => `#stop_js_coverage`
|
393
|
+
* ~~tap~~
|
377
394
|
|
378
|
-
##
|
395
|
+
## Tracing
|
379
396
|
|
397
|
+
* start
|
398
|
+
* stop
|
380
399
|
|
381
|
-
## ~~
|
400
|
+
## ~~WebWorker~~
|
382
401
|
|
383
|
-
* ~~
|
384
|
-
* ~~
|
385
|
-
* ~~
|
386
|
-
* ~~
|
387
|
-
* ~~on~~
|
388
|
-
* ~~once~~
|
389
|
-
* ~~removeAllListeners~~
|
390
|
-
* ~~removeListener~~
|
402
|
+
* ~~evaluate~~
|
403
|
+
* ~~evaluateHandle~~
|
404
|
+
* ~~executionContext~~
|
405
|
+
* ~~url~~
|
@@ -169,37 +169,25 @@ class Puppeteer::ElementHandle < Puppeteer::JSHandle
|
|
169
169
|
|
170
170
|
def scroll_into_view_if_needed
|
171
171
|
js = <<~JAVASCRIPT
|
172
|
-
async(element
|
172
|
+
async(element) => {
|
173
173
|
if (!element.isConnected)
|
174
174
|
return 'Node is detached from document';
|
175
175
|
if (element.nodeType !== Node.ELEMENT_NODE)
|
176
176
|
return 'Node is not of type HTMLElement';
|
177
|
-
|
178
|
-
if (element.scrollIntoViewIfNeeded) {
|
179
|
-
element.scrollIntoViewIfNeeded({block: 'center', inline: 'center', behavior: 'instant'});
|
180
|
-
} else {
|
181
|
-
// force-scroll if page's javascript is disabled.
|
182
|
-
if (!pageJavascriptEnabled) {
|
183
|
-
element.scrollIntoView({block: 'center', inline: 'center', behavior: 'instant'});
|
184
|
-
return false;
|
185
|
-
}
|
186
|
-
const visibleRatio = await new Promise(resolve => {
|
187
|
-
const observer = new IntersectionObserver(entries => {
|
188
|
-
resolve(entries[0].intersectionRatio);
|
189
|
-
observer.disconnect();
|
190
|
-
});
|
191
|
-
observer.observe(element);
|
192
|
-
});
|
193
|
-
if (visibleRatio !== 1.0)
|
194
|
-
element.scrollIntoView({block: 'center', inline: 'center', behavior: 'instant'});
|
195
|
-
}
|
196
177
|
return false;
|
197
178
|
}
|
198
179
|
JAVASCRIPT
|
199
|
-
error = evaluate(js
|
180
|
+
error = evaluate(js) # returns String or false
|
200
181
|
if error
|
201
182
|
raise ScrollIntoViewError.new(error)
|
202
183
|
end
|
184
|
+
begin
|
185
|
+
@remote_object.scroll_into_view_if_needed(@client)
|
186
|
+
rescue => err
|
187
|
+
# Just ignore 'Node does not have a layout object' for backward-compatibility.
|
188
|
+
raise unless err.message =~ /Node does not have a layout object/
|
189
|
+
end
|
190
|
+
|
203
191
|
# clickpoint is often calculated before scrolling is completed.
|
204
192
|
# So, just sleep about 10 frames
|
205
193
|
sleep 0.16
|
@@ -569,7 +557,7 @@ class Puppeteer::ElementHandle < Puppeteer::JSHandle
|
|
569
557
|
capture_beyond_viewport: capture_beyond_viewport,
|
570
558
|
from_surface: from_surface)
|
571
559
|
ensure
|
572
|
-
if needs_viewport_reset
|
560
|
+
if needs_viewport_reset && viewport
|
573
561
|
@page.viewport = viewport
|
574
562
|
end
|
575
563
|
end
|
data/lib/puppeteer/frame.rb
CHANGED
@@ -176,4 +176,8 @@ class Puppeteer::RemoteObject
|
|
176
176
|
def set_file_input_files(client, files, backend_node_id)
|
177
177
|
client.send_message('DOM.setFileInputFiles', objectId: @object_id, files: files, backendNodeId: backend_node_id)
|
178
178
|
end
|
179
|
+
|
180
|
+
def scroll_into_view_if_needed(client)
|
181
|
+
client.send_message('DOM.scrollIntoViewIfNeeded', objectId: @object_id)
|
182
|
+
end
|
179
183
|
end
|
data/lib/puppeteer/version.rb
CHANGED
data/puppeteer-ruby.gemspec
CHANGED
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.add_development_dependency 'rollbar'
|
33
33
|
spec.add_development_dependency 'rspec', '~> 3.11.0'
|
34
34
|
spec.add_development_dependency 'rspec_junit_formatter' # for CircleCI.
|
35
|
-
spec.add_development_dependency 'rubocop', '~> 1.
|
35
|
+
spec.add_development_dependency 'rubocop', '~> 1.35.0'
|
36
36
|
spec.add_development_dependency 'rubocop-rspec'
|
37
37
|
spec.add_development_dependency 'sinatra'
|
38
38
|
spec.add_development_dependency 'webrick'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppeteer-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.42.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-
|
11
|
+
date: 2022-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -170,14 +170,14 @@ dependencies:
|
|
170
170
|
requirements:
|
171
171
|
- - "~>"
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version: 1.
|
173
|
+
version: 1.35.0
|
174
174
|
type: :development
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
178
|
- - "~>"
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version: 1.
|
180
|
+
version: 1.35.0
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: rubocop-rspec
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|