VS Code - Puppeteer Snippets

    This Visual Studio Code extension adds predefined useful code snippets for Puppeteer. Check out the API for more information on available options.



    how to use?


    Install the extension first  .


    In fact, there are two ways to use snippets:


    1. Direct typing


    Start typing the prefix or just part of the fragment. Then find the fragments in the list of sentences and press  TAB or  ENTER.


    2. Command Palette


    Open Command Palette and type  Insert Snippet. Then just select the highlighted snippet.


    Snippet list


    Below is a list of supported snippets.


    Puppeteer

    SnippetContent
    p-importrequire ('puppeteer')
    p-connectpuppeteer.connect
    p-launchpuppeteer.launch

    Browser

    SnippetContent
    p-browser-closebrowser.close
    p-browser-disconnectbrowser.disconnect
    p-browser-newPagebrowser.newPage
    p-browser-on-disconnectedbrowser.on ('disconnected', ...)

    Page

    SnippetContent
    p-page-$page. $
    p-page-$$page. $$
    p-page-$evalpage. $ eval
    p-page-$$evalpage. $$ eval
    p-page-browserpage.browser
    p-page-clickpage.click
    p-page-closepage.close
    p-page-contentpage.content
    p-page-emulatepage.emulate
    p-page-emulateMediapage.emulateMedia
    p-page-focuspage.focus
    p-page-goBackpage.goBack
    p-page-goForwardpage.goForward
    p-page-gotopage.goto
    p-page-hoverpage.hover
    p-page-keyboard-downpage.keyboard.down
    p-page-keyboard-presspage.keyboard.press
    p-page-keyboard-sendCharacterpage.keyboard.sendCharacter
    p-page-keyboard-typepage.keyboard.type
    p-page-keyboard-uppage.keyboard.up
    p-page-mouse-clickpage.mouse.click
    p-page-mouse-downpage.mouse.down
    p-page-mouse-movepage.mouse.move
    p-page-mouse-uppage.mouse.up
    p-page-pdfpage.pdf
    p-page-reloadpage.reload
    p-page-screenshotpage.screenshot
    p-page-titlepage.title
    p-page-urlpage.url
    p-page-waitForpage.waitFor
    p-page-waitForFunctionpage.waitForFunction
    p-page-waitForNavigationpage.waitForNavigation
    p-page-waitForRequestpage.waitForRequest
    p-page-waitForResponsepage.waitForResponse
    p-page-waitForSelectorpage.waitForSelector
    p-page-waitForXPathpage.waitForXPath
    p-page-on-closepage.on ('close', ...)
    p-page-on-consolepage.on ('console', ...)
    p-page-on-dialogpage.on ('dialog', ...)
    p-page-on-domcontentloadedpage.on ('domcontentloaded', ...)
    p-page-on-errorpage.on ('error', ...)
    p-page-on-frameattachedpage.on ('frameattached', ...)
    p-page-on-framedetachedpage.on ('framedetached', ...)
    p-page-on-framenavigatedpage.on ('framenavigated', ...)
    p-page-on-loadpage.on ('load', ...)
    p-page-on-metricspage.on ('metrics', ...)
    p-page-on-pageerrorpage.on ('pageerror', ...)
    p-page-on-popuppage.on ('popup', ...)
    p-page-on-requestpage.on ('request', ...)
    p-page-on-requestfailedpage.on ('requestfailed', ...)
    p-page-on-requestfinishedpage.on ('requestfinished', ...)
    p-page-on-responsepage.on ('response', ...)
    p-page-on-workercreatedpage.on ('workercreated', ...)
    p-page-on-workerdestroyedpage.on ('workerdestroyed', ...)

    General examples

    SnippetContent
    p-examples-basicCreates a basic example of a page

    Promotion


    This is an open source project. Any input would be greatly appreciated!


    Also popular now: