presidium 3.3.3 → 3.4.1
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.
- package/GoogleChromeDevTools.js +120 -2
- package/GoogleChromeForTesting.js +4 -0
- package/package.json +1 -1
package/GoogleChromeDevTools.js
CHANGED
|
@@ -141,6 +141,33 @@ class GoogleChromeDevToolsPage {
|
|
|
141
141
|
this.websocket = websocket
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
+
/**
|
|
145
|
+
* @name Page.enable
|
|
146
|
+
*
|
|
147
|
+
* @docs
|
|
148
|
+
* ```coffeescript [specscript]
|
|
149
|
+
* Page.enable(options {
|
|
150
|
+
* sessionId: string,
|
|
151
|
+
* }) -> data Promise<{}>
|
|
152
|
+
* ```
|
|
153
|
+
*
|
|
154
|
+
* Enables Page events for the current target.
|
|
155
|
+
*
|
|
156
|
+
* Arguments:
|
|
157
|
+
* * `options`
|
|
158
|
+
* * `sessionId` - the session ID.
|
|
159
|
+
*
|
|
160
|
+
* Return:
|
|
161
|
+
* * `data` - promise of an empty object.
|
|
162
|
+
*
|
|
163
|
+
* ```javascript
|
|
164
|
+
* await googleChromeDevTools.Page.enable()
|
|
165
|
+
* ```
|
|
166
|
+
*/
|
|
167
|
+
enable(options = {}) {
|
|
168
|
+
return _Method.call(this, 'Page.enable', options)
|
|
169
|
+
}
|
|
170
|
+
|
|
144
171
|
/**
|
|
145
172
|
* @name Page.navigate
|
|
146
173
|
*
|
|
@@ -176,6 +203,98 @@ class GoogleChromeDevToolsPage {
|
|
|
176
203
|
navigate(options = {}) {
|
|
177
204
|
return _Method.call(this, 'Page.navigate', options)
|
|
178
205
|
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* @name Page.handleJavaScriptDialog
|
|
209
|
+
*
|
|
210
|
+
* @docs
|
|
211
|
+
* ```coffeescript [specscript]
|
|
212
|
+
* Page.handleJavaScriptDialog(options {
|
|
213
|
+
* sessionId: string,
|
|
214
|
+
* accept: boolean,
|
|
215
|
+
* promptText: string,
|
|
216
|
+
* }) -> data Promise<{}>
|
|
217
|
+
* ```
|
|
218
|
+
*
|
|
219
|
+
* Handles (accepts or dismisses) a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload).
|
|
220
|
+
*
|
|
221
|
+
* Arguments:
|
|
222
|
+
* * `options`
|
|
223
|
+
* * `sessionId` - the session ID.
|
|
224
|
+
* * `accept` - whether to accept or dismiss the dialog.
|
|
225
|
+
* * `promptText` - the text to enter into the dialog prompt before accepting.
|
|
226
|
+
*
|
|
227
|
+
* Return:
|
|
228
|
+
* * `data` - promise of an empty object.
|
|
229
|
+
*
|
|
230
|
+
* ```javascript
|
|
231
|
+
* await googleChromeDevTools.Page.handleJavaScriptDialog({
|
|
232
|
+
* url: 'http://localhost:3000/',
|
|
233
|
+
* })
|
|
234
|
+
* ```
|
|
235
|
+
*/
|
|
236
|
+
handleJavaScriptDialog(options = {}) {
|
|
237
|
+
return _Method.call(this, 'Page.handleJavaScriptDialog', options)
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* @name Event: Page.javascriptDialogOpening
|
|
242
|
+
*
|
|
243
|
+
* @docs
|
|
244
|
+
* ```coffeescript [specscript]
|
|
245
|
+
* emit('Page.javascriptDialogOpening', data {
|
|
246
|
+
* url: string,
|
|
247
|
+
* frameId: string,
|
|
248
|
+
* message: string,
|
|
249
|
+
* type: 'alert'|'confirm'|'prompt'|'beforeunload',
|
|
250
|
+
* hasBrowserHandler: boolean,
|
|
251
|
+
* })
|
|
252
|
+
* ```
|
|
253
|
+
*
|
|
254
|
+
* The `DOM.attributeModified` event. Emitted when an attribute of an element is modified.
|
|
255
|
+
*
|
|
256
|
+
* Event Data:
|
|
257
|
+
* `data`
|
|
258
|
+
* * `url` - the frame URL.
|
|
259
|
+
* * `frameId` - the frame ID.
|
|
260
|
+
* * `message` - message displayed by the dialog.
|
|
261
|
+
* * `type` - the dialog type.
|
|
262
|
+
* * `hasBrowserHandler` - whether the browser is capable of acting on the given dialog.
|
|
263
|
+
*
|
|
264
|
+
* ```javascript
|
|
265
|
+
* googleChromeDevTools.on('Page.javascriptDialogOpening', data => {
|
|
266
|
+
* console.log('dialog opening', data)
|
|
267
|
+
* })
|
|
268
|
+
* ```
|
|
269
|
+
*/
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* @name Event: Page.javascriptDialogClosed
|
|
273
|
+
*
|
|
274
|
+
* @docs
|
|
275
|
+
* ```coffeescript [specscript]
|
|
276
|
+
* emit('Page.javascriptDialogClosed', data {
|
|
277
|
+
* frameId: string,
|
|
278
|
+
* result: boolean,
|
|
279
|
+
* userInput: string,
|
|
280
|
+
* })
|
|
281
|
+
* ```
|
|
282
|
+
*
|
|
283
|
+
* The `DOM.attributeModified` event. Emitted when an attribute of an element is modified.
|
|
284
|
+
*
|
|
285
|
+
* Event Data:
|
|
286
|
+
* `data`
|
|
287
|
+
* * `frameId` - the frame ID.
|
|
288
|
+
* * `result` - whether the dialog was confirmed.
|
|
289
|
+
* * `userInput` - the user input if the dialog was a prompt.
|
|
290
|
+
*
|
|
291
|
+
* ```javascript
|
|
292
|
+
* googleChromeDevTools.on('Page.javascriptDialogClosed', data => {
|
|
293
|
+
* console.log('dialog closed', data)
|
|
294
|
+
* })
|
|
295
|
+
* ```
|
|
296
|
+
*/
|
|
297
|
+
|
|
179
298
|
}
|
|
180
299
|
|
|
181
300
|
class GoogleChromeDevToolsDOM {
|
|
@@ -1054,7 +1173,7 @@ class GoogleChromeDevTools extends EventEmitter {
|
|
|
1054
1173
|
})
|
|
1055
1174
|
await this.googleChromeForTesting.init()
|
|
1056
1175
|
|
|
1057
|
-
console.log('
|
|
1176
|
+
console.log('Initializing websocket with devtoolsUrl:', this.googleChromeForTesting.devtoolsUrl)
|
|
1058
1177
|
this.websocket = new WebSocket(this.googleChromeForTesting.devtoolsUrl, {
|
|
1059
1178
|
offerPerMessageDeflate: false,
|
|
1060
1179
|
})
|
|
@@ -1069,7 +1188,6 @@ class GoogleChromeDevTools extends EventEmitter {
|
|
|
1069
1188
|
this.websocket.on('message', message => {
|
|
1070
1189
|
const data = JSON.parse(message.toString('utf8'))
|
|
1071
1190
|
if (data.method) {
|
|
1072
|
-
console.log('Event:', data.method, JSON.stringify(data.params))
|
|
1073
1191
|
this.emit(data.method, data.params)
|
|
1074
1192
|
}
|
|
1075
1193
|
})
|