1
1
mirror of https://github.com/namibia/awesome-cheatsheets.git synced 2024-12-19 08:49:45 +00:00

docs(puppetter): add mouse, touchscreen, tracing, fileChooser, dialog and consoleMessage

This commit is contained in:
Julien Le Coupanec 2020-03-19 15:21:37 +01:00
parent c4a179267f
commit c5464a8232

View File

@ -237,54 +237,53 @@ keyboard.sendCharacter(char) // Dispatches a keypress and input event. This do
keyboard.type(text[, options]) // Sends a keydown, keypress/input, and keyup event for each character in the text. keyboard.type(text[, options]) // Sends a keydown, keypress/input, and keyup event for each character in the text.
keyboard.up(key) // Dispatches a keyup event. keyboard.up(key) // Dispatches a keyup event.
// MOUSE // MOUSE
// The Mouse class operates in main-frame CSS pixels relative to the top-left corner of the viewport. // The Mouse class operates in main-frame CSS pixels relative to the top-left corner of the viewport.
// https://pptr.dev/#?product=Puppeteer&version=v2.1.1&show=api-class-mouse // https://pptr.dev/#?product=Puppeteer&version=v2.1.1&show=api-class-mouse
mouse.click(x, y[, options]) // mouse.click(x, y[, options]) // Shortcut for mouse.move, mouse.down and mouse.up.
mouse.down([options]) // mouse.down([options]) // Dispatches a mousedown event.
mouse.move(x, y[, options]) // mouse.move(x, y[, options]) // Dispatches a mousemove event.
mouse.up([options]) // mouse.up([options]) // Dispatches a mouseup event.
// TOUCHSCREEN // TOUCHSCREEN
// https://pptr.dev/#?product=Puppeteer&version=v2.1.1&show=api-class-touchscreen // https://pptr.dev/#?product=Puppeteer&version=v2.1.1&show=api-class-touchscreen
touchscreen.tap(x, y) // touchscreen.tap(x, y) // Dispatches a touchstart and touchend event.
// TRACING // TRACING
// https://pptr.dev/#?product=Puppeteer&version=v2.1.1&show=api-class-tracing // https://pptr.dev/#?product=Puppeteer&version=v2.1.1&show=api-class-tracing
tracing.start([options]) // tracing.start([options]) // Start trace.
tracing.stop() // tracing.stop() // Stop trace.
// FILE CHOOSER // FILE CHOOSER
// FileChooser objects are returned via the 'page.waitForFileChooser' method. // FileChooser objects are returned via the 'page.waitForFileChooser' method.
// File choosers let you react to the page requesting for a file. // File choosers let you react to the page requesting for a file.
// https://pptr.dev/#?product=Puppeteer&version=v2.1.1&show=api-class-filechooser // https://pptr.dev/#?product=Puppeteer&version=v2.1.1&show=api-class-filechooser
fileChooser.accept(filePaths) // fileChooser.accept(filePaths) // Accept the file chooser request with given paths.
fileChooser.cancel() // fileChooser.cancel() // Closes the file chooser without selecting any files.
fileChooser.isMultiple() // fileChooser.isMultiple() // Returns whether file chooser allow for multiple file selection.
// DIALOG // DIALOG
// Dialog objects are dispatched by page via the 'dialog' event. // Dialog objects are dispatched by page via the 'dialog' event.
// https://pptr.dev/#?product=Puppeteer&version=v2.1.1&show=api-class-dialog // https://pptr.dev/#?product=Puppeteer&version=v2.1.1&show=api-class-dialog
dialog.accept([promptText]) // dialog.accept([promptText]) // Resolves when the dialog has been accepted.
dialog.defaultValue() // dialog.defaultValue() // If dialog is prompt, returns default prompt value. Otherwise, returns empty string.
dialog.dismiss() // dialog.dismiss() // Resolves when the dialog has been dismissed.
dialog.message() // dialog.message() // Returns a message displayed in the dialog.
dialog.type() // dialog.type() // Returns dialog's type, can be one of: alert, beforeunload, confirm or prompt.
// CONSOLE MESSAGEç // CONSOLE MESSAGEç
// ConsoleMessage objects are dispatched by page via the 'console' event. // ConsoleMessage objects are dispatched by page via the 'console' event.
// https://pptr.dev/#?product=Puppeteer&version=v2.1.1&show=api-class-consolemessage // https://pptr.dev/#?product=Puppeteer&version=v2.1.1&show=api-class-consolemessage
consoleMessage.args() // consoleMessage.args() // Returns JSHandle.
consoleMessage.location() // consoleMessage.location() // Returns location.
consoleMessage.text() // consoleMessage.text() // Returns message text.
consoleMessage.type() // consoleMessage.type() // Returns message type.
// FRAME // FRAME
// At every point of time, page exposes its current frame tree via the page.mainFrame() and frame.childFrames() methods. // At every point of time, page exposes its current frame tree via the page.mainFrame() and frame.childFrames() methods.