diff --git a/.eslintignore b/.eslintignore index 1700c34b9fd39..58cca2221567e 100644 --- a/.eslintignore +++ b/.eslintignore @@ -44,3 +44,5 @@ yarn-error.log* # ESLint ignores. assets/ third_party/ +sandbox/ +ng-schematics/src/**/files/ diff --git a/.eslintplugin.js b/.eslintplugin.js index 0e61040f45fb6..fccbf6b352491 100644 --- a/.eslintplugin.js +++ b/.eslintplugin.js @@ -1,4 +1,5 @@ -const prettier = require('prettier'); +const prettier = require('@prettier/sync'); +const prettierConfig = require('./.prettierrc.cjs'); const cleanupBlockComment = value => { return value @@ -18,12 +19,13 @@ const cleanupBlockComment = value => { .trim(); }; -const format = (value, offset, prettierOptions) => { +const format = (value, offset) => { return prettier .format(value, { - ...prettierOptions, + ...prettierConfig, + parser: 'markdown', // This is the print width minus 3 (the length of ` * `) and the offset. - printWidth: prettierOptions.printWidth - (offset + 3), + printWidth: 80 - (offset + 3), }) .trim(); }; @@ -57,17 +59,12 @@ const rule = { }, create(context) { - const prettierOptions = { - printWidth: 80, - ...prettier.resolveConfig.sync(context.getPhysicalFilename()), - parser: 'markdown', - }; - for (const comment of context.getSourceCode().getAllComments()) { + for (const comment of context.sourceCode.getAllComments()) { switch (comment.type) { case 'Block': { const offset = comment.loc.start.column; const value = cleanupBlockComment(comment.value); - const formattedValue = format(value, offset, prettierOptions); + const formattedValue = format(value, offset); if (formattedValue !== value) { context.report({ node: comment, diff --git a/.eslintrc.js b/.eslintrc.js index 189ffa4766a68..6a71082474082 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -13,33 +13,33 @@ module.exports = { rules: { // Brackets keep code readable. - curly: [2, 'all'], + curly: ['error', 'all'], // Brackets keep code readable and `return` intentions clear. 'arrow-body-style': ['error', 'always'], // Error if files are not formatted with Prettier correctly. - 'prettier/prettier': 2, + 'prettier/prettier': 'error', // syntax preferences 'spaced-comment': [ - 2, + 'error', 'always', { markers: ['*'], }, ], - eqeqeq: [2], + eqeqeq: ['error'], 'accessor-pairs': [ - 2, + 'error', { getWithoutSet: false, setWithoutGet: false, }, ], - 'new-parens': 2, - 'func-call-spacing': 2, - 'prefer-const': 2, + 'new-parens': 'error', + 'func-call-spacing': 'error', + 'prefer-const': 'error', 'max-len': [ - 2, + 'error', { /* this setting doesn't impact things as we use Prettier to format * our code and hence dictate the line length. @@ -58,27 +58,27 @@ module.exports = { }, ], // anti-patterns - 'no-var': 2, - 'no-with': 2, - 'no-multi-str': 2, - 'no-caller': 2, - 'no-implied-eval': 2, - 'no-labels': 2, - 'no-new-object': 2, - 'no-octal-escape': 2, - 'no-self-compare': 2, - 'no-shadow-restricted-names': 2, - 'no-cond-assign': 2, - 'no-debugger': 2, - 'no-dupe-keys': 2, - 'no-duplicate-case': 2, - 'no-empty-character-class': 2, - 'no-unreachable': 2, - 'no-unsafe-negation': 2, - radix: 2, - 'valid-typeof': 2, + 'no-var': 'error', + 'no-with': 'error', + 'no-multi-str': 'error', + 'no-caller': 'error', + 'no-implied-eval': 'error', + 'no-labels': 'error', + 'no-new-object': 'error', + 'no-octal-escape': 'error', + 'no-self-compare': 'error', + 'no-shadow-restricted-names': 'error', + 'no-cond-assign': 'error', + 'no-debugger': 'error', + 'no-dupe-keys': 'error', + 'no-duplicate-case': 'error', + 'no-empty-character-class': 'error', + 'no-unreachable': 'error', + 'no-unsafe-negation': 'error', + radix: 'error', + 'valid-typeof': 'error', 'no-unused-vars': [ - 2, + 'error', { args: 'none', vars: 'local', @@ -86,11 +86,11 @@ module.exports = { '([fx]?describe|[fx]?it|beforeAll|beforeEach|afterAll|afterEach)', }, ], - 'no-implicit-globals': [2], + 'no-implicit-globals': ['error'], // es2015 features - 'require-yield': 2, - 'template-curly-spacing': [2, 'never'], + 'require-yield': 'error', + 'template-curly-spacing': ['error', 'never'], // ensure we don't have any it.only or describe.only in prod 'mocha/no-exclusive-tests': 'error', @@ -98,7 +98,7 @@ module.exports = { 'no-restricted-imports': [ 'error', { - patterns: ['*Events'], + patterns: ['*Events', '*.test.js'], paths: [ { name: 'mitt', @@ -127,40 +127,45 @@ module.exports = { overrides: [ { files: ['*.ts'], + parserOptions: { + allowAutomaticSingleRunInference: true, + project: './tsconfig.base.json', + }, extends: [ 'plugin:@typescript-eslint/eslint-recommended', 'plugin:@typescript-eslint/recommended', + 'plugin:@typescript-eslint/stylistic', ], plugins: ['eslint-plugin-tsdoc', 'local'], rules: { // Keeps comments formatted. - 'local/prettier-comments': 2, + 'local/prettier-comments': 'error', // Brackets keep code readable. - curly: [2, 'all'], + curly: ['error', 'all'], // Brackets keep code readable and `return` intentions clear. 'arrow-body-style': ['error', 'always'], // Error if comments do not adhere to `tsdoc`. - 'tsdoc/syntax': 2, + 'tsdoc/syntax': 'error', // Keeps array types simple only when they are simple for readability. '@typescript-eslint/array-type': ['error', {default: 'array-simple'}], - 'no-unused-vars': 0, + 'no-unused-vars': 'off', '@typescript-eslint/no-unused-vars': [ 'error', {argsIgnorePattern: '^_'}, ], - 'func-call-spacing': 0, - '@typescript-eslint/func-call-spacing': 2, - semi: 0, - '@typescript-eslint/semi': 2, - '@typescript-eslint/no-empty-function': 0, - '@typescript-eslint/no-use-before-define': 0, + 'func-call-spacing': 'off', + '@typescript-eslint/func-call-spacing': 'error', + semi: 'off', + '@typescript-eslint/semi': 'error', + '@typescript-eslint/no-empty-function': 'off', + '@typescript-eslint/no-use-before-define': 'off', // We have to use any on some types so the warning isn't valuable. - '@typescript-eslint/no-explicit-any': 0, + '@typescript-eslint/no-explicit-any': 'off', // We don't require explicit return types on basic functions or // dummy functions in tests, for example - '@typescript-eslint/explicit-function-return-type': 0, + '@typescript-eslint/explicit-function-return-type': 'off', // We allow non-null assertions if the value was asserted using `assert` API. - '@typescript-eslint/no-non-null-assertion': 0, + '@typescript-eslint/no-non-null-assertion': 'off', /** * This is the default options (as per * https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/docs/rules/ban-types.md), @@ -182,7 +187,7 @@ module.exports = { }, ], // By default this is a warning but we want it to error. - '@typescript-eslint/explicit-module-boundary-types': 2, + '@typescript-eslint/explicit-module-boundary-types': 'error', 'no-restricted-syntax': [ 'error', { @@ -190,7 +195,24 @@ module.exports = { selector: "CallExpression[callee.name='require']", message: '`require` statements are not allowed. Use `import`.', }, + { + // We need this as NodeJS will run until all the timers have resolved + message: 'Use method `Deferred.race()` instead.', + selector: + 'MemberExpression[object.name="Promise"][property.name="race"]', + }, + { + message: + 'Deferred `valueOrThrow` should not be called in `Deferred.race()` pass deferred directly', + selector: + 'CallExpression[callee.object.name="Deferred"][callee.property.name="race"] > ArrayExpression > CallExpression[callee.property.name="valueOrThrow"]', + }, + ], + '@typescript-eslint/no-floating-promises': [ + 'error', + {ignoreVoid: true, ignoreIIFE: true}, ], + '@typescript-eslint/prefer-ts-expect-error': 'error', }, }, ], diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml index ef34b4516536a..b12bdda4170cf 100644 --- a/.github/ISSUE_TEMPLATE/bug.yml +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -11,35 +11,19 @@ body: **Before filling out this report**, please check our [Troubleshooting](https://pptr.dev/troubleshooting) guide for solutions to common issues. - - id: summary - type: textarea - attributes: - label: Bug expectation - description: What do you expect to happen? What actually happened instead? - placeholder: | - I expected ... - - What happened instead was ... - validations: - required: true - - id: behavior - type: checkboxes - attributes: - label: Bug behavior - description: > - How does the bug behave? Does it happen very rarely (flaky)? If there is - a PDF problem, make sure the script writes the PDF somewhere in the - current working directory. *Note: PDF implies no error.* - options: - - label: Flaky - - label: PDF - id: mvce type: textarea attributes: label: Minimal, reproducible example description: > Provide a [minimal, reproducible - example](https://stackoverflow.com/help/minimal-reproducible-example). + example](https://stackoverflow.com/help/minimal-reproducible-example) of + the bug you are facing. + + This must not include external libraries since we will run this in a + [hermetic](https://www.oreilly.com/library/view/selenium-design-patterns/9781783982707/ch03s03.html#:~:text=The%20Hermetic%20test%20pattern%20is,be%20avoided%20at%20all%20costs.) + environment. You may use Node.js modules. + *No need for backticks — this automatically gets formatted into code.* render: TypeScript placeholder: | @@ -48,8 +32,11 @@ body: (async () => { const browser = await puppeteer.launch(); const page = await browser.newPage(); - await page.goto('https://news.google.com/news/'); - await page.screenshot({path: 'news.png', fullPage: true}); + try { + // Do something. + } catch { + throw new Error('Something went wrong'); + } await browser.close(); })(); validations: @@ -60,36 +47,77 @@ body: label: Error string description: > Provide the bug's error. For example, `throw new Error('Something went - wrong')` would have the error `Something went wrong`. **If the script - does not throw**, write `no error` (case insensitive). + wrong')` would have the error `Something went wrong`. + + **If the script does not throw**, write `no error` (case insensitive). placeholder: Something went wrong validations: required: true + - id: behavior + type: checkboxes + attributes: + label: Bug behavior + description: > + How does the bug behave? Does it happen very rarely (flaky)? If there is + a PDF problem, make sure the script writes the PDF somewhere in the + current working directory. + options: + - label: Flaky + - label: PDF + - id: background + type: textarea + attributes: + label: Background + description: > + Optional. Briefly describe your use-case that led to this issue. This can help us + understand the general situation to provide better, higher quality + feedback and help others in similar situations. + placeholder: | + I've been trying to ... + - id: expectation + type: textarea + attributes: + label: Expectation + description: What are you expecting the code to do? + placeholder: | + I expected ... + validations: + required: true + - id: reality + type: textarea + attributes: + label: Reality + description: What actually happens? + placeholder: | + In reality, ... + validations: + required: true - id: puppeteer-configuration type: textarea attributes: - label: Puppeteer configuration + label: Puppeteer configuration file (if used) description: > Copy and paste your [configuration - file](https://pptr.dev/guides/configuration/) (if applicable). *No need - for backticks — this automatically gets formatted into code.* + file](https://pptr.dev/guides/configuration/) (if used). + + *No need for backticks — this automatically gets formatted into code.* render: TypeScript - id: puppeteer-version type: input attributes: label: Puppeteer version - description: | + description: > What version of Puppeteer are you running? *This must be a valid semver - tag.* + tag, for example, `20.8.1`.* validations: required: true - id: node-version type: input attributes: label: Node version - description: | + description: > What supported version of Node.js are you running? *This must be a valid - semver tag.* + semver tag, for example, `20.3.1`.* validations: required: true - id: pkg-mgr @@ -107,9 +135,9 @@ body: type: input attributes: label: Package manager version - description: | + description: > What version of the package manager are you running? *This must be a - valid semver tag.* + valid semver tag, for example, `9.6.7`.* validations: required: true - id: operating-system diff --git a/.github/ISSUE_TEMPLATE/issue-browsers.yml b/.github/ISSUE_TEMPLATE/issue-browsers.yml new file mode 100644 index 0000000000000..672ad67ec18d8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/issue-browsers.yml @@ -0,0 +1,26 @@ +name: Bug for @puppeteer/browsers +description: File a bug report specifically about the `@puppeteer/browsers` package. +title: '[Bug]: ' +labels: [bug, '@puppeteer/browsers'] +body: + - type: textarea + id: summary + attributes: + label: Steps to reproduce + description: Please describe steps to reproduce the issue. + validations: + required: true + - type: textarea + id: expected + attributes: + label: Expected results + description: What is the behaviour you expect. + validations: + required: true + - type: textarea + id: actual + attributes: + label: Actual results + description: What is the observed behaviour. + validations: + required: true diff --git a/.github/dependabot.yml b/.github/dependabot.yml index c165139107a0f..7fc6d91b7d6dc 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -4,10 +4,17 @@ updates: directory: '/' schedule: interval: daily - time: '00:00' + time: '08:00' timezone: 'Europe/Berlin' open-pull-requests-limit: 2 allow: - dependency-type: 'production' ignore: - dependency-name: 'devtools-protocol' + - package-ecosystem: 'github-actions' # Necessary to update action hash + directory: '/' + schedule: + interval: weekly + time: '08:00' + timezone: 'Europe/Berlin' + open-pull-requests-limit: 2 diff --git a/.github/workflows/changed-packages.yml b/.github/workflows/changed-packages.yml index 7e91262c32e17..d4274b30a12a1 100644 --- a/.github/workflows/changed-packages.yml +++ b/.github/workflows/changed-packages.yml @@ -4,6 +4,10 @@ permissions: read-all on: workflow_call: + inputs: + check-mergeable-state: + default: false + type: boolean outputs: changes: description: 'The packages that were changed for this PR' @@ -16,26 +20,34 @@ jobs: changes: ${{ steps.changes.outputs.changes }} steps: - name: Check out repository - uses: actions/checkout@v3.3.0 + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 with: fetch-depth: 2 + - name: Check if branch is out of date + if: ${{ inputs.check-mergeable-state && github.base_ref == 'main' }} + run: | + git fetch origin main --depth 1 && + git merge-base --is-ancestor origin/main @; - name: Detect changed packages - uses: dorny/paths-filter@v2.11.1 + uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1 id: changes with: filters: | puppeteer: - '.github/workflows/ci.yml' + - 'packages/browsers/src/browser-data/firefox.ts' - 'packages/puppeteer/**' - 'packages/puppeteer-core/**' - 'docker/**' - 'test/**' - 'test-d/**' - 'tools/mochaRunner/**' + - '.mocharc.cjs' website: - '.github/workflows/ci.yml' - 'docs/**' - 'website/**' + - 'README.md' ng-schematics: - '.github/workflows/ci.yml' - 'packages/ng-schematics/**' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index af0469c883841..f42bcc096469f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ on: - '**' concurrency: - group: ${{ github.head_ref || github.run_id }} + group: ci-${{ github.head_ref || github.run_id }} cancel-in-progress: true jobs: @@ -21,11 +21,11 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out repository - uses: actions/checkout@v3.3.0 + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 with: fetch-depth: 2 - name: Set up Node.js - uses: actions/setup-node@v3.5.1 + uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0 with: cache: npm node-version: lts/* @@ -33,13 +33,14 @@ jobs: run: npm ci env: PUPPETEER_SKIP_DOWNLOAD: true + # Set up GitHub Actions caching for Wireit. + - uses: google/wireit@f3a3c79c553122e2fe5829eeac7d815326502903 # setup-github-actions-caching/v1 - name: Check code run: npm run check - name: Lint code run: npm run lint - - name: Lint commits - run: npm run commitlint - if: github.event_name != 'pull_request' + - name: Validate licenses + run: npm run validate-licenses - name: Build every package run: npm run build - name: Generate documents @@ -59,6 +60,8 @@ jobs: check-changes: needs: inspect-code uses: ./.github/workflows/changed-packages.yml + with: + check-mergeable-state: true deploy-docs: needs: check-changes @@ -69,9 +72,9 @@ jobs: contents: write steps: - name: Check out repository - uses: actions/checkout@v3.3.0 + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - name: Set up Node.js - uses: actions/setup-node@v3.5.1 + uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0 with: cache: npm node-version: lts/* @@ -84,12 +87,21 @@ jobs: NODE_OPTIONS: --max-old-space-size=6144 run: npm run build - name: Deploy to GitHub Pages - uses: peaceiris/actions-gh-pages@v3 + uses: peaceiris/actions-gh-pages@373f7f263a76c20808c831209c920827a82a2847 # v3.9.3 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./website/build user_name: release-please[bot] user_email: 55107282+release-please[bot]@users.noreply.github.com + - name: Test Algolia if Crawler is blocked + env: + CRAWLER_USER_ID: ${{secrets.ALGOLIA_CRAWLER_USER_ID}} + CRAWLER_API_KEY: ${{secrets.ALGOLIA_CRAWLER_API_KEY}} + CRAWLER_ID: ${{secrets.ALGOLIA_CRAWLER_ID}} + run: | + RESPONSE=$(curl -H "Content-Type: application/json" -X GET --user "$CRAWLER_USER_ID:$CRAWLER_API_KEY" \ + "https://crawler.algolia.com/api/1/crawlers/$CRAWLER_ID" | grep "\"blocked\":true" || true ); \ + if [ ! -z "$RESPONSE" ]; then echo "Please go to https://crawler.algolia.com/" && exit 1; fi - name: Trigger Algolia reindexing env: CRAWLER_USER_ID: ${{secrets.ALGOLIA_CRAWLER_USER_ID}} @@ -119,11 +131,13 @@ jobs: exclude: - os: windows-latest suite: chrome-bidi + - os: macos-latest + suite: chrome-headful steps: - name: Check out repository - uses: actions/checkout@v3.3.0 + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - name: Set up Node.js - uses: actions/setup-node@v3.5.1 + uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0 with: cache: npm node-version: lts/* @@ -133,24 +147,45 @@ jobs: PUPPETEER_SKIP_DOWNLOAD: true - name: Build packages run: npm run build --workspace @puppeteer-test/test - - name: Setup cache for Chromium binary - uses: actions/cache@v3 + - name: Setup cache for Chrome binary + if: ${{ matrix.suite != 'chrome-bidi' }} + uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 with: path: ~/.cache/puppeteer/chrome - key: ${{ runner.os }}-chromium-${{ hashFiles('packages/puppeteer-core/src/revisions.ts') }} - - name: Install Chromium + key: ${{ runner.os }}-Chrome-${{ hashFiles('packages/puppeteer-core/src/revisions.ts') }}-${{ hashFiles('packages/puppeteer/src/node/install.ts') }} + - name: Install Chrome + if: ${{ matrix.suite != 'chrome-bidi' }} run: npm run postinstall + - name: Setup cache for Chrome Canary binary + if: ${{ matrix.suite == 'chrome-bidi' }} + uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 + with: + path: ~/.cache/puppeteer/chrome-canary + key: ${{ runner.os }}-Chrome-Canary-${{ hashFiles('package.json') }} + - name: Install Chrome Canary + if: ${{ matrix.suite == 'chrome-bidi' }} + id: browser + run: node tools/download_chrome_bidi.mjs ~/.cache/puppeteer/chrome-canary - name: Tests types run: npm run test-types - name: Run all tests (for non-Linux) if: ${{ matrix.os != 'ubuntu-latest' }} - run: npm run test -- --test-suite ${{ matrix.suite }} + run: npm run test -- --test-suite ${{ matrix.suite }} --save-stats-to /tmp/artifacts/${{ github.event_name }}_INSERTID.json + env: + PUPPETEER_EXECUTABLE_PATH: ${{ steps.browser.outputs.executablePath }} - name: Install linux dependencies. if: ${{ matrix.os == 'ubuntu-latest' }} run: sudo apt-get install xvfb - name: Run all tests (for Linux) if: ${{ matrix.os == 'ubuntu-latest' }} - run: xvfb-run --auto-servernum npm run test -- --test-suite ${{ matrix.suite }} + run: xvfb-run --auto-servernum npm run test -- --test-suite ${{ matrix.suite }} --save-stats-to /tmp/artifacts/${{ github.event_name }}_INSERTID.json + env: + PUPPETEER_EXECUTABLE_PATH: ${{ steps.browser.outputs.executablePath }} + - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 + if: always() + with: + name: test-results + path: /tmp/artifacts/*.json chrome-tests-required: name: '[Required] Chrome tests' @@ -177,11 +212,20 @@ jobs: - firefox-bidi - firefox-headful - firefox-headless + exclude: + - os: macos-latest + suite: firefox-headful + - os: macos-latest + suite: firefox-headless + # Disabled due to https://bugzilla.mozilla.org/show_bug.cgi?id=1843550 + # The first time the browsers launches it crashes. + - os: macos-latest + suite: firefox-bidi steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - name: Set up Node.js - uses: actions/setup-node@v3.5.1 + uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0 with: cache: npm node-version: lts/* @@ -192,10 +236,10 @@ jobs: - name: Build packages run: npm run build --workspace @puppeteer-test/test - name: Setup cache for Firefox binary - uses: actions/cache@v3 + uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 with: path: ~/.cache/puppeteer/firefox - key: ${{ runner.os }}-firefox-${{ hashFiles('packages/puppeteer-core/src/revisions.ts') }} + key: ${{ runner.os }}-firefox-${{ hashFiles('packages/puppeteer-core/src/revisions.ts') }}-${{ hashFiles('packages/puppeteer/src/node/install.ts') }} - name: Install Firefox env: PUPPETEER_PRODUCT: firefox @@ -204,13 +248,18 @@ jobs: run: npm run test-types - name: Run all tests (for non-Linux) if: ${{ matrix.os != 'ubuntu-latest' }} - run: npm run test -- --test-suite ${{ matrix.suite }} + run: npm run test -- --test-suite ${{ matrix.suite }} --save-stats-to /tmp/artifacts/${{ github.event_name }}_INSERTID.json - name: Install linux dependencies. if: ${{ matrix.os == 'ubuntu-latest' }} run: sudo apt-get install xvfb - name: Run all tests (for Linux) if: ${{ matrix.os == 'ubuntu-latest' }} - run: xvfb-run --auto-servernum npm run test -- --test-suite ${{ matrix.suite }} + run: xvfb-run --auto-servernum npm run test -- --test-suite ${{ matrix.suite }} --save-stats-to /tmp/artifacts/${{ github.event_name }}_INSERTID.json + - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 + if: always() + with: + name: test-results + path: /tmp/artifacts/*.json firefox-tests-required: name: '[Required] Firefox tests' @@ -229,9 +278,9 @@ jobs: if: ${{ !startsWith(github.ref_name, 'release-please') && contains(fromJSON(needs.check-changes.outputs.changes), 'puppeteer') }} steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - name: Set up Node.js - uses: actions/setup-node@v3.5.1 + uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0 with: cache: npm node-version: lts/* @@ -244,7 +293,7 @@ jobs: - name: Pack installation test run: npm pack --workspace @puppeteer-test/installation - name: Upload installation test - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 with: name: installation-test path: puppeteer-test-installation-latest.tgz @@ -262,28 +311,21 @@ jobs: - macos-latest - windows-latest node: - - 14 - - 16 - 18 pkg_manager: - npm steps: - name: Download installation test - uses: actions/download-artifact@v3 + uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 with: name: installation-test - name: Unpack installation test run: tar -xf puppeteer-test-installation-latest.tgz --strip-components 1 -C . - name: Set up Node.js - uses: actions/setup-node@v3.5.1 + uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0 with: node-version: ${{ matrix.node }} - name: Set up ${{ matrix.pkg_manager }} - id: workaround - if: ${{ matrix.node == '14' && matrix.os == 'windows-latest' && matrix.pkg_manager == 'npm' }} - run: npm install -g ${{ matrix.pkg_manager }}@8.3 - - name: Set up ${{ matrix.pkg_manager }} - if: ${{ steps.workaround.outcome == 'skipped' }} run: npm install -g ${{ matrix.pkg_manager }}@latest - name: Install dependencies run: ${{ matrix.pkg_manager }} install @@ -309,11 +351,11 @@ jobs: if: ${{ contains(fromJSON(needs.check-changes.outputs.changes), 'puppeteer') }} steps: - name: Check out repository - uses: actions/checkout@v3.3.0 + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 with: fetch-depth: 2 - name: Set up Node.js - uses: actions/setup-node@v3.5.1 + uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0 with: cache: npm node-version: lts/* @@ -334,6 +376,27 @@ jobs: run: | docker run -i --init --cap-add=SYS_ADMIN --rm puppeteer-test-image node -e "`cat test/smoke-test.js`" + unit-tests: + name: '[Required] Unit tests' + runs-on: ubuntu-latest + needs: check-changes + if: ${{ contains(fromJSON(needs.check-changes.outputs.changes), 'puppeteer') }} + steps: + - name: Check out repository + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + - name: Set up Node.js + uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0 + with: + cache: npm + node-version: lts/* + - name: Install dependencies + run: npm ci + env: + PUPPETEER_SKIP_DOWNLOAD: true + - name: Run unit tests + run: | + npm run unit --w puppeteer-core -w puppeteer --if-present + ng-schematics-tests: name: '[Required] Test Angular Schematics' runs-on: ubuntu-latest @@ -341,9 +404,9 @@ jobs: if: ${{ contains(fromJSON(needs.check-changes.outputs.changes), 'ng-schematics') }} steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - name: Set up Node.js - uses: actions/setup-node@v3.5.1 + uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0 with: cache: npm node-version: lts/* @@ -368,9 +431,9 @@ jobs: - macos-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - name: Set up Node.js - uses: actions/setup-node@v3.5.1 + uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0 with: cache: npm node-version: lts/* diff --git a/.github/workflows/devtools.yml b/.github/workflows/devtools.yml new file mode 100644 index 0000000000000..69b2c351f93c0 --- /dev/null +++ b/.github/workflows/devtools.yml @@ -0,0 +1,82 @@ +name: DevTools CI + +# Declare default permissions as read only. +permissions: read-all + +on: + pull_request: + types: [labeled] + +concurrency: + group: devtools-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + build-puppeteer: + name: Build Puppeteer + runs-on: ubuntu-latest + if: contains(github.event.label.name, 'devtools') + steps: + - name: Checkout + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + - name: Set up Node.js + uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0 + with: + cache: npm + node-version: lts/* + - name: Install dependencies + run: npm ci + env: + PUPPETEER_SKIP_DOWNLOAD: true + - name: Build Puppeteer + run: | + npm run build --workspace @puppeteer/browsers + npm run build --workspace puppeteer-core + npm run build --workspace puppeteer + - name: Pack Puppeteer + run: | + npm pack --workspace @puppeteer/browsers + npm pack --workspace puppeteer-core + npm pack --workspace puppeteer + - name: Upload Puppeteer build + uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 + with: + name: puppeteer-build + if-no-files-found: error + path: puppeteer-*.tgz + + devtools-tests: + name: DevTools tests + needs: build-puppeteer + runs-on: ubuntu-latest + steps: + - name: Download Puppeteer build + uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 + with: + name: puppeteer-build + - name: Set up Node.js + uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0 + with: + node-version: lts/* + - name: Checkout depot_tools + run: git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git + - name: Add depot_tools to path + run: echo $(realpath depot_tools) >> $GITHUB_PATH + - name: Fetch devtools-frontend + run: fetch devtools-frontend + - name: Sync gclient + working-directory: devtools-frontend + run: gclient sync + - name: Install Puppeteer + working-directory: devtools-frontend + run: | + puppeteer_pkgs=(../puppeteer-*.tgz) + tar -xf ${puppeteer_pkgs[0]} --strip-components 1 -C node_modules/puppeteer + tar -xf ${puppeteer_pkgs[1]} --strip-components 1 -C node_modules/@puppeteer/browsers + tar -xf ${puppeteer_pkgs[2]} --strip-components 1 -C node_modules/puppeteer-core + - name: Generate targets + working-directory: devtools-frontend + run: gn gen out/Default --args='devtools_skip_typecheck=true' + - name: Run tests + working-directory: devtools-frontend + run: npm run auto-e2etest diff --git a/.github/workflows/issue-analyzer.yml b/.github/workflows/issue-analyzer.yml index 171c040887cd3..76c248fb4d771 100644 --- a/.github/workflows/issue-analyzer.yml +++ b/.github/workflows/issue-analyzer.yml @@ -7,14 +7,14 @@ on: types: [opened, reopened, edited] concurrency: - group: ${{ format('issue-{0}', github.event.issue.number) }} + group: issue-${{ format('issue-{0}', github.event.issue.number) }} cancel-in-progress: true jobs: analyze-issue: name: Analyze Issues runs-on: ubuntu-latest - if: ${{ contains(github.event.issue.labels.*.name, 'bug') && !contains(github.event.issue.labels.*.name, 'disable-analyzer') && !contains(github.event.issue.labels.*.name, 'confirmed') && github.event.issue.number > 9481 }} + if: ${{ contains(github.event.issue.labels.*.name, 'bug') && !contains(github.event.issue.labels.*.name, 'disable-analyzer') && !contains(github.event.issue.labels.*.name, 'confirmed') && !contains(github.event.issue.labels.*.name, '@puppeteer/browsers') && github.event.issue.number > 9481 }} env: ISSUE_BODY: ${{ toJson(github.event.issue.body) }} outputs: @@ -26,7 +26,7 @@ jobs: issues: write steps: - name: Remove labels - uses: actions/github-script@v6 + uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 with: script: | if (${{ contains(github.event.issue.labels.*.name, 'not-reproducible') }}) { @@ -54,17 +54,17 @@ jobs: }) } - name: Check out repository - uses: actions/checkout@v3.0.2 + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - name: Set up Node.js - uses: actions/setup-node@v3.5.1 + uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0 with: node-version: lts/* - name: Install dependencies - run: npm install + run: npm ci - name: Analyze issue id: issue-analysis run: echo $ISSUE_BODY | ./tools/analyze_issue.mjs >> $GITHUB_OUTPUT - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 with: name: issue-files path: out/ @@ -79,12 +79,12 @@ jobs: PACKAGE_MANAGER: ${{ needs.analyze-issue.outputs.packageManager }} NODE_VERSION: ${{ needs.analyze-issue.outputs.nodeVersion }} steps: - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 with: name: issue-files path: '.' - name: Set up Node.js - uses: actions/setup-node@v3.5.1 + uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0 with: node-version: ${{ env.NODE_VERSION }} - name: Enable corepack @@ -100,7 +100,9 @@ jobs: - name: Verify issue timeout-minutes: 10 run: ${{ env.PACKAGE_MANAGER }} run verify - - uses: actions/upload-artifact@v3 + env: + DEBUG: 'puppeteer:*' + - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 if: success() || failure() with: name: runtime-output @@ -118,7 +120,7 @@ jobs: issues: write steps: - name: Add labels - uses: actions/github-script@v6 + uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 with: script: | github.rest.issues.addLabels({ @@ -128,13 +130,13 @@ jobs: labels: ["confirmed"] }) - name: Find Comment Id - uses: peter-evans/find-comment@v2 + uses: peter-evans/find-comment@a54c31d7fa095754bfef525c0c8e5e5674c4b4b1 # v2.4.0 id: find-comment-id with: issue-number: ${{ github.event.issue.number }} comment-author: 'github-actions[bot]' - name: Upsert comment - uses: peter-evans/create-or-update-comment@v2 + uses: peter-evans/create-or-update-comment@c6c9a1a66007646a28c153e2a8580a5bad27bcfa # v3.0.2 with: comment-id: ${{ steps.find-comment-id.outputs.comment-id }} issue-number: ${{ github.event.issue.number }} @@ -155,7 +157,7 @@ jobs: issues: write steps: - name: Add labels - uses: actions/github-script@v6 + uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 with: script: | github.rest.issues.addLabels({ @@ -165,13 +167,13 @@ jobs: labels: ["invalid"] }) - name: Find Comment Id - uses: peter-evans/find-comment@v2 + uses: peter-evans/find-comment@a54c31d7fa095754bfef525c0c8e5e5674c4b4b1 # v2.4.0 id: find-comment-id with: issue-number: ${{ github.event.issue.number }} comment-author: 'github-actions[bot]' - name: Upsert comment - uses: peter-evans/create-or-update-comment@v2 + uses: peter-evans/create-or-update-comment@c6c9a1a66007646a28c153e2a8580a5bad27bcfa # v3.0.2 with: comment-id: ${{ steps.find-comment-id.outputs.comment-id }} issue-number: ${{ github.event.issue.number }} @@ -191,7 +193,7 @@ jobs: issues: write steps: - name: Add labels - uses: actions/github-script@v6 + uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 with: script: | github.rest.issues.addLabels({ @@ -201,13 +203,13 @@ jobs: labels: ["not-reproducible", "needs-feedback"] }) - name: Find Comment Id - uses: peter-evans/find-comment@v2 + uses: peter-evans/find-comment@a54c31d7fa095754bfef525c0c8e5e5674c4b4b1 # v2.4.0 id: find-comment-id with: issue-number: ${{ github.event.issue.number }} comment-author: 'github-actions[bot]' - name: Upsert comment - uses: peter-evans/create-or-update-comment@v2 + uses: peter-evans/create-or-update-comment@c6c9a1a66007646a28c153e2a8580a5bad27bcfa # v3.0.2 with: comment-id: ${{ steps.find-comment-id.outputs.comment-id }} issue-number: ${{ github.event.issue.number }} diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index 88a4a1799085c..f63f055a5e2a2 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -21,11 +21,11 @@ jobs: contents: write steps: - name: Check out repository - uses: actions/checkout@v3.3.0 + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 with: ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} - name: Install dependencies - run: npm install + run: npm ci - name: Build env: PUBLISH: 1 @@ -34,7 +34,7 @@ jobs: - name: Version docs working-directory: ./website run: | - npm install + npm ci npm run docusaurus docs:version $(jq -r .version ../packages/puppeteer/package.json) npm run archive - name: Re-build docs after versioning @@ -44,6 +44,7 @@ jobs: npm run docs - name: Format run: npm run format + # Release-please does not update the package-lock - name: Install to refresh package-lock run: npm install - name: Commit diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index cd30f498e2889..734982f9b9e55 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -16,7 +16,7 @@ jobs: contents: read steps: - name: Check out repository - uses: actions/checkout@v3.0.2 + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - name: Install dependencies run: npm ci env: @@ -51,7 +51,7 @@ jobs: IMAGE_NAME: ${{ github.repository }} steps: - name: Check out repository - uses: actions/checkout@v3.0.2 + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - name: Install dependencies run: npm ci env: @@ -62,21 +62,21 @@ jobs: run: docker/pack.sh # Based on https://docs.github.com/en/actions/publishing-packages/publishing-docker-images. - name: Log in to the Container registry - uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a + uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@57396166ad8aefe6098280995947635806a0e6ea + uses: docker/metadata-action@818d4b7b91585d195f67373fd9cb0332e31a7175 # v4.6.0 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: | latest type=match,pattern=puppeteer-v(\d+\.\d+\.\d+),group=1 - name: Build and push the Docker image - uses: docker/build-push-action@c84f38281176d4c9cdb1626ffafcd6b3911b5d94 + uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 # v4.1.1 with: context: ./docker push: true diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml index 9976a85b80467..a10449b40c8fa 100644 --- a/.github/workflows/scorecards-analysis.yml +++ b/.github/workflows/scorecards-analysis.yml @@ -25,12 +25,12 @@ jobs: steps: - name: Check out repository - uses: actions/checkout@v3.0.2 + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 with: persist-credentials: false - name: 'Run analysis' - uses: ossf/scorecard-action@99c53751e09b9529366343771cc321ec74e9bd3d # v1.0.2 + uses: ossf/scorecard-action@08b4669551908b1024bb425080c797723083c031 # v2.2.0 with: results_file: results.sarif results_format: sarif @@ -41,7 +41,7 @@ jobs: # Upload the results as artifacts (optional). - name: 'Upload artifact' - uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v2.3.1 + uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 with: name: SARIF file path: results.sarif @@ -49,6 +49,6 @@ jobs: # Upload the results to GitHub’s code scanning dashboard. - name: 'Upload to code-scanning' - uses: github/codeql-action/upload-sarif@6a38b7d4a1af70deb1b561eb77db2b5e5a6a1e69 # v1.0.26 + uses: github/codeql-action/upload-sarif@1813ca74c3faaa3a2da2070b9b8a0b3e7373a0d8 # v2.21.0 with: sarif_file: results.sarif diff --git a/.github/workflows/tot-ci.yml b/.github/workflows/tot-ci.yml deleted file mode 100644 index 5eb8b2ff0433e..0000000000000 --- a/.github/workflows/tot-ci.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: ToT CI - -# Checks Puppeteer against the latest ToT build of Chromium. -# Declare default permissions as read only. -permissions: read-all - -on: - workflow_dispatch: - schedule: - # * is a special character in YAML so you have to quote this string - # Supposed to be every day at 8 am (UTC). - - cron: '0 8 * * *' - -# TODO: how to make install & build steps re-usable across jobs. -# Currently, the install step is duplicated but should be the same for all jobs. - -jobs: - ci: - name: ${{ matrix.suite }} tests - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - suite: - - chrome-headless - - chrome-headful - - chrome-new-headless - steps: - - name: Check out repository - uses: actions/checkout@v3.0.2 - - name: Set up Node.js - uses: actions/setup-node@v3.5.1 - with: - cache: npm - node-version: lts/* - - name: Install dependencies - run: npm ci - env: - PUPPETEER_SKIP_DOWNLOAD: true - - name: Install linux dependencies. - run: sudo apt-get install xvfb - - name: Build packages - run: npm run build - - name: Get latest revision - run: | - REV=$(node tools/check_availability.js -p linux) - cat packages/puppeteer-core/src/revisions.ts | sed "s/[0-9]\{6,\}/$REV/" > packages/puppeteer-core/src/revisions.ts.replaced - mv packages/puppeteer-core/src/revisions.ts.replaced packages/puppeteer-core/src/revisions.ts - - name: Rebuild `puppeteer-core` - run: npm run build --workspace puppeteer-core - - name: Install Chrome - run: npm run postinstall --workspace puppeteer - - name: Run tests - run: xvfb-run --auto-servernum npm run test -- --test-suite ${{ matrix.suite }} diff --git a/.github/workflows/update-browser-pins.yml b/.github/workflows/update-browser-pins.yml new file mode 100644 index 0000000000000..a8e434fafdf48 --- /dev/null +++ b/.github/workflows/update-browser-pins.yml @@ -0,0 +1,45 @@ +# This workflow will update the pinned browsers + +name: 'Update the pinned browsers' + +permissions: read-all + +on: + schedule: + # Run everyday at: https://crontab.guru/#0_6_*_*_*. + - cron: '0 6 * * *' + workflow_dispatch: + +jobs: + update: + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + - name: Set up Node.js + uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0 + with: + cache: npm + node-version: lts/* + - uses: google/wireit@f3a3c79c553122e2fe5829eeac7d815326502903 # setup-github-actions-caching/v1 + - name: Install npm dependencies + run: npm ci + - name: Build Puppeteer + run: npm run build -w puppeteer + - name: Update Chrome to latest stable version + id: update + run: | + node --experimental-fetch tools/update_chrome_revision.mjs + - name: Create Pull Request + if: ${{ steps.update.outputs.commit }} + uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # v5.0.2 + with: + token: ${{ secrets.BROWSER_AUTOMATION_BOT_TOKEN }} + branch: browser-automation-bot/update-browser-version + delete-branch: true + committer: Browser Automation Bot + author: Browser Automation Bot + commit-message: ${{ steps.update.outputs.commit }} + title: ${{ steps.update.outputs.commit }} + body: 'Automatically generated by https://github.com/puppeteer/puppeteer/blob/main/.github/workflows/update-browser-pins.yml' + labels: dependencies diff --git a/.husky/pre-commit b/.husky/pre-commit deleted file mode 100755 index b5a5eb074585d..0000000000000 --- a/.husky/pre-commit +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env sh -. "$(dirname -- "$0")/_/husky.sh" - -npx commitlint --edit "$1" diff --git a/.mocharc.cjs b/.mocharc.cjs index d1cd74f4eff55..8414501ced27e 100644 --- a/.mocharc.cjs +++ b/.mocharc.cjs @@ -14,14 +14,18 @@ * limitations under the License. */ +let timeout = process.platform === 'win32' ? 20_000 : 10_000; +if (!!process.env.DEBUGGER_ATTACHED) { + timeout = 0; +} module.exports = { reporter: 'dot', logLevel: 'debug', require: ['./test/build/mocha-utils.js', 'source-map-support/register'], spec: 'test/build/**/*.spec.js', exit: !!process.env.CI, - retries: process.env.CI ? 2 : 0, + retries: process.env.CI ? 3 : 0, parallel: !!process.env.PARALLEL, - timeout: 25_000, + timeout: timeout, reporter: process.env.CI ? 'spec' : 'dot', }; diff --git a/.prettierignore b/.prettierignore index 8e32b9405673d..8196eff68dc70 100644 --- a/.prettierignore +++ b/.prettierignore @@ -46,4 +46,9 @@ CHANGELOG.md package-lock.json test/assets/ docs/api +docs/browsers-api versioned_*/ + +# Ng-schematics +/packages/ng-schematics/files/ +/packages/ng-schematics/sandbox/ \ No newline at end of file diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 61d5ef6b8af8c..c1bf62b4a5b77 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,7 +1,7 @@ { - "packages/puppeteer": "19.7.5", - "packages/puppeteer-core": "19.7.5", + "packages/puppeteer": "20.9.0", + "packages/puppeteer-core": "20.9.0", "packages/testserver": "0.6.0", - "packages/ng-schematics": "0.1.0", - "packages/browsers": "0.1.1" + "packages/ng-schematics": "0.3.0", + "packages/browsers": "1.4.6" } diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 9c681f0665a45..4084e393e9ee8 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,3 +1,3 @@ { - "recommendations": ["google.wireit"] + "recommendations": ["google.wireit", "GitHub.vscode-github-actions"] } diff --git a/.vscode/launch.template.json b/.vscode/launch.template.json index cdd05181beb30..4fe7e1945a527 100644 --- a/.vscode/launch.template.json +++ b/.vscode/launch.template.json @@ -37,7 +37,10 @@ "--no-coverage", "--no-suggestions" ], - "outFiles": ["${workspaceFolder}/**/*.js"] + "outFiles": ["${workspaceFolder}/**/*.js"], + "env": { + "DEBUGGER_ATTACHED": true + } } ] } diff --git a/README.md b/README.md index 451fe99e10790..3ae87ad150180 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,8 @@ > Chrome/Chromium over the > [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). > Puppeteer runs in -> [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) -> mode by default, but can be configured to run in full (non-headless) +> [headless](https://developer.chrome.com/articles/new-headless/) +> mode by default, but can be configured to run in full ("headful") > Chrome/Chromium. #### What can I do? @@ -29,7 +29,7 @@ Here are a few examples to get you started: - Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues. -- Test Chrome Extensions. +- [Test Chrome Extensions](https://pptr.dev/guides/chrome-extensions). ## Getting Started @@ -39,12 +39,14 @@ To use Puppeteer in your project, run: ```bash npm i puppeteer -# or `yarn add puppeteer` -# or `pnpm i puppeteer` +# or using yarn +yarn add puppeteer +# or using pnpm +pnpm i puppeteer ``` When you install Puppeteer, it automatically downloads a recent version of -Chromium (~170MB macOS, ~282MB Linux, ~280MB Windows) that is [guaranteed to +[Chrome for Testing](https://goo.gle/chrome-for-testing) (~170MB macOS, ~282MB Linux, ~280MB Windows) that is [guaranteed to work](https://pptr.dev/faq#q-why-doesnt-puppeteer-vxxx-work-with-chromium-vyyy) with Puppeteer. The browser is downloaded to the `$HOME/.cache/puppeteer` folder by default (starting with Puppeteer v19.0.0). @@ -57,6 +59,8 @@ include `$HOME/.cache` into the project's deployment. For a version of Puppeteer without the browser installation, see [`puppeteer-core`](#puppeteer-core). +If used with TypeScript, the minimum supported TypeScript version is `4.7.4`. + #### Configuration Puppeteer uses several defaults that can be customized through configuration @@ -92,23 +96,23 @@ Every release since v1.7.0 we publish two packages: - [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) `puppeteer` is a _product_ for browser automation. When installed, it downloads -a version of Chromium, which it then drives using `puppeteer-core`. Being an +a version of Chrome, which it then drives using `puppeteer-core`. Being an end-user product, `puppeteer` automates several workflows using reasonable defaults [that can be customized](https://pptr.dev/guides/configuration). `puppeteer-core` is a _library_ to help drive anything that supports DevTools protocol. Being a library, `puppeteer-core` is fully driven through its programmatic interface implying no defaults are assumed and `puppeteer-core` -will not download Chromium when installed. +will not download Chrome when installed. You should use `puppeteer-core` if you are [connecting to a remote browser](https://pptr.dev/api/puppeteer.puppeteer.connect) -or [managing browsers yourself](https://pptr.dev/api/puppeteer.browserfetcher). +or [managing browsers yourself](https://pptr.dev/browsers-api/). If you are managing browsers yourself, you will need to call [`puppeteer.launch`](https://pptr.dev/api/puppeteer.puppeteernode.launch) with an an explicit -[`executablePath`](https://pptr.dev/api/puppeteer.launchoptions.executablepath) -(or [`channel`](https://pptr.dev/api/puppeteer.launchoptions.channel) if it's +[`executablePath`](https://pptr.dev/api/puppeteer.launchoptions) +(or [`channel`](https://pptr.dev/api/puppeteer.launchoptions) if it's installed in a standard location). When using `puppeteer-core`, remember to change the import: @@ -141,9 +145,11 @@ The following example searches [developer.chrome.com](https://developer.chrome.c import puppeteer from 'puppeteer'; (async () => { + // Launch the browser and open a new blank page const browser = await puppeteer.launch(); const page = await browser.newPage(); + // Navigate the page to a URL await page.goto('https://developer.chrome.com/'); // Set screen size @@ -161,7 +167,7 @@ import puppeteer from 'puppeteer'; const textSelector = await page.waitForSelector( 'text/Customize and automate' ); - const fullTitle = await textSelector.evaluate(el => el.textContent); + const fullTitle = await textSelector?.evaluate(el => el.textContent); // Print the full title console.log('The title of this blog post is "%s".', fullTitle); @@ -174,19 +180,34 @@ import puppeteer from 'puppeteer'; **1. Uses Headless mode** -Puppeteer launches Chromium in -[headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). -To launch a full version of Chromium, set the -[`headless`](https://pptr.dev/api/puppeteer.browserlaunchargumentoptions.headless) +By default Puppeteer launches Chrome in +[old Headless mode](https://developer.chrome.com/articles/new-headless/). + +```ts +const browser = await puppeteer.launch(); +// Equivalent to +const browser = await puppeteer.launch({headless: true}); +``` + +[Chrome 112 launched a new Headless mode](https://developer.chrome.com/articles/new-headless/) that might cause some differences in behavior compared to the old Headless implementation. +In the future Puppeteer will start defaulting to new implementation. +We recommend you try it out before the switch: + +```ts +const browser = await puppeteer.launch({headless: 'new'}); +``` + +To launch a "headful" version of Chrome, set the +[`headless`](https://pptr.dev/api/puppeteer.browserlaunchargumentoptions) to `false` option when launching a browser: ```ts -const browser = await puppeteer.launch({headless: false}); // default is true +const browser = await puppeteer.launch({headless: false}); ``` -**2. Runs a bundled version of Chromium** +**2. Runs a bundled version of Chrome** -By default, Puppeteer downloads and uses a specific version of Chromium so its +By default, Puppeteer downloads and uses a specific version of Chrome so its API is guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium, pass in the executable's path when creating a `Browser` instance: @@ -195,8 +216,8 @@ version of Chrome or Chromium, pass in the executable's path when creating a const browser = await puppeteer.launch({executablePath: '/path/to/Chrome'}); ``` -You can also use Puppeteer with Firefox Nightly (experimental support). See -[`Puppeteer.launch`](https://pptr.dev/api/puppeteer.puppeteernode.launch) for +You can also use Puppeteer with Firefox. See +[status of cross-browser support](https://pptr.dev/faq/#q-what-is-the-status-of-cross-browser-support) for more information. See diff --git a/commitlint.config.js b/commitlint.config.js deleted file mode 100644 index af86dc9735a53..0000000000000 --- a/commitlint.config.js +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright 2020 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// See https://github.com/conventional-changelog/commitlint/blob/master/docs/reference-rules.md -module.exports = { - extends: ['@commitlint/config-conventional'], - rules: { - // Override. The subject may be the name of a class. - 'subject-case': [0], - // Override. Most UIs wrap the body. - 'body-max-line-length': [0], - // Override. Most UIs wrap the footer. - 'footer-max-line-length': [0], - }, -}; diff --git a/docker/Dockerfile b/docker/Dockerfile index 40d28cf0d46e5..d411dc955d616 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,7 +1,7 @@ FROM node:18 # Install latest chrome dev package and fonts to support major charsets (Chinese, Japanese, Arabic, Hebrew, Thai and a few others) -# Note: this installs the necessary libs to make the bundled version of Chromium that Puppeteer +# Note: this installs the necessary libs to make the bundled version of Chrome that Puppeteer # installs, work. RUN apt-get update \ && apt-get install -y wget gnupg \ @@ -17,11 +17,11 @@ USER pptruser WORKDIR /home/pptruser -COPY puppeteer-latest.tgz puppeteer-core-latest.tgz ./ +COPY puppeteer-browsers-latest.tgz puppeteer-latest.tgz puppeteer-core-latest.tgz ./ -# Install puppeteer and puppeteer-core into /home/pptruser/node_modules. -RUN npm i ./puppeteer-core-latest.tgz ./puppeteer-latest.tgz \ - && rm ./puppeteer-core-latest.tgz ./puppeteer-latest.tgz \ +# Install @puppeteer/browsers, puppeteer and puppeteer-core into /home/pptruser/node_modules. +RUN npm i ./puppeteer-browsers-latest.tgz ./puppeteer-core-latest.tgz ./puppeteer-latest.tgz \ + && rm ./puppeteer-browsers-latest.tgz ./puppeteer-core-latest.tgz ./puppeteer-latest.tgz \ && (node -e "require('child_process').execSync(require('puppeteer').executablePath() + ' --credits', {stdio: 'inherit'})" > THIRD_PARTY_NOTICES) CMD ["google-chrome-stable"] diff --git a/docker/README.md b/docker/README.md index f361930d4295f..10eff5336aad9 100644 --- a/docker/README.md +++ b/docker/README.md @@ -6,17 +6,17 @@ browser instance. ## Building the image -```sh +```bash docker build -t puppeteer-chrome-linux . # `puppeteer-chrome-linux` is the name of the image. ``` ## Running the image -```sh +```bash docker run -i --init --rm --cap-add=SYS_ADMIN --name puppeteer-chrome puppeteer-chrome-linux node -e "`cat test.js`" ``` -`--cap-add=SYS_ADMIN` capability is needed to enable Chromium sandbox that makes the browser more secure. Alternatively, it should be possible to start the browser binary with the `--no-sandbox` flag. +`--cap-add=SYS_ADMIN` capability is needed to enable Chrome sandbox that makes the browser more secure. Alternatively, it should be possible to start the browser binary with the `--no-sandbox` flag. ## GitHub Actions diff --git a/docker/pack.sh b/docker/pack.sh index c958c29a466f2..29229df9e7886 100755 --- a/docker/pack.sh +++ b/docker/pack.sh @@ -7,10 +7,12 @@ set -e cd docker -npm pack --workspace puppeteer --workspace puppeteer-core --pack-destination . +npm pack --workspace puppeteer --workspace puppeteer-core --workspace @puppeteer/browsers --pack-destination . rm -f puppeteer-core-latest.tgz rm -f puppeteer-latest.tgz +rm -f puppeteer-browsers-latest.tgz mv puppeteer-core-*.tgz puppeteer-core-latest.tgz +mv puppeteer-browsers-*.tgz puppeteer-browsers-latest.tgz mv puppeteer-[0-9]*.tgz puppeteer-latest.tgz \ No newline at end of file diff --git a/docker/test/smoke-test.js b/docker/test/smoke-test.js index d170ff39d2a02..0ac836ab89540 100644 --- a/docker/test/smoke-test.js +++ b/docker/test/smoke-test.js @@ -1,7 +1,7 @@ const puppeteer = require('puppeteer'); (async () => { - const browser = await puppeteer.launch(); + const browser = await puppeteer.launch({headless: 'new'}); const page = await browser.newPage(); await page.goto('https://example.com'); await browser.close(); diff --git a/docs/api/index.md b/docs/api/index.md index 93c5da94f72cd..a30c402e48820 100644 --- a/docs/api/index.md +++ b/docs/api/index.md @@ -6,40 +6,42 @@ sidebar_label: API ## Classes -| Class | Description | -| ------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [Accessibility](./puppeteer.accessibility.md) | The Accessibility class provides methods for inspecting Chromium's accessibility tree. The accessibility tree is used by assistive technology such as [screen readers](https://en.wikipedia.org/wiki/Screen_reader) or [switches](https://en.wikipedia.org/wiki/Switch_access). | -| [Browser](./puppeteer.browser.md) | A Browser is created when Puppeteer connects to a Chromium instance, either through [PuppeteerNode.launch()](./puppeteer.puppeteernode.launch.md) or [Puppeteer.connect()](./puppeteer.puppeteer.connect.md). | -| [BrowserContext](./puppeteer.browsercontext.md) | BrowserContexts provide a way to operate multiple independent browser sessions. When a browser is launched, it has a single BrowserContext used by default. The method [Browser.newPage](./puppeteer.browser.newpage.md) creates a page in the default browser context. | -| [BrowserFetcher](./puppeteer.browserfetcher.md) | BrowserFetcher can download and manage different versions of Chromium and Firefox. | -| [CDPSession](./puppeteer.cdpsession.md) | The CDPSession instances are used to talk raw Chrome Devtools Protocol. | -| [Connection](./puppeteer.connection.md) | | -| [ConsoleMessage](./puppeteer.consolemessage.md) | ConsoleMessage objects are dispatched by page via the 'console' event. | -| [Coverage](./puppeteer.coverage.md) | The Coverage class provides methods to gathers information about parts of JavaScript and CSS that were used by the page. | -| [CSSCoverage](./puppeteer.csscoverage.md) | | -| [CustomError](./puppeteer.customerror.md) | | -| [Dialog](./puppeteer.dialog.md) | Dialog instances are dispatched by the [Page](./puppeteer.page.md) via the dialog event. | -| [ElementHandle](./puppeteer.elementhandle.md) | ElementHandle represents an in-page DOM element. | -| [EventEmitter](./puppeteer.eventemitter.md) | The EventEmitter class that many Puppeteer classes extend. | -| [FileChooser](./puppeteer.filechooser.md) | File choosers let you react to the page requesting for a file. | -| [Frame](./puppeteer.frame.md) |

Represents a DOM frame.

To understand frames, you can think of frames as <iframe> elements. Just like iframes, frames can be nested, and when JavaScript is executed in a frame, the JavaScript does not effect frames inside the ambient frame the JavaScript executes in.

| -| [HTTPRequest](./puppeteer.httprequest.md) | Represents an HTTP request sent by a page. | -| [HTTPResponse](./puppeteer.httpresponse.md) | The HTTPResponse class represents responses which are received by the [Page](./puppeteer.page.md) class. | -| [JSCoverage](./puppeteer.jscoverage.md) | | -| [JSHandle](./puppeteer.jshandle.md) |

Represents a reference to a JavaScript object. Instances can be created using [Page.evaluateHandle()](./puppeteer.page.evaluatehandle.md).

Handles prevent the referenced JavaScript object from being garbage-collected unless the handle is purposely [disposed](./puppeteer.jshandle.dispose.md). JSHandles are auto-disposed when their associated frame is navigated away or the parent context gets destroyed.

Handles can be used as arguments for any evaluation function such as [Page.$eval()](./puppeteer.page._eval.md), [Page.evaluate()](./puppeteer.page.evaluate.md), and [Page.evaluateHandle()](./puppeteer.page.evaluatehandle.md). They are resolved to their referenced object.

| -| [Keyboard](./puppeteer.keyboard.md) | Keyboard provides an api for managing a virtual keyboard. The high level api is [Keyboard.type()](./puppeteer.keyboard.type.md), which takes raw characters and generates proper keydown, keypress/input, and keyup events on your page. | -| [Mouse](./puppeteer.mouse.md) | The Mouse class operates in main-frame CSS pixels relative to the top-left corner of the viewport. | -| [Page](./puppeteer.page.md) |

Page provides methods to interact with a single tab or [extension background page](https://developer.chrome.com/extensions/background_pages) in Chromium.

:::note

One Browser instance might have multiple Page instances.

:::

| -| [ProductLauncher](./puppeteer.productlauncher.md) | Describes a launcher - a class that is able to create and launch a browser instance. | -| [ProtocolError](./puppeteer.protocolerror.md) | ProtocolError is emitted whenever there is an error from the protocol. | -| [Puppeteer](./puppeteer.puppeteer.md) |

The main Puppeteer class.

IMPORTANT: if you are using Puppeteer in a Node environment, you will get an instance of [PuppeteerNode](./puppeteer.puppeteernode.md) when you import or require puppeteer. That class extends Puppeteer, so has all the methods documented below as well as all that are defined on [PuppeteerNode](./puppeteer.puppeteernode.md).

| -| [PuppeteerNode](./puppeteer.puppeteernode.md) |

Extends the main [Puppeteer](./puppeteer.puppeteer.md) class with Node specific behaviour for fetching and downloading browsers.

If you're using Puppeteer in a Node environment, this is the class you'll get when you run require('puppeteer') (or the equivalent ES import).

| -| [SecurityDetails](./puppeteer.securitydetails.md) | The SecurityDetails class represents the security details of a response that was received over a secure connection. | -| [Target](./puppeteer.target.md) | Target represents a [CDP target](https://chromedevtools.github.io/devtools-protocol/tot/Target/). In CDP a target is something that can be debugged such a frame, a page or a worker. | -| [TimeoutError](./puppeteer.timeouterror.md) | TimeoutError is emitted whenever certain operations are terminated due to timeout. | -| [Touchscreen](./puppeteer.touchscreen.md) | The Touchscreen class exposes touchscreen events. | -| [Tracing](./puppeteer.tracing.md) | The Tracing class exposes the tracing audit interface. | -| [WebWorker](./puppeteer.webworker.md) | This class represents a [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API). | +| Class | Description | +| --------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [Accessibility](./puppeteer.accessibility.md) | The Accessibility class provides methods for inspecting the browser's accessibility tree. The accessibility tree is used by assistive technology such as [screen readers](https://en.wikipedia.org/wiki/Screen_reader) or [switches](https://en.wikipedia.org/wiki/Switch_access). | +| [Browser](./puppeteer.browser.md) | A Browser is created when Puppeteer connects to a browser instance, either through [PuppeteerNode.launch()](./puppeteer.puppeteernode.launch.md) or [Puppeteer.connect()](./puppeteer.puppeteer.connect.md). | +| [BrowserContext](./puppeteer.browsercontext.md) | BrowserContexts provide a way to operate multiple independent browser sessions. When a browser is launched, it has a single BrowserContext used by default. The method [Browser.newPage](./puppeteer.browser.newpage.md) creates a page in the default browser context. | +| [CDPSession](./puppeteer.cdpsession.md) | The CDPSession instances are used to talk raw Chrome Devtools Protocol. | +| [Connection](./puppeteer.connection.md) | | +| [ConsoleMessage](./puppeteer.consolemessage.md) | ConsoleMessage objects are dispatched by page via the 'console' event. | +| [Coverage](./puppeteer.coverage.md) | The Coverage class provides methods to gather information about parts of JavaScript and CSS that were used by the page. | +| [CSSCoverage](./puppeteer.csscoverage.md) | | +| [CustomError](./puppeteer.customerror.md) | | +| [DeviceRequestPrompt](./puppeteer.devicerequestprompt.md) | Device request prompts let you respond to the page requesting for a device through an API like WebBluetooth. | +| [DeviceRequestPromptDevice](./puppeteer.devicerequestpromptdevice.md) | Device in a request prompt. | +| [Dialog](./puppeteer.dialog.md) | Dialog instances are dispatched by the [Page](./puppeteer.page.md) via the dialog event. | +| [ElementHandle](./puppeteer.elementhandle.md) | ElementHandle represents an in-page DOM element. | +| [EventEmitter](./puppeteer.eventemitter.md) | The EventEmitter class that many Puppeteer classes extend. | +| [FileChooser](./puppeteer.filechooser.md) | File choosers let you react to the page requesting for a file. | +| [Frame](./puppeteer.frame.md) |

Represents a DOM frame.

To understand frames, you can think of frames as <iframe> elements. Just like iframes, frames can be nested, and when JavaScript is executed in a frame, the JavaScript does not effect frames inside the ambient frame the JavaScript executes in.

| +| [HTTPRequest](./puppeteer.httprequest.md) | Represents an HTTP request sent by a page. | +| [HTTPResponse](./puppeteer.httpresponse.md) | The HTTPResponse class represents responses which are received by the [Page](./puppeteer.page.md) class. | +| [JSCoverage](./puppeteer.jscoverage.md) | | +| [JSHandle](./puppeteer.jshandle.md) |

Represents a reference to a JavaScript object. Instances can be created using [Page.evaluateHandle()](./puppeteer.page.evaluatehandle.md).

Handles prevent the referenced JavaScript object from being garbage-collected unless the handle is purposely [disposed](./puppeteer.jshandle.dispose.md). JSHandles are auto-disposed when their associated frame is navigated away or the parent context gets destroyed.

Handles can be used as arguments for any evaluation function such as [Page.$eval()](./puppeteer.page._eval.md), [Page.evaluate()](./puppeteer.page.evaluate.md), and [Page.evaluateHandle()](./puppeteer.page.evaluatehandle.md). They are resolved to their referenced object.

| +| [Keyboard](./puppeteer.keyboard.md) | Keyboard provides an api for managing a virtual keyboard. The high level api is [Keyboard.type()](./puppeteer.keyboard.type.md), which takes raw characters and generates proper keydown, keypress/input, and keyup events on your page. | +| [Locator](./puppeteer.locator.md) | Locators describe a strategy of locating elements and performing an action on them. If the action fails because the element is not ready for the action, the whole operation is retried. Various preconditions for a successful action are checked automatically. | +| [Mouse](./puppeteer.mouse.md) | The Mouse class operates in main-frame CSS pixels relative to the top-left corner of the viewport. | +| [Page](./puppeteer.page.md) |

Page provides methods to interact with a single tab or [extension background page](https://developer.chrome.com/extensions/background_pages) in the browser.

:::note

One Browser instance might have multiple Page instances.

:::

| +| [ProductLauncher](./puppeteer.productlauncher.md) | Describes a launcher - a class that is able to create and launch a browser instance. | +| [ProtocolError](./puppeteer.protocolerror.md) | ProtocolError is emitted whenever there is an error from the protocol. | +| [Puppeteer](./puppeteer.puppeteer.md) |

The main Puppeteer class.

IMPORTANT: if you are using Puppeteer in a Node environment, you will get an instance of [PuppeteerNode](./puppeteer.puppeteernode.md) when you import or require puppeteer. That class extends Puppeteer, so has all the methods documented below as well as all that are defined on [PuppeteerNode](./puppeteer.puppeteernode.md).

| +| [PuppeteerNode](./puppeteer.puppeteernode.md) |

Extends the main [Puppeteer](./puppeteer.puppeteer.md) class with Node specific behaviour for fetching and downloading browsers.

If you're using Puppeteer in a Node environment, this is the class you'll get when you run require('puppeteer') (or the equivalent ES import).

| +| [SecurityDetails](./puppeteer.securitydetails.md) | The SecurityDetails class represents the security details of a response that was received over a secure connection. | +| [Target](./puppeteer.target.md) | Target represents a [CDP target](https://chromedevtools.github.io/devtools-protocol/tot/Target/). In CDP a target is something that can be debugged such a frame, a page or a worker. | +| [TimeoutError](./puppeteer.timeouterror.md) | TimeoutError is emitted whenever certain operations are terminated due to timeout. | +| [Touchscreen](./puppeteer.touchscreen.md) | The Touchscreen class exposes touchscreen events. | +| [Tracing](./puppeteer.tracing.md) | The Tracing class exposes the tracing audit interface. | +| [WebWorker](./puppeteer.webworker.md) | This class represents a [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API). | ## Enumerations @@ -48,7 +50,9 @@ sidebar_label: API | [BrowserContextEmittedEvents](./puppeteer.browsercontextemittedevents.md) | | | [BrowserEmittedEvents](./puppeteer.browseremittedevents.md) | All the events a [browser instance](./puppeteer.browser.md) may emit. | | [InterceptResolutionAction](./puppeteer.interceptresolutionaction.md) | | +| [LocatorEmittedEvents](./puppeteer.locatoremittedevents.md) | All the events that a locator instance may emit. | | [PageEmittedEvents](./puppeteer.pageemittedevents.md) | All the events that a page instance may emit. | +| [TargetType](./puppeteer.targettype.md) | | ## Functions @@ -63,18 +67,16 @@ sidebar_label: API | Interface | Description | | --------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [ActionOptions](./puppeteer.actionoptions.md) | | +| [AutofillData](./puppeteer.autofilldata.md) | | | [BoundingBox](./puppeteer.boundingbox.md) | | | [BoxModel](./puppeteer.boxmodel.md) | | | [BrowserConnectOptions](./puppeteer.browserconnectoptions.md) | Generic browser options that can be passed when launching any browser or when connecting to an existing browser instance. | | [BrowserContextOptions](./puppeteer.browsercontextoptions.md) | BrowserContext options. | -| [BrowserFetcherOptions](./puppeteer.browserfetcheroptions.md) | | -| [BrowserFetcherRevisionInfo](./puppeteer.browserfetcherrevisioninfo.md) | | | [BrowserLaunchArgumentOptions](./puppeteer.browserlaunchargumentoptions.md) | Launcher options that only apply to Chrome. | -| [CDPSessionOnMessageObject](./puppeteer.cdpsessiononmessageobject.md) | | | [ClickOptions](./puppeteer.clickoptions.md) | | | [CommonEventEmitter](./puppeteer.commoneventemitter.md) | | | [Configuration](./puppeteer.configuration.md) |

Defines options to configure Puppeteer's behavior during installation and runtime.

See individual properties for more information.

| -| [ConnectionCallback](./puppeteer.connectioncallback.md) | | | [ConnectionTransport](./puppeteer.connectiontransport.md) | | | [ConnectOptions](./puppeteer.connectoptions.md) | | | [ConsoleMessageLocation](./puppeteer.consolemessagelocation.md) | | @@ -84,7 +86,6 @@ sidebar_label: API | [CSSCoverageOptions](./puppeteer.csscoverageoptions.md) | Set of configurable options for CSS coverage. | | [CustomQueryHandler](./puppeteer.customqueryhandler.md) | | | [Device](./puppeteer.device.md) | | -| [ExperimentsConfiguration](./puppeteer.experimentsconfiguration.md) |

Defines experiment options for Puppeteer.

See individual properties for more information.

| | [FrameAddScriptTagOptions](./puppeteer.frameaddscripttagoptions.md) | | | [FrameAddStyleTagOptions](./puppeteer.frameaddstyletagoptions.md) | | | [FrameWaitForFunctionOptions](./puppeteer.framewaitforfunctionoptions.md) | | @@ -93,18 +94,25 @@ sidebar_label: API | [InternalNetworkConditions](./puppeteer.internalnetworkconditions.md) | | | [JSCoverageEntry](./puppeteer.jscoverageentry.md) | The CoverageEntry class for JavaScript | | [JSCoverageOptions](./puppeteer.jscoverageoptions.md) | Set of configurable options for JS coverage. | +| [KeyboardTypeOptions](./puppeteer.keyboardtypeoptions.md) | | +| [KeyDownOptions](./puppeteer.keydownoptions.md) | | | [LaunchOptions](./puppeteer.launchoptions.md) | Generic launch options that can be passed when launching any browser. | +| [LocatorEventObject](./puppeteer.locatoreventobject.md) | | +| [LocatorOptions](./puppeteer.locatoroptions.md) | | +| [LocatorScrollOptions](./puppeteer.locatorscrolloptions.md) | | | [MediaFeature](./puppeteer.mediafeature.md) | | | [Metrics](./puppeteer.metrics.md) | | +| [MouseClickOptions](./puppeteer.mouseclickoptions.md) | | +| [MouseMoveOptions](./puppeteer.mousemoveoptions.md) | | | [MouseOptions](./puppeteer.mouseoptions.md) | | | [MouseWheelOptions](./puppeteer.mousewheeloptions.md) | | | [NetworkConditions](./puppeteer.networkconditions.md) | | +| [NewDocumentScriptEvaluation](./puppeteer.newdocumentscriptevaluation.md) | | | [Offset](./puppeteer.offset.md) | | | [PageEventObject](./puppeteer.pageeventobject.md) |

Denotes the objects received by callback functions for page events.

See [PageEmittedEvents](./puppeteer.pageemittedevents.md) for more detail on the events and when they are emitted.

| | [PDFMargin](./puppeteer.pdfmargin.md) | | | [PDFOptions](./puppeteer.pdfoptions.md) | Valid options to configure PDF generation via [Page.pdf()](./puppeteer.page.pdf.md). | | [Point](./puppeteer.point.md) | | -| [PressOptions](./puppeteer.pressoptions.md) | | | [PuppeteerErrors](./puppeteer.puppeteererrors.md) | | | [PuppeteerLaunchOptions](./puppeteer.puppeteerlaunchoptions.md) | | | [RemoteAddress](./puppeteer.remoteaddress.md) | | @@ -125,18 +133,18 @@ sidebar_label: API | Variable | Description | | --------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | | [connect](./puppeteer.connect.md) | | -| [createBrowserFetcher](./puppeteer.createbrowserfetcher.md) | | | [DEFAULT_INTERCEPT_RESOLUTION_PRIORITY](./puppeteer.default_intercept_resolution_priority.md) | The default cooperative request interception resolution priority | | [defaultArgs](./puppeteer.defaultargs.md) | | | [devices](./puppeteer.devices.md) | | | [errors](./puppeteer.errors.md) | | -| [EVALUATION_SCRIPT_URL](./puppeteer.evaluation_script_url.md) | | | [executablePath](./puppeteer.executablepath.md) | | | [KnownDevices](./puppeteer.knowndevices.md) | A list of devices to be used with [Page.emulate()](./puppeteer.page.emulate.md). | | [launch](./puppeteer.launch.md) | | +| [MouseButton](./puppeteer.mousebutton.md) | Enum of valid mouse buttons. | | [networkConditions](./puppeteer.networkconditions.md) | | | [PredefinedNetworkConditions](./puppeteer.predefinednetworkconditions.md) | A list of network conditions to be used with [Page.emulateNetworkConditions()](./puppeteer.page.emulatenetworkconditions.md). | | [puppeteer](./puppeteer.puppeteer.md) | | +| [trimCache](./puppeteer.trimcache.md) | | ## Type Aliases @@ -152,6 +160,7 @@ sidebar_label: API | [EvaluateFunc](./puppeteer.evaluatefunc.md) | | | [EvaluateFuncWith](./puppeteer.evaluatefuncwith.md) | | | [EventType](./puppeteer.eventtype.md) | | +| [ExperimentsConfiguration](./puppeteer.experimentsconfiguration.md) |

Defines experiment options for Puppeteer.

See individual properties for more information.

| | [FlattenHandle](./puppeteer.flattenhandle.md) | | | [HandleFor](./puppeteer.handlefor.md) | | | [HandleOr](./puppeteer.handleor.md) | | @@ -159,15 +168,19 @@ sidebar_label: API | [InnerParams](./puppeteer.innerparams.md) | | | [InterceptResolutionStrategy](./puppeteer.interceptresolutionstrategy.md) | | | [KeyInput](./puppeteer.keyinput.md) | All the valid keys that can be passed to functions that take user input, such as [keyboard.press](./puppeteer.keyboard.press.md) | +| [KeyPressOptions](./puppeteer.keypressoptions.md) | | +| [LocatorClickOptions](./puppeteer.locatorclickoptions.md) | | | [LowerCasePaperFormat](./puppeteer.lowercasepaperformat.md) | | | [MouseButton](./puppeteer.mousebutton.md) | | | [NodeFor](./puppeteer.nodefor.md) | | | [PaperFormat](./puppeteer.paperformat.md) | All the valid paper format types when printing a PDF. | | [Permission](./puppeteer.permission.md) | | -| [Platform](./puppeteer.platform.md) | Supported platforms. | +| [Predicate](./puppeteer.predicate.md) | | | [Product](./puppeteer.product.md) | Supported products. | | [ProtocolLifeCycleEvent](./puppeteer.protocollifecycleevent.md) | | | [PuppeteerLifeCycleEvent](./puppeteer.puppeteerlifecycleevent.md) | | | [PuppeteerNodeLaunchOptions](./puppeteer.puppeteernodelaunchoptions.md) | Utility type exposed to enable users to define options that can be passed to puppeteer.launch without having to list the set of all types. | | [ResourceType](./puppeteer.resourcetype.md) | Resource types for HTTPRequests as perceived by the rendering engine. | | [TargetFilterCallback](./puppeteer.targetfiltercallback.md) | | +| [UnionLocatorOf](./puppeteer.unionlocatorof.md) | | +| [VisibilityOption](./puppeteer.visibilityoption.md) | | diff --git a/docs/api/puppeteer.accessibility.md b/docs/api/puppeteer.accessibility.md index f17d1433415f3..542c197cc5f55 100644 --- a/docs/api/puppeteer.accessibility.md +++ b/docs/api/puppeteer.accessibility.md @@ -4,7 +4,7 @@ sidebar_label: Accessibility # Accessibility class -The Accessibility class provides methods for inspecting Chromium's accessibility tree. The accessibility tree is used by assistive technology such as [screen readers](https://en.wikipedia.org/wiki/Screen_reader) or [switches](https://en.wikipedia.org/wiki/Switch_access). +The Accessibility class provides methods for inspecting the browser's accessibility tree. The accessibility tree is used by assistive technology such as [screen readers](https://en.wikipedia.org/wiki/Screen_reader) or [switches](https://en.wikipedia.org/wiki/Switch_access). #### Signature: diff --git a/docs/api/puppeteer.accessibility.snapshot.md b/docs/api/puppeteer.accessibility.snapshot.md index e2f0b6e91a579..4dd49a8d164c9 100644 --- a/docs/api/puppeteer.accessibility.snapshot.md +++ b/docs/api/puppeteer.accessibility.snapshot.md @@ -28,7 +28,7 @@ An AXNode object representing the snapshot. ## Remarks -**NOTE** The Chromium accessibility tree contains nodes that go unused on most platforms and by most screen readers. Puppeteer will discard them as well for an easier to process tree, unless `interestingOnly` is set to `false`. +**NOTE** The Chrome accessibility tree contains nodes that go unused on most platforms and by most screen readers. Puppeteer will discard them as well for an easier to process tree, unless `interestingOnly` is set to `false`. ## Example 1 diff --git a/docs/api/puppeteer.actionoptions.md b/docs/api/puppeteer.actionoptions.md new file mode 100644 index 0000000000000..2201b476edb5c --- /dev/null +++ b/docs/api/puppeteer.actionoptions.md @@ -0,0 +1,17 @@ +--- +sidebar_label: ActionOptions +--- + +# ActionOptions interface + +#### Signature: + +```typescript +export interface ActionOptions +``` + +## Properties + +| Property | Modifiers | Type | Description | Default | +| -------- | --------------------- | ----------- | ----------- | ------- | +| signal | optional | AbortSignal | | | diff --git a/docs/api/puppeteer.autofilldata.md b/docs/api/puppeteer.autofilldata.md new file mode 100644 index 0000000000000..3a2d7c031d1ad --- /dev/null +++ b/docs/api/puppeteer.autofilldata.md @@ -0,0 +1,17 @@ +--- +sidebar_label: AutofillData +--- + +# AutofillData interface + +#### Signature: + +```typescript +export interface AutofillData +``` + +## Properties + +| Property | Modifiers | Type | Description | Default | +| ---------- | --------- | --------------------------------------------------------------------------------------- | ----------- | ------- | +| creditCard | | { number: string; name: string; expiryMonth: string; expiryYear: string; cvc: string; } | | | diff --git a/docs/api/puppeteer.boundingbox.height.md b/docs/api/puppeteer.boundingbox.height.md deleted file mode 100644 index 86ec3fef987ce..0000000000000 --- a/docs/api/puppeteer.boundingbox.height.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: BoundingBox.height ---- - -# BoundingBox.height property - -the height of the element in pixels. - -#### Signature: - -```typescript -interface BoundingBox { - height: number; -} -``` diff --git a/docs/api/puppeteer.boundingbox.md b/docs/api/puppeteer.boundingbox.md index 7a3b9268f280d..4b813816575be 100644 --- a/docs/api/puppeteer.boundingbox.md +++ b/docs/api/puppeteer.boundingbox.md @@ -14,7 +14,7 @@ export interface BoundingBox extends Point ## Properties -| Property | Modifiers | Type | Description | Default | -| ------------------------------------------- | --------- | ------ | ------------------------------------ | ------- | -| [height](./puppeteer.boundingbox.height.md) | | number | the height of the element in pixels. | | -| [width](./puppeteer.boundingbox.width.md) | | number | the width of the element in pixels. | | +| Property | Modifiers | Type | Description | Default | +| -------- | --------- | ------ | ------------------------------------ | ------- | +| height | | number | the height of the element in pixels. | | +| width | | number | the width of the element in pixels. | | diff --git a/docs/api/puppeteer.boundingbox.width.md b/docs/api/puppeteer.boundingbox.width.md deleted file mode 100644 index b85555098ee44..0000000000000 --- a/docs/api/puppeteer.boundingbox.width.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: BoundingBox.width ---- - -# BoundingBox.width property - -the width of the element in pixels. - -#### Signature: - -```typescript -interface BoundingBox { - width: number; -} -``` diff --git a/docs/api/puppeteer.boxmodel.border.md b/docs/api/puppeteer.boxmodel.border.md deleted file mode 100644 index 48a5f0251dfbb..0000000000000 --- a/docs/api/puppeteer.boxmodel.border.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: BoxModel.border ---- - -# BoxModel.border property - -#### Signature: - -```typescript -interface BoxModel { - border: Point[]; -} -``` diff --git a/docs/api/puppeteer.boxmodel.content.md b/docs/api/puppeteer.boxmodel.content.md deleted file mode 100644 index 8f670e4b407e8..0000000000000 --- a/docs/api/puppeteer.boxmodel.content.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: BoxModel.content ---- - -# BoxModel.content property - -#### Signature: - -```typescript -interface BoxModel { - content: Point[]; -} -``` diff --git a/docs/api/puppeteer.boxmodel.height.md b/docs/api/puppeteer.boxmodel.height.md deleted file mode 100644 index 0c85e2e51e269..0000000000000 --- a/docs/api/puppeteer.boxmodel.height.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: BoxModel.height ---- - -# BoxModel.height property - -#### Signature: - -```typescript -interface BoxModel { - height: number; -} -``` diff --git a/docs/api/puppeteer.boxmodel.margin.md b/docs/api/puppeteer.boxmodel.margin.md deleted file mode 100644 index 172937f521d4a..0000000000000 --- a/docs/api/puppeteer.boxmodel.margin.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: BoxModel.margin ---- - -# BoxModel.margin property - -#### Signature: - -```typescript -interface BoxModel { - margin: Point[]; -} -``` diff --git a/docs/api/puppeteer.boxmodel.md b/docs/api/puppeteer.boxmodel.md index 216c6648c794f..dd2abd8dd4815 100644 --- a/docs/api/puppeteer.boxmodel.md +++ b/docs/api/puppeteer.boxmodel.md @@ -12,11 +12,11 @@ export interface BoxModel ## Properties -| Property | Modifiers | Type | Description | Default | -| ------------------------------------------ | --------- | --------------------------------- | ----------- | ------- | -| [border](./puppeteer.boxmodel.border.md) | | [Point](./puppeteer.point.md)\[\] | | | -| [content](./puppeteer.boxmodel.content.md) | | [Point](./puppeteer.point.md)\[\] | | | -| [height](./puppeteer.boxmodel.height.md) | | number | | | -| [margin](./puppeteer.boxmodel.margin.md) | | [Point](./puppeteer.point.md)\[\] | | | -| [padding](./puppeteer.boxmodel.padding.md) | | [Point](./puppeteer.point.md)\[\] | | | -| [width](./puppeteer.boxmodel.width.md) | | number | | | +| Property | Modifiers | Type | Description | Default | +| -------- | --------- | --------------------------------- | ----------- | ------- | +| border | | [Point](./puppeteer.point.md)\[\] | | | +| content | | [Point](./puppeteer.point.md)\[\] | | | +| height | | number | | | +| margin | | [Point](./puppeteer.point.md)\[\] | | | +| padding | | [Point](./puppeteer.point.md)\[\] | | | +| width | | number | | | diff --git a/docs/api/puppeteer.boxmodel.padding.md b/docs/api/puppeteer.boxmodel.padding.md deleted file mode 100644 index bdb8667a42dc9..0000000000000 --- a/docs/api/puppeteer.boxmodel.padding.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: BoxModel.padding ---- - -# BoxModel.padding property - -#### Signature: - -```typescript -interface BoxModel { - padding: Point[]; -} -``` diff --git a/docs/api/puppeteer.boxmodel.width.md b/docs/api/puppeteer.boxmodel.width.md deleted file mode 100644 index 3dc3671093ee8..0000000000000 --- a/docs/api/puppeteer.boxmodel.width.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: BoxModel.width ---- - -# BoxModel.width property - -#### Signature: - -```typescript -interface BoxModel { - width: number; -} -``` diff --git a/docs/api/puppeteer.browser.close.md b/docs/api/puppeteer.browser.close.md index a087539853d4a..b7c30033e6de9 100644 --- a/docs/api/puppeteer.browser.close.md +++ b/docs/api/puppeteer.browser.close.md @@ -4,7 +4,7 @@ sidebar_label: Browser.close # Browser.close() method -Closes Chromium and all of its pages (if any were opened). The [Browser](./puppeteer.browser.md) object itself is considered to be disposed and cannot be used anymore. +Closes the browser and all of its pages (if any were opened). The [Browser](./puppeteer.browser.md) object itself is considered to be disposed and cannot be used anymore. #### Signature: diff --git a/docs/api/puppeteer.browser.disconnect.md b/docs/api/puppeteer.browser.disconnect.md index 35f9a5779f1a8..c102c10b09472 100644 --- a/docs/api/puppeteer.browser.disconnect.md +++ b/docs/api/puppeteer.browser.disconnect.md @@ -4,7 +4,7 @@ sidebar_label: Browser.disconnect # Browser.disconnect() method -Disconnects Puppeteer from the browser, but leaves the Chromium process running. After calling `disconnect`, the [Browser](./puppeteer.browser.md) object is considered disposed and cannot be used anymore. +Disconnects Puppeteer from the browser, but leaves the browser process running. After calling `disconnect`, the [Browser](./puppeteer.browser.md) object is considered disposed and cannot be used anymore. #### Signature: diff --git a/docs/api/puppeteer.browser.md b/docs/api/puppeteer.browser.md index bfee6200652d7..cf22ac7eaf02f 100644 --- a/docs/api/puppeteer.browser.md +++ b/docs/api/puppeteer.browser.md @@ -4,7 +4,7 @@ sidebar_label: Browser # Browser class -A Browser is created when Puppeteer connects to a Chromium instance, either through [PuppeteerNode.launch()](./puppeteer.puppeteernode.launch.md) or [Puppeteer.connect()](./puppeteer.puppeteer.connect.md). +A Browser is created when Puppeteer connects to a browser instance, either through [PuppeteerNode.launch()](./puppeteer.puppeteernode.launch.md) or [Puppeteer.connect()](./puppeteer.puppeteer.connect.md). #### Signature: @@ -44,34 +44,34 @@ import puppeteer from 'puppeteer'; (async () => { const browser = await puppeteer.launch(); - // Store the endpoint to be able to reconnect to Chromium + // Store the endpoint to be able to reconnect to the browser. const browserWSEndpoint = browser.wsEndpoint(); - // Disconnect puppeteer from Chromium + // Disconnect puppeteer from the browser. browser.disconnect(); // Use the endpoint to reestablish a connection const browser2 = await puppeteer.connect({browserWSEndpoint}); - // Close Chromium + // Close the browser. await browser2.close(); })(); ``` ## Methods -| Method | Modifiers | Description | -| ---------------------------------------------------------------------------------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [browserContexts()](./puppeteer.browser.browsercontexts.md) | | Returns an array of all open browser contexts. In a newly created browser, this will return a single instance of [BrowserContext](./puppeteer.browsercontext.md). | -| [close()](./puppeteer.browser.close.md) | | Closes Chromium and all of its pages (if any were opened). The [Browser](./puppeteer.browser.md) object itself is considered to be disposed and cannot be used anymore. | -| [createIncognitoBrowserContext(options)](./puppeteer.browser.createincognitobrowsercontext.md) | | Creates a new incognito browser context. This won't share cookies/cache with other browser contexts. | -| [defaultBrowserContext()](./puppeteer.browser.defaultbrowsercontext.md) | | Returns the default browser context. The default browser context cannot be closed. | -| [disconnect()](./puppeteer.browser.disconnect.md) | | Disconnects Puppeteer from the browser, but leaves the Chromium process running. After calling disconnect, the [Browser](./puppeteer.browser.md) object is considered disposed and cannot be used anymore. | -| [isConnected()](./puppeteer.browser.isconnected.md) | | Indicates that the browser is connected. | -| [newPage()](./puppeteer.browser.newpage.md) | | Promise which resolves to a new [Page](./puppeteer.page.md) object. The Page is created in a default browser context. | -| [pages()](./puppeteer.browser.pages.md) | | An array of all open pages inside the Browser. | -| [process()](./puppeteer.browser.process.md) | | The spawned browser process. Returns null if the browser instance was created with [Puppeteer.connect()](./puppeteer.puppeteer.connect.md). | -| [target()](./puppeteer.browser.target.md) | | The target associated with the browser. | -| [targets()](./puppeteer.browser.targets.md) | | All active targets inside the Browser. In case of multiple browser contexts, returns an array with all the targets in all browser contexts. | -| [userAgent()](./puppeteer.browser.useragent.md) | | The browser's original user agent. Pages can override the browser user agent with [Page.setUserAgent()](./puppeteer.page.setuseragent.md). | -| [version()](./puppeteer.browser.version.md) | | A string representing the browser name and version. | -| [waitForTarget(predicate, options)](./puppeteer.browser.waitfortarget.md) | | Searches for a target in all browser contexts. | -| [wsEndpoint()](./puppeteer.browser.wsendpoint.md) | | The browser websocket endpoint which can be used as an argument to [Puppeteer.connect()](./puppeteer.puppeteer.connect.md). | +| Method | Modifiers | Description | +| ---------------------------------------------------------------------------------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [browserContexts()](./puppeteer.browser.browsercontexts.md) | | Returns an array of all open browser contexts. In a newly created browser, this will return a single instance of [BrowserContext](./puppeteer.browsercontext.md). | +| [close()](./puppeteer.browser.close.md) | | Closes the browser and all of its pages (if any were opened). The [Browser](./puppeteer.browser.md) object itself is considered to be disposed and cannot be used anymore. | +| [createIncognitoBrowserContext(options)](./puppeteer.browser.createincognitobrowsercontext.md) | | Creates a new incognito browser context. This won't share cookies/cache with other browser contexts. | +| [defaultBrowserContext()](./puppeteer.browser.defaultbrowsercontext.md) | | Returns the default browser context. The default browser context cannot be closed. | +| [disconnect()](./puppeteer.browser.disconnect.md) | | Disconnects Puppeteer from the browser, but leaves the browser process running. After calling disconnect, the [Browser](./puppeteer.browser.md) object is considered disposed and cannot be used anymore. | +| [isConnected()](./puppeteer.browser.isconnected.md) | | Indicates that the browser is connected. | +| [newPage()](./puppeteer.browser.newpage.md) | | Promise which resolves to a new [Page](./puppeteer.page.md) object. The Page is created in a default browser context. | +| [pages()](./puppeteer.browser.pages.md) | | An array of all open pages inside the Browser. | +| [process()](./puppeteer.browser.process.md) | | The spawned browser process. Returns null if the browser instance was created with [Puppeteer.connect()](./puppeteer.puppeteer.connect.md). | +| [target()](./puppeteer.browser.target.md) | | The target associated with the browser. | +| [targets()](./puppeteer.browser.targets.md) | | All active targets inside the Browser. In case of multiple browser contexts, returns an array with all the targets in all browser contexts. | +| [userAgent()](./puppeteer.browser.useragent.md) | | The browser's original user agent. Pages can override the browser user agent with [Page.setUserAgent()](./puppeteer.page.setuseragent.md). | +| [version()](./puppeteer.browser.version.md) | | A string representing the browser name and version. | +| [waitForTarget(predicate, options)](./puppeteer.browser.waitfortarget.md) | | Searches for a target in all browser contexts. | +| [wsEndpoint()](./puppeteer.browser.wsendpoint.md) | | The browser websocket endpoint which can be used as an argument to [Puppeteer.connect()](./puppeteer.puppeteer.connect.md). | diff --git a/docs/api/puppeteer.browser.version.md b/docs/api/puppeteer.browser.version.md index 205732a1bbe89..ed6b027b216ba 100644 --- a/docs/api/puppeteer.browser.version.md +++ b/docs/api/puppeteer.browser.version.md @@ -20,6 +20,6 @@ Promise<string> ## Remarks -For headless Chromium, this is similar to `HeadlessChrome/61.0.3153.0`. For non-headless, this is similar to `Chrome/61.0.3153.0`. +For headless browser, this is similar to `HeadlessChrome/61.0.3153.0`. For non-headless or new-headless, this is similar to `Chrome/61.0.3153.0`. For Firefox, it is similar to `Firefox/116.0a1`. -The format of browser.version() might change with future releases of Chromium. +The format of browser.version() might change with future releases of browsers. diff --git a/docs/api/puppeteer.browserconnectoptions.defaultviewport.md b/docs/api/puppeteer.browserconnectoptions.defaultviewport.md deleted file mode 100644 index 7dc348e333407..0000000000000 --- a/docs/api/puppeteer.browserconnectoptions.defaultviewport.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: BrowserConnectOptions.defaultViewport ---- - -# BrowserConnectOptions.defaultViewport property - -Sets the viewport for each page. - -#### Signature: - -```typescript -interface BrowserConnectOptions { - defaultViewport?: Viewport | null; -} -``` diff --git a/docs/api/puppeteer.browserconnectoptions.ignorehttpserrors.md b/docs/api/puppeteer.browserconnectoptions.ignorehttpserrors.md deleted file mode 100644 index 94a875f84652d..0000000000000 --- a/docs/api/puppeteer.browserconnectoptions.ignorehttpserrors.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: BrowserConnectOptions.ignoreHTTPSErrors ---- - -# BrowserConnectOptions.ignoreHTTPSErrors property - -Whether to ignore HTTPS errors during navigation. - -#### Signature: - -```typescript -interface BrowserConnectOptions { - ignoreHTTPSErrors?: boolean; -} -``` - -#### Default value: - -false diff --git a/docs/api/puppeteer.browserconnectoptions.md b/docs/api/puppeteer.browserconnectoptions.md index 618e931c209f4..3e1a65b028a12 100644 --- a/docs/api/puppeteer.browserconnectoptions.md +++ b/docs/api/puppeteer.browserconnectoptions.md @@ -14,9 +14,10 @@ export interface BrowserConnectOptions ## Properties -| Property | Modifiers | Type | Description | Default | -| ---------------------------------------------------------------------------- | --------- | ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ | ------- | -| [defaultViewport?](./puppeteer.browserconnectoptions.defaultviewport.md) | | [Viewport](./puppeteer.viewport.md) \| null | _(Optional)_ Sets the viewport for each page. | | -| [ignoreHTTPSErrors?](./puppeteer.browserconnectoptions.ignorehttpserrors.md) | | boolean | _(Optional)_ Whether to ignore HTTPS errors during navigation. | false | -| [slowMo?](./puppeteer.browserconnectoptions.slowmo.md) | | number | _(Optional)_ Slows down Puppeteer operations by the specified amount of milliseconds to aid debugging. | | -| [targetFilter?](./puppeteer.browserconnectoptions.targetfilter.md) | | [TargetFilterCallback](./puppeteer.targetfiltercallback.md) | _(Optional)_ Callback to decide if Puppeteer should connect to a given target or not. | | +| Property | Modifiers | Type | Description | Default | +| ----------------- | --------------------- | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------- | -------------------- | +| defaultViewport | optional | [Viewport](./puppeteer.viewport.md) \| null | Sets the viewport for each page. | | +| ignoreHTTPSErrors | optional | boolean | Whether to ignore HTTPS errors during navigation. | false | +| protocolTimeout | optional | number | Timeout setting for individual protocol (CDP) calls. | 180_000 | +| slowMo | optional | number | Slows down Puppeteer operations by the specified amount of milliseconds to aid debugging. | | +| targetFilter | optional | [TargetFilterCallback](./puppeteer.targetfiltercallback.md) | Callback to decide if Puppeteer should connect to a given target or not. | | diff --git a/docs/api/puppeteer.browserconnectoptions.slowmo.md b/docs/api/puppeteer.browserconnectoptions.slowmo.md deleted file mode 100644 index 59940148868f5..0000000000000 --- a/docs/api/puppeteer.browserconnectoptions.slowmo.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: BrowserConnectOptions.slowMo ---- - -# BrowserConnectOptions.slowMo property - -Slows down Puppeteer operations by the specified amount of milliseconds to aid debugging. - -#### Signature: - -```typescript -interface BrowserConnectOptions { - slowMo?: number; -} -``` diff --git a/docs/api/puppeteer.browserconnectoptions.targetfilter.md b/docs/api/puppeteer.browserconnectoptions.targetfilter.md deleted file mode 100644 index 14c4ea4e559c2..0000000000000 --- a/docs/api/puppeteer.browserconnectoptions.targetfilter.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: BrowserConnectOptions.targetFilter ---- - -# BrowserConnectOptions.targetFilter property - -Callback to decide if Puppeteer should connect to a given target or not. - -#### Signature: - -```typescript -interface BrowserConnectOptions { - targetFilter?: TargetFilterCallback; -} -``` diff --git a/docs/api/puppeteer.browsercontext.id.md b/docs/api/puppeteer.browsercontext.id.md deleted file mode 100644 index 9c095cc05842d..0000000000000 --- a/docs/api/puppeteer.browsercontext.id.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: BrowserContext.id ---- - -# BrowserContext.id property - -#### Signature: - -```typescript -class BrowserContext { - get id(): string | undefined; -} -``` diff --git a/docs/api/puppeteer.browsercontext.md b/docs/api/puppeteer.browsercontext.md index 51d3d60049b02..4443ba2830710 100644 --- a/docs/api/puppeteer.browsercontext.md +++ b/docs/api/puppeteer.browsercontext.md @@ -39,9 +39,9 @@ await context.close(); ## Properties -| Property | Modifiers | Type | Description | -| -------------------------------------- | --------------------- | ------------------- | ----------- | -| [id](./puppeteer.browsercontext.id.md) | readonly | string \| undefined | | +| Property | Modifiers | Type | Description | +| -------- | --------------------- | ------------------- | ----------- | +| id | readonly | string \| undefined | | ## Methods diff --git a/docs/api/puppeteer.browsercontextoptions.md b/docs/api/puppeteer.browsercontextoptions.md index 25436a1b13701..27754f3f0a6f4 100644 --- a/docs/api/puppeteer.browsercontextoptions.md +++ b/docs/api/puppeteer.browsercontextoptions.md @@ -14,7 +14,7 @@ export interface BrowserContextOptions ## Properties -| Property | Modifiers | Type | Description | Default | -| ------------------------------------------------------------------------ | --------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ------- | -| [proxyBypassList?](./puppeteer.browsercontextoptions.proxybypasslist.md) | | string\[\] | _(Optional)_ Bypass the proxy for the given list of hosts. | | -| [proxyServer?](./puppeteer.browsercontextoptions.proxyserver.md) | | string | _(Optional)_ Proxy server with optional port to use for all requests. Username and password can be set in Page.authenticate. | | +| Property | Modifiers | Type | Description | Default | +| --------------- | --------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------- | ------- | +| proxyBypassList | optional | string\[\] | Bypass the proxy for the given list of hosts. | | +| proxyServer | optional | string | Proxy server with optional port to use for all requests. Username and password can be set in Page.authenticate. | | diff --git a/docs/api/puppeteer.browsercontextoptions.proxybypasslist.md b/docs/api/puppeteer.browsercontextoptions.proxybypasslist.md deleted file mode 100644 index 54ec8d2a62232..0000000000000 --- a/docs/api/puppeteer.browsercontextoptions.proxybypasslist.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: BrowserContextOptions.proxyBypassList ---- - -# BrowserContextOptions.proxyBypassList property - -Bypass the proxy for the given list of hosts. - -#### Signature: - -```typescript -interface BrowserContextOptions { - proxyBypassList?: string[]; -} -``` diff --git a/docs/api/puppeteer.browsercontextoptions.proxyserver.md b/docs/api/puppeteer.browsercontextoptions.proxyserver.md deleted file mode 100644 index 5c90d0059c196..0000000000000 --- a/docs/api/puppeteer.browsercontextoptions.proxyserver.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: BrowserContextOptions.proxyServer ---- - -# BrowserContextOptions.proxyServer property - -Proxy server with optional port to use for all requests. Username and password can be set in `Page.authenticate`. - -#### Signature: - -```typescript -interface BrowserContextOptions { - proxyServer?: string; -} -``` diff --git a/docs/api/puppeteer.browseremittedevents.md b/docs/api/puppeteer.browseremittedevents.md index 8d567a6f68634..e1c1eedf4e2a0 100644 --- a/docs/api/puppeteer.browseremittedevents.md +++ b/docs/api/puppeteer.browseremittedevents.md @@ -16,7 +16,7 @@ export declare const enum BrowserEmittedEvents | Member | Value | Description | | --------------- | ---------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| Disconnected | "disconnected" |

Emitted when Puppeteer gets disconnected from the Chromium instance. This might happen because of one of the following:

- Chromium is closed or crashed

- The [browser.disconnect](./puppeteer.browser.disconnect.md) method was called.

| +| Disconnected | "disconnected" |

Emitted when Puppeteer gets disconnected from the browser instance. This might happen because of one of the following:

- browser is closed or crashed

- The [browser.disconnect](./puppeteer.browser.disconnect.md) method was called.

| | TargetChanged | "targetchanged" | Emitted when the url of a target changes. Contains a [Target](./puppeteer.target.md) instance. | | TargetCreated | "targetcreated" |

Emitted when a target is created, for example when a new page is opened by [window.open](https://developer.mozilla.org/en-US/docs/Web/API/Window/open) or by [browser.newPage](./puppeteer.browser.newpage.md)

Contains a [Target](./puppeteer.target.md) instance.

| | TargetDestroyed | "targetdestroyed" | Emitted when a target is destroyed, for example when a page is closed. Contains a [Target](./puppeteer.target.md) instance. | diff --git a/docs/api/puppeteer.browserfetcher._constructor_.md b/docs/api/puppeteer.browserfetcher._constructor_.md deleted file mode 100644 index 600a5831e7e05..0000000000000 --- a/docs/api/puppeteer.browserfetcher._constructor_.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -sidebar_label: BrowserFetcher.(constructor) ---- - -# BrowserFetcher.(constructor) - -Constructs a browser fetcher for the given options. - -#### Signature: - -```typescript -class BrowserFetcher { - constructor(options: BrowserFetcherOptions); -} -``` - -## Parameters - -| Parameter | Type | Description | -| --------- | ------------------------------------------------------------- | ----------- | -| options | [BrowserFetcherOptions](./puppeteer.browserfetcheroptions.md) | | diff --git a/docs/api/puppeteer.browserfetcher.candownload.md b/docs/api/puppeteer.browserfetcher.candownload.md deleted file mode 100644 index 33422c7dadda5..0000000000000 --- a/docs/api/puppeteer.browserfetcher.candownload.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -sidebar_label: BrowserFetcher.canDownload ---- - -# BrowserFetcher.canDownload() method - -Initiates a HEAD request to check if the revision is available. - -#### Signature: - -```typescript -class BrowserFetcher { - canDownload(revision: string): Promise; -} -``` - -## Parameters - -| Parameter | Type | Description | -| --------- | ------ | --------------------------------------- | -| revision | string | The revision to check availability for. | - -**Returns:** - -Promise<boolean> - -A promise that resolves to `true` if the revision could be downloaded from the host. - -## Remarks - -This method is affected by the current `product`. diff --git a/docs/api/puppeteer.browserfetcher.download.md b/docs/api/puppeteer.browserfetcher.download.md deleted file mode 100644 index 740a4f202c76f..0000000000000 --- a/docs/api/puppeteer.browserfetcher.download.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -sidebar_label: BrowserFetcher.download ---- - -# BrowserFetcher.download() method - -Initiates a GET request to download the revision from the host. - -#### Signature: - -```typescript -class BrowserFetcher { - download( - revision: string, - progressCallback?: (x: number, y: number) => void - ): Promise; -} -``` - -## Parameters - -| Parameter | Type | Description | -| ---------------- | --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | -| revision | string | The revision to download. | -| progressCallback | (x: number, y: number) => void | _(Optional)_ A function that will be called with two arguments: How many bytes have been downloaded and the total number of bytes of the download. | - -**Returns:** - -Promise<[BrowserFetcherRevisionInfo](./puppeteer.browserfetcherrevisioninfo.md) \| undefined> - -A promise with revision information when the revision is downloaded and extracted. - -## Remarks - -This method is affected by the current `product`. diff --git a/docs/api/puppeteer.browserfetcher.host.md b/docs/api/puppeteer.browserfetcher.host.md deleted file mode 100644 index 0ecfeaf7c18eb..0000000000000 --- a/docs/api/puppeteer.browserfetcher.host.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: BrowserFetcher.host ---- - -# BrowserFetcher.host() method - -#### Signature: - -```typescript -class BrowserFetcher { - host(): string; -} -``` - -**Returns:** - -string - -The download host being used. diff --git a/docs/api/puppeteer.browserfetcher.localrevisions.md b/docs/api/puppeteer.browserfetcher.localrevisions.md deleted file mode 100644 index a2a3908726501..0000000000000 --- a/docs/api/puppeteer.browserfetcher.localrevisions.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -sidebar_label: BrowserFetcher.localRevisions ---- - -# BrowserFetcher.localRevisions() method - -#### Signature: - -```typescript -class BrowserFetcher { - localRevisions(): string[]; -} -``` - -**Returns:** - -string\[\] - -A list of all revision strings (for the current `product`) available locally on disk. - -## Remarks - -This method is affected by the current `product`. diff --git a/docs/api/puppeteer.browserfetcher.md b/docs/api/puppeteer.browserfetcher.md deleted file mode 100644 index 41441849784fc..0000000000000 --- a/docs/api/puppeteer.browserfetcher.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -sidebar_label: BrowserFetcher ---- - -# BrowserFetcher class - -BrowserFetcher can download and manage different versions of Chromium and Firefox. - -#### Signature: - -```typescript -export declare class BrowserFetcher -``` - -## Remarks - -BrowserFetcher is not designed to work concurrently with other instances of BrowserFetcher that share the same downloads directory. - -## Example - -An example of using BrowserFetcher to download a specific version of Chromium and running Puppeteer against it: - -```ts -const browserFetcher = new BrowserFetcher({path: 'path/to/download/folder'}); -const revisionInfo = await browserFetcher.download('533271'); -const browser = await puppeteer.launch({ - executablePath: revisionInfo.executablePath, -}); -``` - -## Constructors - -| Constructor | Modifiers | Description | -| --------------------------------------------------------------------- | --------- | --------------------------------------------------- | -| [(constructor)(options)](./puppeteer.browserfetcher._constructor_.md) | | Constructs a browser fetcher for the given options. | - -## Methods - -| Method | Modifiers | Description | -| ------------------------------------------------------------------------------ | --------- | --------------------------------------------------------------- | -| [canDownload(revision)](./puppeteer.browserfetcher.candownload.md) | | Initiates a HEAD request to check if the revision is available. | -| [download(revision, progressCallback)](./puppeteer.browserfetcher.download.md) | | Initiates a GET request to download the revision from the host. | -| [host()](./puppeteer.browserfetcher.host.md) | | | -| [localRevisions()](./puppeteer.browserfetcher.localrevisions.md) | | | -| [platform()](./puppeteer.browserfetcher.platform.md) | | | -| [product()](./puppeteer.browserfetcher.product.md) | | | -| [remove(revision)](./puppeteer.browserfetcher.remove.md) | | | -| [revisionInfo(revision)](./puppeteer.browserfetcher.revisioninfo.md) | | | diff --git a/docs/api/puppeteer.browserfetcher.platform.md b/docs/api/puppeteer.browserfetcher.platform.md deleted file mode 100644 index 9f3d8f74724fa..0000000000000 --- a/docs/api/puppeteer.browserfetcher.platform.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: BrowserFetcher.platform ---- - -# BrowserFetcher.platform() method - -#### Signature: - -```typescript -class BrowserFetcher { - platform(): Platform; -} -``` - -**Returns:** - -[Platform](./puppeteer.platform.md) - -Returns the current `Platform`, which is one of `mac`, `linux`, `win32` or `win64`. diff --git a/docs/api/puppeteer.browserfetcher.product.md b/docs/api/puppeteer.browserfetcher.product.md deleted file mode 100644 index 512f603461b2a..0000000000000 --- a/docs/api/puppeteer.browserfetcher.product.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: BrowserFetcher.product ---- - -# BrowserFetcher.product() method - -#### Signature: - -```typescript -class BrowserFetcher { - product(): Product; -} -``` - -**Returns:** - -[Product](./puppeteer.product.md) - -Returns the current `Product`, which is one of `chrome` or `firefox`. diff --git a/docs/api/puppeteer.browserfetcher.remove.md b/docs/api/puppeteer.browserfetcher.remove.md deleted file mode 100644 index 87237b757259a..0000000000000 --- a/docs/api/puppeteer.browserfetcher.remove.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -sidebar_label: BrowserFetcher.remove ---- - -# BrowserFetcher.remove() method - -#### Signature: - -```typescript -class BrowserFetcher { - remove(revision: string): Promise; -} -``` - -## Parameters - -| Parameter | Type | Description | -| --------- | ------ | ---------------------------------------------------------- | -| revision | string | A revision to remove for the current product. | - -**Returns:** - -Promise<void> - -A promise that resolves when the revision has been removed or throws if the revision has not been downloaded. - -## Remarks - -This method is affected by the current `product`. diff --git a/docs/api/puppeteer.browserfetcher.revisioninfo.md b/docs/api/puppeteer.browserfetcher.revisioninfo.md deleted file mode 100644 index 0e3ef69869373..0000000000000 --- a/docs/api/puppeteer.browserfetcher.revisioninfo.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -sidebar_label: BrowserFetcher.revisionInfo ---- - -# BrowserFetcher.revisionInfo() method - -#### Signature: - -```typescript -class BrowserFetcher { - revisionInfo(revision: string): BrowserFetcherRevisionInfo; -} -``` - -## Parameters - -| Parameter | Type | Description | -| --------- | ------ | ----------------------------- | -| revision | string | The revision to get info for. | - -**Returns:** - -[BrowserFetcherRevisionInfo](./puppeteer.browserfetcherrevisioninfo.md) - -The revision info for the given revision. diff --git a/docs/api/puppeteer.browserfetcheroptions.host.md b/docs/api/puppeteer.browserfetcheroptions.host.md deleted file mode 100644 index df491b7caddeb..0000000000000 --- a/docs/api/puppeteer.browserfetcheroptions.host.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -sidebar_label: BrowserFetcherOptions.host ---- - -# BrowserFetcherOptions.host property - -Determines the host that will be used for downloading. - -#### Signature: - -```typescript -interface BrowserFetcherOptions { - host?: string; -} -``` - -#### Default value: - -Either - -- https://storage.googleapis.com or - https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central diff --git a/docs/api/puppeteer.browserfetcheroptions.md b/docs/api/puppeteer.browserfetcheroptions.md deleted file mode 100644 index 01f3aef135eef..0000000000000 --- a/docs/api/puppeteer.browserfetcheroptions.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -sidebar_label: BrowserFetcherOptions ---- - -# BrowserFetcherOptions interface - -#### Signature: - -```typescript -export interface BrowserFetcherOptions -``` - -## Properties - -| Property | Modifiers | Type | Description | Default | -| ---------------------------------------------------------------------------- | --------- | ----------------------------------- | ------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -| [host?](./puppeteer.browserfetcheroptions.host.md) | | string | _(Optional)_ Determines the host that will be used for downloading. |

Either

- https://storage.googleapis.com or - https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central

| -| [path](./puppeteer.browserfetcheroptions.path.md) | | string | Determines the path to download browsers to. | | -| [platform?](./puppeteer.browserfetcheroptions.platform.md) | | [Platform](./puppeteer.platform.md) | _(Optional)_ Determines which platform the browser will be suited for. | Auto-detected. | -| [product?](./puppeteer.browserfetcheroptions.product.md) | | 'chrome' \| 'firefox' | _(Optional)_ Determines which product the [BrowserFetcher](./puppeteer.browserfetcher.md) is for. | "chrome". | -| [useMacOSARMBinary?](./puppeteer.browserfetcheroptions.usemacosarmbinary.md) | | boolean | _(Optional)_ Enables the use of the Chromium binary for macOS ARM. | | diff --git a/docs/api/puppeteer.browserfetcheroptions.path.md b/docs/api/puppeteer.browserfetcheroptions.path.md deleted file mode 100644 index 80f0297a4da39..0000000000000 --- a/docs/api/puppeteer.browserfetcheroptions.path.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: BrowserFetcherOptions.path ---- - -# BrowserFetcherOptions.path property - -Determines the path to download browsers to. - -#### Signature: - -```typescript -interface BrowserFetcherOptions { - path: string; -} -``` diff --git a/docs/api/puppeteer.browserfetcheroptions.platform.md b/docs/api/puppeteer.browserfetcheroptions.platform.md deleted file mode 100644 index 118785d3cc26c..0000000000000 --- a/docs/api/puppeteer.browserfetcheroptions.platform.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: BrowserFetcherOptions.platform ---- - -# BrowserFetcherOptions.platform property - -Determines which platform the browser will be suited for. - -#### Signature: - -```typescript -interface BrowserFetcherOptions { - platform?: Platform; -} -``` - -#### Default value: - -Auto-detected. diff --git a/docs/api/puppeteer.browserfetcheroptions.product.md b/docs/api/puppeteer.browserfetcheroptions.product.md deleted file mode 100644 index c2920ab2422e3..0000000000000 --- a/docs/api/puppeteer.browserfetcheroptions.product.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: BrowserFetcherOptions.product ---- - -# BrowserFetcherOptions.product property - -Determines which product the [BrowserFetcher](./puppeteer.browserfetcher.md) is for. - -#### Signature: - -```typescript -interface BrowserFetcherOptions { - product?: 'chrome' | 'firefox'; -} -``` - -#### Default value: - -`"chrome"`. diff --git a/docs/api/puppeteer.browserfetcheroptions.usemacosarmbinary.md b/docs/api/puppeteer.browserfetcheroptions.usemacosarmbinary.md deleted file mode 100644 index 9bd7e34f1fcf2..0000000000000 --- a/docs/api/puppeteer.browserfetcheroptions.usemacosarmbinary.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: BrowserFetcherOptions.useMacOSARMBinary ---- - -# BrowserFetcherOptions.useMacOSARMBinary property - -Enables the use of the Chromium binary for macOS ARM. - -#### Signature: - -```typescript -interface BrowserFetcherOptions { - useMacOSARMBinary?: boolean; -} -``` diff --git a/docs/api/puppeteer.browserfetcherrevisioninfo.executablepath.md b/docs/api/puppeteer.browserfetcherrevisioninfo.executablepath.md deleted file mode 100644 index 51975869acea1..0000000000000 --- a/docs/api/puppeteer.browserfetcherrevisioninfo.executablepath.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: BrowserFetcherRevisionInfo.executablePath ---- - -# BrowserFetcherRevisionInfo.executablePath property - -#### Signature: - -```typescript -interface BrowserFetcherRevisionInfo { - executablePath: string; -} -``` diff --git a/docs/api/puppeteer.browserfetcherrevisioninfo.folderpath.md b/docs/api/puppeteer.browserfetcherrevisioninfo.folderpath.md deleted file mode 100644 index 7bf3266b57641..0000000000000 --- a/docs/api/puppeteer.browserfetcherrevisioninfo.folderpath.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: BrowserFetcherRevisionInfo.folderPath ---- - -# BrowserFetcherRevisionInfo.folderPath property - -#### Signature: - -```typescript -interface BrowserFetcherRevisionInfo { - folderPath: string; -} -``` diff --git a/docs/api/puppeteer.browserfetcherrevisioninfo.local.md b/docs/api/puppeteer.browserfetcherrevisioninfo.local.md deleted file mode 100644 index b62b4f5107321..0000000000000 --- a/docs/api/puppeteer.browserfetcherrevisioninfo.local.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: BrowserFetcherRevisionInfo.local ---- - -# BrowserFetcherRevisionInfo.local property - -#### Signature: - -```typescript -interface BrowserFetcherRevisionInfo { - local: boolean; -} -``` diff --git a/docs/api/puppeteer.browserfetcherrevisioninfo.md b/docs/api/puppeteer.browserfetcherrevisioninfo.md deleted file mode 100644 index 1eb8d4ea71125..0000000000000 --- a/docs/api/puppeteer.browserfetcherrevisioninfo.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -sidebar_label: BrowserFetcherRevisionInfo ---- - -# BrowserFetcherRevisionInfo interface - -#### Signature: - -```typescript -export interface BrowserFetcherRevisionInfo -``` - -## Properties - -| Property | Modifiers | Type | Description | Default | -| -------------------------------------------------------------------------- | --------- | ------- | ----------- | ------- | -| [executablePath](./puppeteer.browserfetcherrevisioninfo.executablepath.md) | | string | | | -| [folderPath](./puppeteer.browserfetcherrevisioninfo.folderpath.md) | | string | | | -| [local](./puppeteer.browserfetcherrevisioninfo.local.md) | | boolean | | | -| [product](./puppeteer.browserfetcherrevisioninfo.product.md) | | string | | | -| [revision](./puppeteer.browserfetcherrevisioninfo.revision.md) | | string | | | -| [url](./puppeteer.browserfetcherrevisioninfo.url.md) | | string | | | diff --git a/docs/api/puppeteer.browserfetcherrevisioninfo.product.md b/docs/api/puppeteer.browserfetcherrevisioninfo.product.md deleted file mode 100644 index 62f778cbaa776..0000000000000 --- a/docs/api/puppeteer.browserfetcherrevisioninfo.product.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: BrowserFetcherRevisionInfo.product ---- - -# BrowserFetcherRevisionInfo.product property - -#### Signature: - -```typescript -interface BrowserFetcherRevisionInfo { - product: string; -} -``` diff --git a/docs/api/puppeteer.browserfetcherrevisioninfo.revision.md b/docs/api/puppeteer.browserfetcherrevisioninfo.revision.md deleted file mode 100644 index 1577c8cd8c959..0000000000000 --- a/docs/api/puppeteer.browserfetcherrevisioninfo.revision.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: BrowserFetcherRevisionInfo.revision ---- - -# BrowserFetcherRevisionInfo.revision property - -#### Signature: - -```typescript -interface BrowserFetcherRevisionInfo { - revision: string; -} -``` diff --git a/docs/api/puppeteer.browserfetcherrevisioninfo.url.md b/docs/api/puppeteer.browserfetcherrevisioninfo.url.md deleted file mode 100644 index 4d221cbc89c2e..0000000000000 --- a/docs/api/puppeteer.browserfetcherrevisioninfo.url.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: BrowserFetcherRevisionInfo.url ---- - -# BrowserFetcherRevisionInfo.url property - -#### Signature: - -```typescript -interface BrowserFetcherRevisionInfo { - url: string; -} -``` diff --git a/docs/api/puppeteer.browserlaunchargumentoptions.args.md b/docs/api/puppeteer.browserlaunchargumentoptions.args.md deleted file mode 100644 index 7fded28430b30..0000000000000 --- a/docs/api/puppeteer.browserlaunchargumentoptions.args.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: BrowserLaunchArgumentOptions.args ---- - -# BrowserLaunchArgumentOptions.args property - -Additional command line arguments to pass to the browser instance. - -#### Signature: - -```typescript -interface BrowserLaunchArgumentOptions { - args?: string[]; -} -``` diff --git a/docs/api/puppeteer.browserlaunchargumentoptions.debuggingport.md b/docs/api/puppeteer.browserlaunchargumentoptions.debuggingport.md deleted file mode 100644 index 5b9affa82da66..0000000000000 --- a/docs/api/puppeteer.browserlaunchargumentoptions.debuggingport.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: BrowserLaunchArgumentOptions.debuggingPort ---- - -# BrowserLaunchArgumentOptions.debuggingPort property - -#### Signature: - -```typescript -interface BrowserLaunchArgumentOptions { - debuggingPort?: number; -} -``` diff --git a/docs/api/puppeteer.browserlaunchargumentoptions.devtools.md b/docs/api/puppeteer.browserlaunchargumentoptions.devtools.md deleted file mode 100644 index eb8731c50e836..0000000000000 --- a/docs/api/puppeteer.browserlaunchargumentoptions.devtools.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: BrowserLaunchArgumentOptions.devtools ---- - -# BrowserLaunchArgumentOptions.devtools property - -Whether to auto-open a DevTools panel for each tab. If this is set to `true`, then `headless` will be forced to `false`. - -#### Signature: - -```typescript -interface BrowserLaunchArgumentOptions { - devtools?: boolean; -} -``` - -#### Default value: - -`false` diff --git a/docs/api/puppeteer.browserlaunchargumentoptions.headless.md b/docs/api/puppeteer.browserlaunchargumentoptions.headless.md deleted file mode 100644 index 15fc7845bea95..0000000000000 --- a/docs/api/puppeteer.browserlaunchargumentoptions.headless.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: BrowserLaunchArgumentOptions.headless ---- - -# BrowserLaunchArgumentOptions.headless property - -Whether to run the browser in headless mode. - -#### Signature: - -```typescript -interface BrowserLaunchArgumentOptions { - headless?: boolean | 'new'; -} -``` - -#### Default value: - -true diff --git a/docs/api/puppeteer.browserlaunchargumentoptions.md b/docs/api/puppeteer.browserlaunchargumentoptions.md index 8ef7a67809a30..70daff25704f4 100644 --- a/docs/api/puppeteer.browserlaunchargumentoptions.md +++ b/docs/api/puppeteer.browserlaunchargumentoptions.md @@ -14,10 +14,10 @@ export interface BrowserLaunchArgumentOptions ## Properties -| Property | Modifiers | Type | Description | Default | -| --------------------------------------------------------------------------- | --------- | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | -| [args?](./puppeteer.browserlaunchargumentoptions.args.md) | | string\[\] | _(Optional)_ Additional command line arguments to pass to the browser instance. | | -| [debuggingPort?](./puppeteer.browserlaunchargumentoptions.debuggingport.md) | | number | _(Optional)_ | | -| [devtools?](./puppeteer.browserlaunchargumentoptions.devtools.md) | | boolean | _(Optional)_ Whether to auto-open a DevTools panel for each tab. If this is set to true, then headless will be forced to false. | false | -| [headless?](./puppeteer.browserlaunchargumentoptions.headless.md) | | boolean \| 'new' | _(Optional)_ Whether to run the browser in headless mode. | true | -| [userDataDir?](./puppeteer.browserlaunchargumentoptions.userdatadir.md) | | string | _(Optional)_ Path to a user data directory. [see the Chromium docs](https://chromium.googlesource.com/chromium/src/+/refs/heads/main/docs/user_data_dir.md) for more info. | | +| Property | Modifiers | Type | Description | Default | +| ------------- | --------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | +| args | optional | string\[\] | Additional command line arguments to pass to the browser instance. | | +| debuggingPort | optional | number | Specify the debugging port number to use | | +| devtools | optional | boolean | Whether to auto-open a DevTools panel for each tab. If this is set to true, then headless will be forced to false. | false | +| headless | optional | boolean \| 'new' | Whether to run the browser in headless mode. | true | +| userDataDir | optional | string | Path to a user data directory. [see the Chromium docs](https://chromium.googlesource.com/chromium/src/+/refs/heads/main/docs/user_data_dir.md) for more info. | | diff --git a/docs/api/puppeteer.browserlaunchargumentoptions.userdatadir.md b/docs/api/puppeteer.browserlaunchargumentoptions.userdatadir.md deleted file mode 100644 index a4051751cfffd..0000000000000 --- a/docs/api/puppeteer.browserlaunchargumentoptions.userdatadir.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: BrowserLaunchArgumentOptions.userDataDir ---- - -# BrowserLaunchArgumentOptions.userDataDir property - -Path to a user data directory. [see the Chromium docs](https://chromium.googlesource.com/chromium/src/+/refs/heads/main/docs/user_data_dir.md) for more info. - -#### Signature: - -```typescript -interface BrowserLaunchArgumentOptions { - userDataDir?: string; -} -``` diff --git a/docs/api/puppeteer.cdpsessiononmessageobject.error.md b/docs/api/puppeteer.cdpsessiononmessageobject.error.md deleted file mode 100644 index 61fbebe71529a..0000000000000 --- a/docs/api/puppeteer.cdpsessiononmessageobject.error.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -sidebar_label: CDPSessionOnMessageObject.error ---- - -# CDPSessionOnMessageObject.error property - -#### Signature: - -```typescript -interface CDPSessionOnMessageObject { - error: { - message: string; - data: any; - code: number; - }; -} -``` diff --git a/docs/api/puppeteer.cdpsessiononmessageobject.id.md b/docs/api/puppeteer.cdpsessiononmessageobject.id.md deleted file mode 100644 index 1316773713104..0000000000000 --- a/docs/api/puppeteer.cdpsessiononmessageobject.id.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: CDPSessionOnMessageObject.id ---- - -# CDPSessionOnMessageObject.id property - -#### Signature: - -```typescript -interface CDPSessionOnMessageObject { - id?: number; -} -``` diff --git a/docs/api/puppeteer.cdpsessiononmessageobject.md b/docs/api/puppeteer.cdpsessiononmessageobject.md deleted file mode 100644 index 8cb169d6d73b6..0000000000000 --- a/docs/api/puppeteer.cdpsessiononmessageobject.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -sidebar_label: CDPSessionOnMessageObject ---- - -# CDPSessionOnMessageObject interface - -#### Signature: - -```typescript -export interface CDPSessionOnMessageObject -``` - -## Properties - -| Property | Modifiers | Type | Description | Default | -| ---------------------------------------------------------- | --------- | --------------------------------------------- | ------------ | ------- | -| [error](./puppeteer.cdpsessiononmessageobject.error.md) | | { message: string; data: any; code: number; } | | | -| [id?](./puppeteer.cdpsessiononmessageobject.id.md) | | number | _(Optional)_ | | -| [method](./puppeteer.cdpsessiononmessageobject.method.md) | | string | | | -| [params](./puppeteer.cdpsessiononmessageobject.params.md) | | Record<string, unknown> | | | -| [result?](./puppeteer.cdpsessiononmessageobject.result.md) | | any | _(Optional)_ | | diff --git a/docs/api/puppeteer.cdpsessiononmessageobject.method.md b/docs/api/puppeteer.cdpsessiononmessageobject.method.md deleted file mode 100644 index f1d56bf5fc56c..0000000000000 --- a/docs/api/puppeteer.cdpsessiononmessageobject.method.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: CDPSessionOnMessageObject.method ---- - -# CDPSessionOnMessageObject.method property - -#### Signature: - -```typescript -interface CDPSessionOnMessageObject { - method: string; -} -``` diff --git a/docs/api/puppeteer.cdpsessiononmessageobject.params.md b/docs/api/puppeteer.cdpsessiononmessageobject.params.md deleted file mode 100644 index bef12d9f19b2b..0000000000000 --- a/docs/api/puppeteer.cdpsessiononmessageobject.params.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: CDPSessionOnMessageObject.params ---- - -# CDPSessionOnMessageObject.params property - -#### Signature: - -```typescript -interface CDPSessionOnMessageObject { - params: Record; -} -``` diff --git a/docs/api/puppeteer.cdpsessiononmessageobject.result.md b/docs/api/puppeteer.cdpsessiononmessageobject.result.md deleted file mode 100644 index 788d726a3bb88..0000000000000 --- a/docs/api/puppeteer.cdpsessiononmessageobject.result.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: CDPSessionOnMessageObject.result ---- - -# CDPSessionOnMessageObject.result property - -#### Signature: - -```typescript -interface CDPSessionOnMessageObject { - result?: any; -} -``` diff --git a/docs/api/puppeteer.clickoptions.button.md b/docs/api/puppeteer.clickoptions.button.md deleted file mode 100644 index a68cd2af720d4..0000000000000 --- a/docs/api/puppeteer.clickoptions.button.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -sidebar_label: ClickOptions.button ---- - -# ClickOptions.button property - -#### Signature: - -```typescript -interface ClickOptions { - button?: MouseButton; -} -``` - -#### Default value: - -'left' diff --git a/docs/api/puppeteer.clickoptions.clickcount.md b/docs/api/puppeteer.clickoptions.clickcount.md deleted file mode 100644 index bb45f6b239627..0000000000000 --- a/docs/api/puppeteer.clickoptions.clickcount.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -sidebar_label: ClickOptions.clickCount ---- - -# ClickOptions.clickCount property - -#### Signature: - -```typescript -interface ClickOptions { - clickCount?: number; -} -``` - -#### Default value: - -1 diff --git a/docs/api/puppeteer.clickoptions.delay.md b/docs/api/puppeteer.clickoptions.delay.md deleted file mode 100644 index bdf371b667261..0000000000000 --- a/docs/api/puppeteer.clickoptions.delay.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: ClickOptions.delay ---- - -# ClickOptions.delay property - -Time to wait between `mousedown` and `mouseup` in milliseconds. - -#### Signature: - -```typescript -interface ClickOptions { - delay?: number; -} -``` - -#### Default value: - -0 diff --git a/docs/api/puppeteer.clickoptions.md b/docs/api/puppeteer.clickoptions.md index c35889c1d0f2c..83299f55c4477 100644 --- a/docs/api/puppeteer.clickoptions.md +++ b/docs/api/puppeteer.clickoptions.md @@ -7,14 +7,13 @@ sidebar_label: ClickOptions #### Signature: ```typescript -export interface ClickOptions +export interface ClickOptions extends MouseClickOptions ``` +**Extends:** [MouseClickOptions](./puppeteer.mouseclickoptions.md) + ## Properties -| Property | Modifiers | Type | Description | Default | -| ----------------------------------------------------- | --------- | ----------------------------------------- | -------------------------------------------------------------------------------------------------- | ------- | -| [button?](./puppeteer.clickoptions.button.md) | | [MouseButton](./puppeteer.mousebutton.md) | _(Optional)_ | 'left' | -| [clickCount?](./puppeteer.clickoptions.clickcount.md) | | number | _(Optional)_ | 1 | -| [delay?](./puppeteer.clickoptions.delay.md) | | number | _(Optional)_ Time to wait between mousedown and mouseup in milliseconds. | 0 | -| [offset?](./puppeteer.clickoptions.offset.md) | | [Offset](./puppeteer.offset.md) | _(Optional)_ Offset for the clickable point relative to the top-left corner of the border box. | | +| Property | Modifiers | Type | Description | Default | +| -------- | --------------------- | ------------------------------- | --------------------------------------------------------------------------------- | ------- | +| offset | optional | [Offset](./puppeteer.offset.md) | Offset for the clickable point relative to the top-left corner of the border box. | | diff --git a/docs/api/puppeteer.clickoptions.offset.md b/docs/api/puppeteer.clickoptions.offset.md deleted file mode 100644 index 8d4d36c144a1f..0000000000000 --- a/docs/api/puppeteer.clickoptions.offset.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: ClickOptions.offset ---- - -# ClickOptions.offset property - -Offset for the clickable point relative to the top-left corner of the border box. - -#### Signature: - -```typescript -interface ClickOptions { - offset?: Offset; -} -``` diff --git a/docs/api/puppeteer.commoneventemitter.addlistener.md b/docs/api/puppeteer.commoneventemitter.addlistener.md index e8282a856bd7d..7e2655b7a223f 100644 --- a/docs/api/puppeteer.commoneventemitter.addlistener.md +++ b/docs/api/puppeteer.commoneventemitter.addlistener.md @@ -8,7 +8,7 @@ sidebar_label: CommonEventEmitter.addListener ```typescript interface CommonEventEmitter { - addListener(event: EventType, handler: Handler): CommonEventEmitter; + addListener(event: EventType, handler: Handler): this; } ``` @@ -21,4 +21,4 @@ interface CommonEventEmitter { **Returns:** -[CommonEventEmitter](./puppeteer.commoneventemitter.md) +this diff --git a/docs/api/puppeteer.commoneventemitter.off.md b/docs/api/puppeteer.commoneventemitter.off.md index 06c667d67c926..75b80adb96580 100644 --- a/docs/api/puppeteer.commoneventemitter.off.md +++ b/docs/api/puppeteer.commoneventemitter.off.md @@ -8,7 +8,7 @@ sidebar_label: CommonEventEmitter.off ```typescript interface CommonEventEmitter { - off(event: EventType, handler: Handler): CommonEventEmitter; + off(event: EventType, handler: Handler): this; } ``` @@ -21,4 +21,4 @@ interface CommonEventEmitter { **Returns:** -[CommonEventEmitter](./puppeteer.commoneventemitter.md) +this diff --git a/docs/api/puppeteer.commoneventemitter.on.md b/docs/api/puppeteer.commoneventemitter.on.md index 0d4609e246a64..2c257f84e1a71 100644 --- a/docs/api/puppeteer.commoneventemitter.on.md +++ b/docs/api/puppeteer.commoneventemitter.on.md @@ -8,7 +8,7 @@ sidebar_label: CommonEventEmitter.on ```typescript interface CommonEventEmitter { - on(event: EventType, handler: Handler): CommonEventEmitter; + on(event: EventType, handler: Handler): this; } ``` @@ -21,4 +21,4 @@ interface CommonEventEmitter { **Returns:** -[CommonEventEmitter](./puppeteer.commoneventemitter.md) +this diff --git a/docs/api/puppeteer.commoneventemitter.once.md b/docs/api/puppeteer.commoneventemitter.once.md index d159579306479..73355af6f5c13 100644 --- a/docs/api/puppeteer.commoneventemitter.once.md +++ b/docs/api/puppeteer.commoneventemitter.once.md @@ -8,7 +8,7 @@ sidebar_label: CommonEventEmitter.once ```typescript interface CommonEventEmitter { - once(event: EventType, handler: Handler): CommonEventEmitter; + once(event: EventType, handler: Handler): this; } ``` @@ -21,4 +21,4 @@ interface CommonEventEmitter { **Returns:** -[CommonEventEmitter](./puppeteer.commoneventemitter.md) +this diff --git a/docs/api/puppeteer.commoneventemitter.removealllisteners.md b/docs/api/puppeteer.commoneventemitter.removealllisteners.md index d944b40d22a03..83b4cd7f34be2 100644 --- a/docs/api/puppeteer.commoneventemitter.removealllisteners.md +++ b/docs/api/puppeteer.commoneventemitter.removealllisteners.md @@ -8,7 +8,7 @@ sidebar_label: CommonEventEmitter.removeAllListeners ```typescript interface CommonEventEmitter { - removeAllListeners(event?: EventType): CommonEventEmitter; + removeAllListeners(event?: EventType): this; } ``` @@ -20,4 +20,4 @@ interface CommonEventEmitter { **Returns:** -[CommonEventEmitter](./puppeteer.commoneventemitter.md) +this diff --git a/docs/api/puppeteer.commoneventemitter.removelistener.md b/docs/api/puppeteer.commoneventemitter.removelistener.md index 379c3ab234f84..04ff12dffde9c 100644 --- a/docs/api/puppeteer.commoneventemitter.removelistener.md +++ b/docs/api/puppeteer.commoneventemitter.removelistener.md @@ -8,7 +8,7 @@ sidebar_label: CommonEventEmitter.removeListener ```typescript interface CommonEventEmitter { - removeListener(event: EventType, handler: Handler): CommonEventEmitter; + removeListener(event: EventType, handler: Handler): this; } ``` @@ -21,4 +21,4 @@ interface CommonEventEmitter { **Returns:** -[CommonEventEmitter](./puppeteer.commoneventemitter.md) +this diff --git a/docs/api/puppeteer.configuration.browserrevision.md b/docs/api/puppeteer.configuration.browserrevision.md deleted file mode 100644 index f5aae38f12550..0000000000000 --- a/docs/api/puppeteer.configuration.browserrevision.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -sidebar_label: Configuration.browserRevision ---- - -# Configuration.browserRevision property - -Specifies a certain version of the browser you'd like Puppeteer to use. - -Can be overridden by `PUPPETEER_BROWSER_REVISION`. - -See [puppeteer.launch](./puppeteer.puppeteernode.launch.md) on how executable path is inferred. - -#### Signature: - -```typescript -interface Configuration { - browserRevision?: string; -} -``` - -#### Default value: - -A compatible-revision of the browser. diff --git a/docs/api/puppeteer.configuration.cachedirectory.md b/docs/api/puppeteer.configuration.cachedirectory.md deleted file mode 100644 index 0d2f24614003b..0000000000000 --- a/docs/api/puppeteer.configuration.cachedirectory.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -sidebar_label: Configuration.cacheDirectory ---- - -# Configuration.cacheDirectory property - -Defines the directory to be used by Puppeteer for caching. - -Can be overridden by `PUPPETEER_CACHE_DIR`. - -#### Signature: - -```typescript -interface Configuration { - cacheDirectory?: string; -} -``` - -#### Default value: - -`path.join(os.homedir(), '.cache', 'puppeteer')` diff --git a/docs/api/puppeteer.configuration.defaultproduct.md b/docs/api/puppeteer.configuration.defaultproduct.md deleted file mode 100644 index e4bf2c2274904..0000000000000 --- a/docs/api/puppeteer.configuration.defaultproduct.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -sidebar_label: Configuration.defaultProduct ---- - -# Configuration.defaultProduct property - -Specifies which browser you'd like Puppeteer to use. - -Can be overridden by `PUPPETEER_PRODUCT`. - -#### Signature: - -```typescript -interface Configuration { - defaultProduct?: Product; -} -``` - -#### Default value: - -`'chrome'` diff --git a/docs/api/puppeteer.configuration.downloadhost.md b/docs/api/puppeteer.configuration.downloadhost.md deleted file mode 100644 index 9d58c5b6e0894..0000000000000 --- a/docs/api/puppeteer.configuration.downloadhost.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -sidebar_label: Configuration.downloadHost ---- - -# Configuration.downloadHost property - -Specifies the URL prefix that is used to download Chromium. - -Can be overridden by `PUPPETEER_DOWNLOAD_HOST`. - -#### Signature: - -```typescript -interface Configuration { - downloadHost?: string; -} -``` - -#### Default value: - -Either https://storage.googleapis.com or https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central, depending on the product. - -## Remarks - -This must include the protocol and may even need a path prefix. diff --git a/docs/api/puppeteer.configuration.downloadpath.md b/docs/api/puppeteer.configuration.downloadpath.md deleted file mode 100644 index 56a69c17c9594..0000000000000 --- a/docs/api/puppeteer.configuration.downloadpath.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -sidebar_label: Configuration.downloadPath ---- - -# Configuration.downloadPath property - -Specifies the path for the downloads folder. - -Can be overridden by `PUPPETEER_DOWNLOAD_PATH`. - -#### Signature: - -```typescript -interface Configuration { - downloadPath?: string; -} -``` - -#### Default value: - -`/` where `` is Puppeteer's cache directory and `` is the name of the browser. diff --git a/docs/api/puppeteer.configuration.executablepath.md b/docs/api/puppeteer.configuration.executablepath.md deleted file mode 100644 index 63fcb00116079..0000000000000 --- a/docs/api/puppeteer.configuration.executablepath.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -sidebar_label: Configuration.executablePath ---- - -# Configuration.executablePath property - -Specifies an executable path to be used in [puppeteer.launch](./puppeteer.puppeteernode.launch.md). - -Can be overridden by `PUPPETEER_EXECUTABLE_PATH`. - -#### Signature: - -```typescript -interface Configuration { - executablePath?: string; -} -``` - -#### Default value: - -Auto-computed. diff --git a/docs/api/puppeteer.configuration.experiments.md b/docs/api/puppeteer.configuration.experiments.md deleted file mode 100644 index 1c0ffe8d9f52b..0000000000000 --- a/docs/api/puppeteer.configuration.experiments.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: Configuration.experiments ---- - -# Configuration.experiments property - -Defines experimental options for Puppeteer. - -#### Signature: - -```typescript -interface Configuration { - experiments?: ExperimentsConfiguration; -} -``` diff --git a/docs/api/puppeteer.configuration.loglevel.md b/docs/api/puppeteer.configuration.loglevel.md deleted file mode 100644 index 8d79bc5647aa5..0000000000000 --- a/docs/api/puppeteer.configuration.loglevel.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -sidebar_label: Configuration.logLevel ---- - -# Configuration.logLevel property - -Tells Puppeteer to log at the given level. - -At the moment, any option silences logging. - -#### Signature: - -```typescript -interface Configuration { - logLevel?: 'silent' | 'error' | 'warn'; -} -``` - -#### Default value: - -`undefined` diff --git a/docs/api/puppeteer.configuration.md b/docs/api/puppeteer.configuration.md index 30d4e4db6cb75..c8a49caacc700 100644 --- a/docs/api/puppeteer.configuration.md +++ b/docs/api/puppeteer.configuration.md @@ -16,15 +16,15 @@ export interface Configuration ## Properties -| Property | Modifiers | Type | Description | Default | -| ---------------------------------------------------------------------- | --------- | ------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [browserRevision?](./puppeteer.configuration.browserrevision.md) | | string |

_(Optional)_ Specifies a certain version of the browser you'd like Puppeteer to use.

Can be overridden by PUPPETEER_BROWSER_REVISION.

See [puppeteer.launch](./puppeteer.puppeteernode.launch.md) on how executable path is inferred.

| A compatible-revision of the browser. | -| [cacheDirectory?](./puppeteer.configuration.cachedirectory.md) | | string |

_(Optional)_ Defines the directory to be used by Puppeteer for caching.

Can be overridden by PUPPETEER_CACHE_DIR.

| path.join(os.homedir(), '.cache', 'puppeteer') | -| [defaultProduct?](./puppeteer.configuration.defaultproduct.md) | | [Product](./puppeteer.product.md) |

_(Optional)_ Specifies which browser you'd like Puppeteer to use.

Can be overridden by PUPPETEER_PRODUCT.

| 'chrome' | -| [downloadHost?](./puppeteer.configuration.downloadhost.md) | | string |

_(Optional)_ Specifies the URL prefix that is used to download Chromium.

Can be overridden by PUPPETEER_DOWNLOAD_HOST.

| Either https://storage.googleapis.com or https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central, depending on the product. | -| [downloadPath?](./puppeteer.configuration.downloadpath.md) | | string |

_(Optional)_ Specifies the path for the downloads folder.

Can be overridden by PUPPETEER_DOWNLOAD_PATH.

| <cache>/<product> where <cache> is Puppeteer's cache directory and <product> is the name of the browser. | -| [executablePath?](./puppeteer.configuration.executablepath.md) | | string |

_(Optional)_ Specifies an executable path to be used in [puppeteer.launch](./puppeteer.puppeteernode.launch.md).

Can be overridden by PUPPETEER_EXECUTABLE_PATH.

| Auto-computed. | -| [experiments?](./puppeteer.configuration.experiments.md) | | [ExperimentsConfiguration](./puppeteer.experimentsconfiguration.md) | _(Optional)_ Defines experimental options for Puppeteer. | | -| [logLevel?](./puppeteer.configuration.loglevel.md) | | 'silent' \| 'error' \| 'warn' |

_(Optional)_ Tells Puppeteer to log at the given level.

At the moment, any option silences logging.

| undefined | -| [skipDownload?](./puppeteer.configuration.skipdownload.md) | | boolean |

_(Optional)_ Tells Puppeteer to not download during installation.

Can be overridden by PUPPETEER_SKIP_DOWNLOAD.

| | -| [temporaryDirectory?](./puppeteer.configuration.temporarydirectory.md) | | string |

_(Optional)_ Defines the directory to be used by Puppeteer for creating temporary files.

Can be overridden by PUPPETEER_TMP_DIR.

| os.tmpdir() | +| Property | Modifiers | Type | Description | Default | +| ------------------ | --------------------- | ------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| browserRevision | optional | string |

Specifies a certain version of the browser you'd like Puppeteer to use.

Can be overridden by PUPPETEER_BROWSER_REVISION.

See [puppeteer.launch](./puppeteer.puppeteernode.launch.md) on how executable path is inferred.

| A compatible-revision of the browser. | +| cacheDirectory | optional | string |

Defines the directory to be used by Puppeteer for caching.

Can be overridden by PUPPETEER_CACHE_DIR.

| path.join(os.homedir(), '.cache', 'puppeteer') | +| defaultProduct | optional | [Product](./puppeteer.product.md) |

Specifies which browser you'd like Puppeteer to use.

Can be overridden by PUPPETEER_PRODUCT.

| chrome | +| downloadBaseUrl | optional | string |

Specifies the URL prefix that is used to download the browser.

Can be overridden by PUPPETEER_DOWNLOAD_BASE_URL.

| Either https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing or https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central, depending on the product. | +| downloadPath | optional | string |

Specifies the path for the downloads folder.

Can be overridden by PUPPETEER_DOWNLOAD_PATH.

| <cacheDirectory> | +| executablePath | optional | string |

Specifies an executable path to be used in [puppeteer.launch](./puppeteer.puppeteernode.launch.md).

Can be overridden by PUPPETEER_EXECUTABLE_PATH.

| **Auto-computed.** | +| experiments | optional | [ExperimentsConfiguration](./puppeteer.experimentsconfiguration.md) | Defines experimental options for Puppeteer. | | +| logLevel | optional | 'silent' \| 'error' \| 'warn' | Tells Puppeteer to log at the given level. | warn | +| skipDownload | optional | boolean |

Tells Puppeteer to not download during installation.

Can be overridden by PUPPETEER_SKIP_DOWNLOAD.

| | +| temporaryDirectory | optional | string |

Defines the directory to be used by Puppeteer for creating temporary files.

Can be overridden by PUPPETEER_TMP_DIR.

| os.tmpdir() | diff --git a/docs/api/puppeteer.configuration.skipdownload.md b/docs/api/puppeteer.configuration.skipdownload.md deleted file mode 100644 index d9c4c09418b89..0000000000000 --- a/docs/api/puppeteer.configuration.skipdownload.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -sidebar_label: Configuration.skipDownload ---- - -# Configuration.skipDownload property - -Tells Puppeteer to not download during installation. - -Can be overridden by `PUPPETEER_SKIP_DOWNLOAD`. - -#### Signature: - -```typescript -interface Configuration { - skipDownload?: boolean; -} -``` diff --git a/docs/api/puppeteer.configuration.temporarydirectory.md b/docs/api/puppeteer.configuration.temporarydirectory.md deleted file mode 100644 index b1b130c14e6fc..0000000000000 --- a/docs/api/puppeteer.configuration.temporarydirectory.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -sidebar_label: Configuration.temporaryDirectory ---- - -# Configuration.temporaryDirectory property - -Defines the directory to be used by Puppeteer for creating temporary files. - -Can be overridden by `PUPPETEER_TMP_DIR`. - -#### Signature: - -```typescript -interface Configuration { - temporaryDirectory?: string; -} -``` - -#### Default value: - -`os.tmpdir()` diff --git a/docs/api/puppeteer.connection._constructor_.md b/docs/api/puppeteer.connection._constructor_.md index 544787b8e7505..914c3501578c0 100644 --- a/docs/api/puppeteer.connection._constructor_.md +++ b/docs/api/puppeteer.connection._constructor_.md @@ -10,7 +10,12 @@ Constructs a new instance of the `Connection` class ```typescript class Connection { - constructor(url: string, transport: ConnectionTransport, delay?: number); + constructor( + url: string, + transport: ConnectionTransport, + delay?: number, + timeout?: number + ); } ``` @@ -21,3 +26,4 @@ class Connection { | url | string | | | transport | [ConnectionTransport](./puppeteer.connectiontransport.md) | | | delay | number | _(Optional)_ | +| timeout | number | _(Optional)_ | diff --git a/docs/api/puppeteer.connection.md b/docs/api/puppeteer.connection.md index 81ccbb479521c..3c16caca67bc4 100644 --- a/docs/api/puppeteer.connection.md +++ b/docs/api/puppeteer.connection.md @@ -14,9 +14,15 @@ export declare class Connection extends EventEmitter ## Constructors -| Constructor | Modifiers | Description | -| ------------------------------------------------------------------------------- | --------- | -------------------------------------------------------------- | -| [(constructor)(url, transport, delay)](./puppeteer.connection._constructor_.md) | | Constructs a new instance of the Connection class | +| Constructor | Modifiers | Description | +| ---------------------------------------------------------------------------------------- | --------- | -------------------------------------------------------------- | +| [(constructor)(url, transport, delay, timeout)](./puppeteer.connection._constructor_.md) | | Constructs a new instance of the Connection class | + +## Properties + +| Property | Modifiers | Type | Description | +| -------- | --------------------- | ------ | ----------- | +| timeout | readonly | number | | ## Methods diff --git a/docs/api/puppeteer.connectioncallback.error.md b/docs/api/puppeteer.connectioncallback.error.md deleted file mode 100644 index b14ea2cd23803..0000000000000 --- a/docs/api/puppeteer.connectioncallback.error.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: ConnectionCallback.error ---- - -# ConnectionCallback.error property - -#### Signature: - -```typescript -interface ConnectionCallback { - error: ProtocolError; -} -``` diff --git a/docs/api/puppeteer.connectioncallback.md b/docs/api/puppeteer.connectioncallback.md deleted file mode 100644 index 54d8d842cd0e5..0000000000000 --- a/docs/api/puppeteer.connectioncallback.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -sidebar_label: ConnectionCallback ---- - -# ConnectionCallback interface - -#### Signature: - -```typescript -export interface ConnectionCallback -``` - -## Properties - -| Property | Modifiers | Type | Description | Default | -| -------------------------------------------------- | --------- | --------------------------------------------- | ----------- | ------- | -| [error](./puppeteer.connectioncallback.error.md) | | [ProtocolError](./puppeteer.protocolerror.md) | | | -| [method](./puppeteer.connectioncallback.method.md) | | string | | | - -## Methods - -| Method | Description | -| ---------------------------------------------------------- | ----------- | -| [reject(args)](./puppeteer.connectioncallback.reject.md) | | -| [resolve(args)](./puppeteer.connectioncallback.resolve.md) | | diff --git a/docs/api/puppeteer.connectioncallback.method.md b/docs/api/puppeteer.connectioncallback.method.md deleted file mode 100644 index b2d3b7d80728b..0000000000000 --- a/docs/api/puppeteer.connectioncallback.method.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: ConnectionCallback.method ---- - -# ConnectionCallback.method property - -#### Signature: - -```typescript -interface ConnectionCallback { - method: string; -} -``` diff --git a/docs/api/puppeteer.connectioncallback.reject.md b/docs/api/puppeteer.connectioncallback.reject.md deleted file mode 100644 index 17c45c5e55909..0000000000000 --- a/docs/api/puppeteer.connectioncallback.reject.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -sidebar_label: ConnectionCallback.reject ---- - -# ConnectionCallback.reject() method - -#### Signature: - -```typescript -interface ConnectionCallback { - reject(args: unknown): void; -} -``` - -## Parameters - -| Parameter | Type | Description | -| --------- | ------- | ----------- | -| args | unknown | | - -**Returns:** - -void diff --git a/docs/api/puppeteer.connectioncallback.resolve.md b/docs/api/puppeteer.connectioncallback.resolve.md deleted file mode 100644 index 09aa208f4b30d..0000000000000 --- a/docs/api/puppeteer.connectioncallback.resolve.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -sidebar_label: ConnectionCallback.resolve ---- - -# ConnectionCallback.resolve() method - -#### Signature: - -```typescript -interface ConnectionCallback { - resolve(args: unknown): void; -} -``` - -## Parameters - -| Parameter | Type | Description | -| --------- | ------- | ----------- | -| args | unknown | | - -**Returns:** - -void diff --git a/docs/api/puppeteer.connectiontransport.md b/docs/api/puppeteer.connectiontransport.md index 5f0ac30d7c261..39c56a1760114 100644 --- a/docs/api/puppeteer.connectiontransport.md +++ b/docs/api/puppeteer.connectiontransport.md @@ -12,10 +12,10 @@ export interface ConnectionTransport ## Properties -| Property | Modifiers | Type | Description | Default | -| ---------------------------------------------------------- | --------- | ---------------------------- | ------------ | ------- | -| [onclose?](./puppeteer.connectiontransport.onclose.md) | | () => void | _(Optional)_ | | -| [onmessage?](./puppeteer.connectiontransport.onmessage.md) | | (message: string) => void | _(Optional)_ | | +| Property | Modifiers | Type | Description | Default | +| --------- | --------------------- | ---------------------------- | ----------- | ------- | +| onclose | optional | () => void | | | +| onmessage | optional | (message: string) => void | | | ## Methods diff --git a/docs/api/puppeteer.connectiontransport.onclose.md b/docs/api/puppeteer.connectiontransport.onclose.md deleted file mode 100644 index 983a0efd791e1..0000000000000 --- a/docs/api/puppeteer.connectiontransport.onclose.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: ConnectionTransport.onclose ---- - -# ConnectionTransport.onclose property - -#### Signature: - -```typescript -interface ConnectionTransport { - onclose?: () => void; -} -``` diff --git a/docs/api/puppeteer.connectiontransport.onmessage.md b/docs/api/puppeteer.connectiontransport.onmessage.md deleted file mode 100644 index f1e075f975f41..0000000000000 --- a/docs/api/puppeteer.connectiontransport.onmessage.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: ConnectionTransport.onmessage ---- - -# ConnectionTransport.onmessage property - -#### Signature: - -```typescript -interface ConnectionTransport { - onmessage?: (message: string) => void; -} -``` diff --git a/docs/api/puppeteer.connectoptions.browserurl.md b/docs/api/puppeteer.connectoptions.browserurl.md deleted file mode 100644 index a5c798b205b61..0000000000000 --- a/docs/api/puppeteer.connectoptions.browserurl.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: ConnectOptions.browserURL ---- - -# ConnectOptions.browserURL property - -#### Signature: - -```typescript -interface ConnectOptions { - browserURL?: string; -} -``` diff --git a/docs/api/puppeteer.connectoptions.browserwsendpoint.md b/docs/api/puppeteer.connectoptions.browserwsendpoint.md deleted file mode 100644 index fe62e7cf85bbc..0000000000000 --- a/docs/api/puppeteer.connectoptions.browserwsendpoint.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: ConnectOptions.browserWSEndpoint ---- - -# ConnectOptions.browserWSEndpoint property - -#### Signature: - -```typescript -interface ConnectOptions { - browserWSEndpoint?: string; -} -``` diff --git a/docs/api/puppeteer.connectoptions.headers.md b/docs/api/puppeteer.connectoptions.headers.md deleted file mode 100644 index 6971c6cc07646..0000000000000 --- a/docs/api/puppeteer.connectoptions.headers.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: ConnectOptions.headers ---- - -# ConnectOptions.headers property - -Headers to use for the web socket connection. - -#### Signature: - -```typescript -interface ConnectOptions { - headers?: Record; -} -``` - -## Remarks - -Only works in the Node.js environment. diff --git a/docs/api/puppeteer.connectoptions.md b/docs/api/puppeteer.connectoptions.md index d6076477b73c0..588370ee46933 100644 --- a/docs/api/puppeteer.connectoptions.md +++ b/docs/api/puppeteer.connectoptions.md @@ -14,9 +14,9 @@ export interface ConnectOptions extends BrowserConnectOptions ## Properties -| Property | Modifiers | Type | Description | Default | -| --------------------------------------------------------------------- | --------- | --------------------------------------------------------- | ---------------------------------------------------------- | ------- | -| [browserURL?](./puppeteer.connectoptions.browserurl.md) | | string | _(Optional)_ | | -| [browserWSEndpoint?](./puppeteer.connectoptions.browserwsendpoint.md) | | string | _(Optional)_ | | -| [headers?](./puppeteer.connectoptions.headers.md) | | Record<string, string> | _(Optional)_ Headers to use for the web socket connection. | | -| [transport?](./puppeteer.connectoptions.transport.md) | | [ConnectionTransport](./puppeteer.connectiontransport.md) | _(Optional)_ | | +| Property | Modifiers | Type | Description | Default | +| ----------------- | --------------------- | --------------------------------------------------------- | --------------------------------------------- | ------- | +| browserURL | optional | string | | | +| browserWSEndpoint | optional | string | | | +| headers | optional | Record<string, string> | Headers to use for the web socket connection. | | +| transport | optional | [ConnectionTransport](./puppeteer.connectiontransport.md) | | | diff --git a/docs/api/puppeteer.connectoptions.transport.md b/docs/api/puppeteer.connectoptions.transport.md deleted file mode 100644 index d251fb8cb9500..0000000000000 --- a/docs/api/puppeteer.connectoptions.transport.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: ConnectOptions.transport ---- - -# ConnectOptions.transport property - -#### Signature: - -```typescript -interface ConnectOptions { - transport?: ConnectionTransport; -} -``` diff --git a/docs/api/puppeteer.consolemessage.args.md b/docs/api/puppeteer.consolemessage.args.md index 565fd6bc53723..e10a90ee818ac 100644 --- a/docs/api/puppeteer.consolemessage.args.md +++ b/docs/api/puppeteer.consolemessage.args.md @@ -4,6 +4,8 @@ sidebar_label: ConsoleMessage.args # ConsoleMessage.args() method +An array of arguments passed to the console. + #### Signature: ```typescript @@ -15,5 +17,3 @@ class ConsoleMessage { **Returns:** [JSHandle](./puppeteer.jshandle.md)\[\] - -An array of arguments passed to the console. diff --git a/docs/api/puppeteer.consolemessage.location.md b/docs/api/puppeteer.consolemessage.location.md index d26c80b5e0008..f4696e1a070da 100644 --- a/docs/api/puppeteer.consolemessage.location.md +++ b/docs/api/puppeteer.consolemessage.location.md @@ -4,6 +4,8 @@ sidebar_label: ConsoleMessage.location # ConsoleMessage.location() method +The location of the console message. + #### Signature: ```typescript @@ -15,5 +17,3 @@ class ConsoleMessage { **Returns:** [ConsoleMessageLocation](./puppeteer.consolemessagelocation.md) - -The location of the console message. diff --git a/docs/api/puppeteer.consolemessage.md b/docs/api/puppeteer.consolemessage.md index 86ed1c0efe109..812da5481983e 100644 --- a/docs/api/puppeteer.consolemessage.md +++ b/docs/api/puppeteer.consolemessage.md @@ -20,10 +20,10 @@ export declare class ConsoleMessage ## Methods -| Method | Modifiers | Description | -| -------------------------------------------------------- | --------- | ----------- | -| [args()](./puppeteer.consolemessage.args.md) | | | -| [location()](./puppeteer.consolemessage.location.md) | | | -| [stackTrace()](./puppeteer.consolemessage.stacktrace.md) | | | -| [text()](./puppeteer.consolemessage.text.md) | | | -| [type()](./puppeteer.consolemessage.type.md) | | | +| Method | Modifiers | Description | +| -------------------------------------------------------- | --------- | ----------------------------------------------------------- | +| [args()](./puppeteer.consolemessage.args.md) | | An array of arguments passed to the console. | +| [location()](./puppeteer.consolemessage.location.md) | | The location of the console message. | +| [stackTrace()](./puppeteer.consolemessage.stacktrace.md) | | The array of locations on the stack of the console message. | +| [text()](./puppeteer.consolemessage.text.md) | | The text of the console message. | +| [type()](./puppeteer.consolemessage.type.md) | | The type of the console message. | diff --git a/docs/api/puppeteer.consolemessage.stacktrace.md b/docs/api/puppeteer.consolemessage.stacktrace.md index f589b9aed3a9d..aa48e6048a907 100644 --- a/docs/api/puppeteer.consolemessage.stacktrace.md +++ b/docs/api/puppeteer.consolemessage.stacktrace.md @@ -4,6 +4,8 @@ sidebar_label: ConsoleMessage.stackTrace # ConsoleMessage.stackTrace() method +The array of locations on the stack of the console message. + #### Signature: ```typescript @@ -15,5 +17,3 @@ class ConsoleMessage { **Returns:** [ConsoleMessageLocation](./puppeteer.consolemessagelocation.md)\[\] - -The array of locations on the stack of the console message. diff --git a/docs/api/puppeteer.consolemessage.text.md b/docs/api/puppeteer.consolemessage.text.md index 4e86e4651b40d..3957ede4180ba 100644 --- a/docs/api/puppeteer.consolemessage.text.md +++ b/docs/api/puppeteer.consolemessage.text.md @@ -4,6 +4,8 @@ sidebar_label: ConsoleMessage.text # ConsoleMessage.text() method +The text of the console message. + #### Signature: ```typescript @@ -15,5 +17,3 @@ class ConsoleMessage { **Returns:** string - -The text of the console message. diff --git a/docs/api/puppeteer.consolemessage.type.md b/docs/api/puppeteer.consolemessage.type.md index 9f0224a248b67..e253d847b61bc 100644 --- a/docs/api/puppeteer.consolemessage.type.md +++ b/docs/api/puppeteer.consolemessage.type.md @@ -4,6 +4,8 @@ sidebar_label: ConsoleMessage.type # ConsoleMessage.type() method +The type of the console message. + #### Signature: ```typescript @@ -15,5 +17,3 @@ class ConsoleMessage { **Returns:** [ConsoleMessageType](./puppeteer.consolemessagetype.md) - -The type of the console message. diff --git a/docs/api/puppeteer.consolemessagelocation.columnnumber.md b/docs/api/puppeteer.consolemessagelocation.columnnumber.md deleted file mode 100644 index ebc06e2e7bf07..0000000000000 --- a/docs/api/puppeteer.consolemessagelocation.columnnumber.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: ConsoleMessageLocation.columnNumber ---- - -# ConsoleMessageLocation.columnNumber property - -0-based column number in the resource if known or `undefined` otherwise. - -#### Signature: - -```typescript -interface ConsoleMessageLocation { - columnNumber?: number; -} -``` diff --git a/docs/api/puppeteer.consolemessagelocation.linenumber.md b/docs/api/puppeteer.consolemessagelocation.linenumber.md deleted file mode 100644 index 75e34b99f1bfd..0000000000000 --- a/docs/api/puppeteer.consolemessagelocation.linenumber.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: ConsoleMessageLocation.lineNumber ---- - -# ConsoleMessageLocation.lineNumber property - -0-based line number in the resource if known or `undefined` otherwise. - -#### Signature: - -```typescript -interface ConsoleMessageLocation { - lineNumber?: number; -} -``` diff --git a/docs/api/puppeteer.consolemessagelocation.md b/docs/api/puppeteer.consolemessagelocation.md index 53f1ea4cbc638..47aa190231de3 100644 --- a/docs/api/puppeteer.consolemessagelocation.md +++ b/docs/api/puppeteer.consolemessagelocation.md @@ -12,8 +12,8 @@ export interface ConsoleMessageLocation ## Properties -| Property | Modifiers | Type | Description | Default | -| ------------------------------------------------------------------- | --------- | ------ | ------------------------------------------------------------------------------------------------ | ------- | -| [columnNumber?](./puppeteer.consolemessagelocation.columnnumber.md) | | number | _(Optional)_ 0-based column number in the resource if known or undefined otherwise. | | -| [lineNumber?](./puppeteer.consolemessagelocation.linenumber.md) | | number | _(Optional)_ 0-based line number in the resource if known or undefined otherwise. | | -| [url?](./puppeteer.consolemessagelocation.url.md) | | string | _(Optional)_ URL of the resource if known or undefined otherwise. | | +| Property | Modifiers | Type | Description | Default | +| ------------ | --------------------- | ------ | ----------------------------------------------------------------------------------- | ------- | +| columnNumber | optional | number | 0-based column number in the resource if known or undefined otherwise. | | +| lineNumber | optional | number | 0-based line number in the resource if known or undefined otherwise. | | +| url | optional | string | URL of the resource if known or undefined otherwise. | | diff --git a/docs/api/puppeteer.consolemessagelocation.url.md b/docs/api/puppeteer.consolemessagelocation.url.md deleted file mode 100644 index 11cbded0f9fec..0000000000000 --- a/docs/api/puppeteer.consolemessagelocation.url.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: ConsoleMessageLocation.url ---- - -# ConsoleMessageLocation.url property - -URL of the resource if known or `undefined` otherwise. - -#### Signature: - -```typescript -interface ConsoleMessageLocation { - url?: string; -} -``` diff --git a/docs/api/puppeteer.continuerequestoverrides.headers.md b/docs/api/puppeteer.continuerequestoverrides.headers.md deleted file mode 100644 index 22b68e5e9c611..0000000000000 --- a/docs/api/puppeteer.continuerequestoverrides.headers.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: ContinueRequestOverrides.headers ---- - -# ContinueRequestOverrides.headers property - -#### Signature: - -```typescript -interface ContinueRequestOverrides { - headers?: Record; -} -``` diff --git a/docs/api/puppeteer.continuerequestoverrides.md b/docs/api/puppeteer.continuerequestoverrides.md index 32f4a3d59a205..2dc955e943dd6 100644 --- a/docs/api/puppeteer.continuerequestoverrides.md +++ b/docs/api/puppeteer.continuerequestoverrides.md @@ -12,9 +12,9 @@ export interface ContinueRequestOverrides ## Properties -| Property | Modifiers | Type | Description | Default | -| ------------------------------------------------------------- | --------- | ---------------------------- | ------------------------------------------------------------------------- | ------- | -| [headers?](./puppeteer.continuerequestoverrides.headers.md) | | Record<string, string> | _(Optional)_ | | -| [method?](./puppeteer.continuerequestoverrides.method.md) | | string | _(Optional)_ | | -| [postData?](./puppeteer.continuerequestoverrides.postdata.md) | | string | _(Optional)_ | | -| [url?](./puppeteer.continuerequestoverrides.url.md) | | string | _(Optional)_ If set, the request URL will change. This is not a redirect. | | +| Property | Modifiers | Type | Description | Default | +| -------- | --------------------- | ---------------------------- | ------------------------------------------------------------ | ------- | +| headers | optional | Record<string, string> | | | +| method | optional | string | | | +| postData | optional | string | | | +| url | optional | string | If set, the request URL will change. This is not a redirect. | | diff --git a/docs/api/puppeteer.continuerequestoverrides.method.md b/docs/api/puppeteer.continuerequestoverrides.method.md deleted file mode 100644 index 5bd9e4587f867..0000000000000 --- a/docs/api/puppeteer.continuerequestoverrides.method.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: ContinueRequestOverrides.method ---- - -# ContinueRequestOverrides.method property - -#### Signature: - -```typescript -interface ContinueRequestOverrides { - method?: string; -} -``` diff --git a/docs/api/puppeteer.continuerequestoverrides.postdata.md b/docs/api/puppeteer.continuerequestoverrides.postdata.md deleted file mode 100644 index e4ba78338ef30..0000000000000 --- a/docs/api/puppeteer.continuerequestoverrides.postdata.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: ContinueRequestOverrides.postData ---- - -# ContinueRequestOverrides.postData property - -#### Signature: - -```typescript -interface ContinueRequestOverrides { - postData?: string; -} -``` diff --git a/docs/api/puppeteer.continuerequestoverrides.url.md b/docs/api/puppeteer.continuerequestoverrides.url.md deleted file mode 100644 index bed6789600c8f..0000000000000 --- a/docs/api/puppeteer.continuerequestoverrides.url.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: ContinueRequestOverrides.url ---- - -# ContinueRequestOverrides.url property - -If set, the request URL will change. This is not a redirect. - -#### Signature: - -```typescript -interface ContinueRequestOverrides { - url?: string; -} -``` diff --git a/docs/api/puppeteer.coverage.md b/docs/api/puppeteer.coverage.md index f0ac68faa1396..7dd807a8865a6 100644 --- a/docs/api/puppeteer.coverage.md +++ b/docs/api/puppeteer.coverage.md @@ -4,7 +4,7 @@ sidebar_label: Coverage # Coverage class -The Coverage class provides methods to gathers information about parts of JavaScript and CSS that were used by the page. +The Coverage class provides methods to gather information about parts of JavaScript and CSS that were used by the page. #### Signature: @@ -51,9 +51,9 @@ console.log(`Bytes used: ${(usedBytes / totalBytes) * 100}%`); ## Methods -| Method | Modifiers | Description | -| --------------------------------------------------------------------- | --------- | ----------- | -| [startCSSCoverage(options)](./puppeteer.coverage.startcsscoverage.md) | | | -| [startJSCoverage(options)](./puppeteer.coverage.startjscoverage.md) | | | -| [stopCSSCoverage()](./puppeteer.coverage.stopcsscoverage.md) | | | -| [stopJSCoverage()](./puppeteer.coverage.stopjscoverage.md) | | | +| Method | Modifiers | Description | +| --------------------------------------------------------------------- | --------- | --------------------------------------------------------------------------- | +| [startCSSCoverage(options)](./puppeteer.coverage.startcsscoverage.md) | | | +| [startJSCoverage(options)](./puppeteer.coverage.startjscoverage.md) | | | +| [stopCSSCoverage()](./puppeteer.coverage.stopcsscoverage.md) | | Promise that resolves to the array of coverage reports for all stylesheets. | +| [stopJSCoverage()](./puppeteer.coverage.stopjscoverage.md) | | Promise that resolves to the array of coverage reports for all scripts. | diff --git a/docs/api/puppeteer.coverage.stopcsscoverage.md b/docs/api/puppeteer.coverage.stopcsscoverage.md index db43fab553b09..143b34f46f1fd 100644 --- a/docs/api/puppeteer.coverage.stopcsscoverage.md +++ b/docs/api/puppeteer.coverage.stopcsscoverage.md @@ -4,6 +4,8 @@ sidebar_label: Coverage.stopCSSCoverage # Coverage.stopCSSCoverage() method +Promise that resolves to the array of coverage reports for all stylesheets. + #### Signature: ```typescript @@ -16,8 +18,6 @@ class Coverage { Promise<[CoverageEntry](./puppeteer.coverageentry.md)\[\]> -Promise that resolves to the array of coverage reports for all stylesheets. - ## Remarks CSS Coverage doesn't include dynamically injected style tags without sourceURLs. diff --git a/docs/api/puppeteer.coverage.stopjscoverage.md b/docs/api/puppeteer.coverage.stopjscoverage.md index 996db5c5bb7fc..483bb8dd759cd 100644 --- a/docs/api/puppeteer.coverage.stopjscoverage.md +++ b/docs/api/puppeteer.coverage.stopjscoverage.md @@ -4,6 +4,8 @@ sidebar_label: Coverage.stopJSCoverage # Coverage.stopJSCoverage() method +Promise that resolves to the array of coverage reports for all scripts. + #### Signature: ```typescript @@ -16,8 +18,6 @@ class Coverage { Promise<[JSCoverageEntry](./puppeteer.jscoverageentry.md)\[\]> -Promise that resolves to the array of coverage reports for all scripts. - ## Remarks JavaScript Coverage doesn't include anonymous scripts by default. However, scripts with sourceURLs are reported. diff --git a/docs/api/puppeteer.coverageentry.md b/docs/api/puppeteer.coverageentry.md index 72e450362cf5d..3f904740c5125 100644 --- a/docs/api/puppeteer.coverageentry.md +++ b/docs/api/puppeteer.coverageentry.md @@ -14,8 +14,8 @@ export interface CoverageEntry ## Properties -| Property | Modifiers | Type | Description | Default | -| --------------------------------------------- | --------- | -------------------------------------------- | --------------------------------------------- | ------- | -| [ranges](./puppeteer.coverageentry.ranges.md) | | Array<{ start: number; end: number; }> | The covered range as start and end positions. | | -| [text](./puppeteer.coverageentry.text.md) | | string | The content of the style sheet or script. | | -| [url](./puppeteer.coverageentry.url.md) | | string | The URL of the style sheet or script. | | +| Property | Modifiers | Type | Description | Default | +| -------- | --------- | -------------------------------------------- | --------------------------------------------- | ------- | +| ranges | | Array<{ start: number; end: number; }> | The covered range as start and end positions. | | +| text | | string | The content of the style sheet or script. | | +| url | | string | The URL of the style sheet or script. | | diff --git a/docs/api/puppeteer.coverageentry.ranges.md b/docs/api/puppeteer.coverageentry.ranges.md deleted file mode 100644 index 4420c1a7349da..0000000000000 --- a/docs/api/puppeteer.coverageentry.ranges.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -sidebar_label: CoverageEntry.ranges ---- - -# CoverageEntry.ranges property - -The covered range as start and end positions. - -#### Signature: - -```typescript -interface CoverageEntry { - ranges: Array<{ - start: number; - end: number; - }>; -} -``` diff --git a/docs/api/puppeteer.coverageentry.text.md b/docs/api/puppeteer.coverageentry.text.md deleted file mode 100644 index e679e0e1daec7..0000000000000 --- a/docs/api/puppeteer.coverageentry.text.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: CoverageEntry.text ---- - -# CoverageEntry.text property - -The content of the style sheet or script. - -#### Signature: - -```typescript -interface CoverageEntry { - text: string; -} -``` diff --git a/docs/api/puppeteer.coverageentry.url.md b/docs/api/puppeteer.coverageentry.url.md deleted file mode 100644 index b83a21cdc89d8..0000000000000 --- a/docs/api/puppeteer.coverageentry.url.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: CoverageEntry.url ---- - -# CoverageEntry.url property - -The URL of the style sheet or script. - -#### Signature: - -```typescript -interface CoverageEntry { - url: string; -} -``` diff --git a/docs/api/puppeteer.createbrowserfetcher.md b/docs/api/puppeteer.createbrowserfetcher.md deleted file mode 100644 index 6521b6a01462e..0000000000000 --- a/docs/api/puppeteer.createbrowserfetcher.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -sidebar_label: createBrowserFetcher ---- - -# createBrowserFetcher variable - -#### Signature: - -```typescript -createBrowserFetcher: ( - options?: - | Partial< - import('puppeteer-core/internal/puppeteer-core.js').BrowserFetcherOptions - > - | undefined -) => import('puppeteer-core/internal/puppeteer-core.js').BrowserFetcher; -``` diff --git a/docs/api/puppeteer.credentials.md b/docs/api/puppeteer.credentials.md index d9a6e66489bbf..36068a7b8cc8b 100644 --- a/docs/api/puppeteer.credentials.md +++ b/docs/api/puppeteer.credentials.md @@ -12,7 +12,7 @@ export interface Credentials ## Properties -| Property | Modifiers | Type | Description | Default | -| ----------------------------------------------- | --------- | ------ | ----------- | ------- | -| [password](./puppeteer.credentials.password.md) | | string | | | -| [username](./puppeteer.credentials.username.md) | | string | | | +| Property | Modifiers | Type | Description | Default | +| -------- | --------- | ------ | ----------- | ------- | +| password | | string | | | +| username | | string | | | diff --git a/docs/api/puppeteer.credentials.password.md b/docs/api/puppeteer.credentials.password.md deleted file mode 100644 index 7251de0c9714d..0000000000000 --- a/docs/api/puppeteer.credentials.password.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: Credentials.password ---- - -# Credentials.password property - -#### Signature: - -```typescript -interface Credentials { - password: string; -} -``` diff --git a/docs/api/puppeteer.credentials.username.md b/docs/api/puppeteer.credentials.username.md deleted file mode 100644 index 90b70ae130dc6..0000000000000 --- a/docs/api/puppeteer.credentials.username.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: Credentials.username ---- - -# Credentials.username property - -#### Signature: - -```typescript -interface Credentials { - username: string; -} -``` diff --git a/docs/api/puppeteer.csscoverageoptions.md b/docs/api/puppeteer.csscoverageoptions.md index 4446ac176e41d..59fc7dc152c67 100644 --- a/docs/api/puppeteer.csscoverageoptions.md +++ b/docs/api/puppeteer.csscoverageoptions.md @@ -14,6 +14,6 @@ export interface CSSCoverageOptions ## Properties -| Property | Modifiers | Type | Description | Default | -| ------------------------------------------------------------------------- | --------- | ------- | ----------------------------------------------------------- | ------- | -| [resetOnNavigation?](./puppeteer.csscoverageoptions.resetonnavigation.md) | | boolean | _(Optional)_ Whether to reset coverage on every navigation. | | +| Property | Modifiers | Type | Description | Default | +| ----------------- | --------------------- | ------- | ---------------------------------------------- | ------- | +| resetOnNavigation | optional | boolean | Whether to reset coverage on every navigation. | | diff --git a/docs/api/puppeteer.csscoverageoptions.resetonnavigation.md b/docs/api/puppeteer.csscoverageoptions.resetonnavigation.md deleted file mode 100644 index 5fd1da4195c47..0000000000000 --- a/docs/api/puppeteer.csscoverageoptions.resetonnavigation.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: CSSCoverageOptions.resetOnNavigation ---- - -# CSSCoverageOptions.resetOnNavigation property - -Whether to reset coverage on every navigation. - -#### Signature: - -```typescript -interface CSSCoverageOptions { - resetOnNavigation?: boolean; -} -``` diff --git a/docs/api/puppeteer.customqueryhandler.md b/docs/api/puppeteer.customqueryhandler.md index 0a0477ae2deaa..83d6a1e13dd16 100644 --- a/docs/api/puppeteer.customqueryhandler.md +++ b/docs/api/puppeteer.customqueryhandler.md @@ -12,7 +12,7 @@ export interface CustomQueryHandler ## Properties -| Property | Modifiers | Type | Description | Default | -| ------------------------------------------------------- | --------- | --------------------------------------------------------- | ------------ | ------- | -| [queryAll?](./puppeteer.customqueryhandler.queryall.md) | | (node: Node, selector: string) => Iterable<Node> | _(Optional)_ | | -| [queryOne?](./puppeteer.customqueryhandler.queryone.md) | | (node: Node, selector: string) => Node \| null | _(Optional)_ | | +| Property | Modifiers | Type | Description | Default | +| -------- | --------------------- | --------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | +| queryAll | optional | (node: Node, selector: string) => Iterable<Node> | Searches for some [Nodes](https://developer.mozilla.org/en-US/docs/Web/API/Node) matching the given selector from [node](https://developer.mozilla.org/en-US/docs/Web/API/Node). | | +| queryOne | optional | (node: Node, selector: string) => Node \| null | Searches for a [Node](https://developer.mozilla.org/en-US/docs/Web/API/Node) matching the given selector from [node](https://developer.mozilla.org/en-US/docs/Web/API/Node). | | diff --git a/docs/api/puppeteer.customqueryhandler.queryall.md b/docs/api/puppeteer.customqueryhandler.queryall.md deleted file mode 100644 index 6ee8044f561b0..0000000000000 --- a/docs/api/puppeteer.customqueryhandler.queryall.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: CustomQueryHandler.queryAll ---- - -# CustomQueryHandler.queryAll property - -#### Signature: - -```typescript -interface CustomQueryHandler { - queryAll?: (node: Node, selector: string) => Iterable; -} -``` diff --git a/docs/api/puppeteer.customqueryhandler.queryone.md b/docs/api/puppeteer.customqueryhandler.queryone.md deleted file mode 100644 index bbd241c85b953..0000000000000 --- a/docs/api/puppeteer.customqueryhandler.queryone.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: CustomQueryHandler.queryOne ---- - -# CustomQueryHandler.queryOne property - -#### Signature: - -```typescript -interface CustomQueryHandler { - queryOne?: (node: Node, selector: string) => Node | null; -} -``` diff --git a/docs/api/puppeteer.device.md b/docs/api/puppeteer.device.md index b690704f545c5..aae65de99575d 100644 --- a/docs/api/puppeteer.device.md +++ b/docs/api/puppeteer.device.md @@ -12,7 +12,7 @@ export interface Device ## Properties -| Property | Modifiers | Type | Description | Default | -| -------------------------------------------- | --------- | ----------------------------------- | ----------- | ------- | -| [userAgent](./puppeteer.device.useragent.md) | | string | | | -| [viewport](./puppeteer.device.viewport.md) | | [Viewport](./puppeteer.viewport.md) | | | +| Property | Modifiers | Type | Description | Default | +| --------- | --------- | ----------------------------------- | ----------- | ------- | +| userAgent | | string | | | +| viewport | | [Viewport](./puppeteer.viewport.md) | | | diff --git a/docs/api/puppeteer.device.useragent.md b/docs/api/puppeteer.device.useragent.md deleted file mode 100644 index 04c46d988479e..0000000000000 --- a/docs/api/puppeteer.device.useragent.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: Device.userAgent ---- - -# Device.userAgent property - -#### Signature: - -```typescript -interface Device { - userAgent: string; -} -``` diff --git a/docs/api/puppeteer.device.viewport.md b/docs/api/puppeteer.device.viewport.md deleted file mode 100644 index f1f8c403b1703..0000000000000 --- a/docs/api/puppeteer.device.viewport.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: Device.viewport ---- - -# Device.viewport property - -#### Signature: - -```typescript -interface Device { - viewport: Viewport; -} -``` diff --git a/docs/api/puppeteer.devicerequestprompt.cancel.md b/docs/api/puppeteer.devicerequestprompt.cancel.md new file mode 100644 index 0000000000000..a6416224ddd56 --- /dev/null +++ b/docs/api/puppeteer.devicerequestprompt.cancel.md @@ -0,0 +1,19 @@ +--- +sidebar_label: DeviceRequestPrompt.cancel +--- + +# DeviceRequestPrompt.cancel() method + +Cancel the prompt. + +#### Signature: + +```typescript +class DeviceRequestPrompt { + cancel(): Promise; +} +``` + +**Returns:** + +Promise<void> diff --git a/docs/api/puppeteer.devicerequestprompt.md b/docs/api/puppeteer.devicerequestprompt.md new file mode 100644 index 0000000000000..ee9f1a62fc39b --- /dev/null +++ b/docs/api/puppeteer.devicerequestprompt.md @@ -0,0 +1,45 @@ +--- +sidebar_label: DeviceRequestPrompt +--- + +# DeviceRequestPrompt class + +Device request prompts let you respond to the page requesting for a device through an API like WebBluetooth. + +#### Signature: + +```typescript +export declare class DeviceRequestPrompt +``` + +## Remarks + +`DeviceRequestPrompt` instances are returned via the [Page.waitForDevicePrompt()](./puppeteer.page.waitfordeviceprompt.md) method. + +The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `DeviceRequestPrompt` class. + +## Example + +```ts +const [deviceRequest] = Promise.all([ + page.waitForDevicePrompt(), + page.click('#connect-bluetooth'), +]); +await devicePrompt.select( + await devicePrompt.waitForDevice(({name}) => name.includes('My Device')) +); +``` + +## Properties + +| Property | Modifiers | Type | Description | +| -------- | --------- | ------------------------------------------------------------------------- | ----------------------------------- | +| devices | | [DeviceRequestPromptDevice](./puppeteer.devicerequestpromptdevice.md)\[\] | Current list of selectable devices. | + +## Methods + +| Method | Modifiers | Description | +| ---------------------------------------------------------------------------------- | --------- | ------------------------------------------------------------ | +| [cancel()](./puppeteer.devicerequestprompt.cancel.md) | | Cancel the prompt. | +| [select(device)](./puppeteer.devicerequestprompt.select.md) | | Select a device in the prompt's list. | +| [waitForDevice(filter, options)](./puppeteer.devicerequestprompt.waitfordevice.md) | | Resolve to the first device in the prompt matching a filter. | diff --git a/docs/api/puppeteer.devicerequestprompt.select.md b/docs/api/puppeteer.devicerequestprompt.select.md new file mode 100644 index 0000000000000..192fdc6a107a3 --- /dev/null +++ b/docs/api/puppeteer.devicerequestprompt.select.md @@ -0,0 +1,25 @@ +--- +sidebar_label: DeviceRequestPrompt.select +--- + +# DeviceRequestPrompt.select() method + +Select a device in the prompt's list. + +#### Signature: + +```typescript +class DeviceRequestPrompt { + select(device: DeviceRequestPromptDevice): Promise; +} +``` + +## Parameters + +| Parameter | Type | Description | +| --------- | --------------------------------------------------------------------- | ----------- | +| device | [DeviceRequestPromptDevice](./puppeteer.devicerequestpromptdevice.md) | | + +**Returns:** + +Promise<void> diff --git a/docs/api/puppeteer.devicerequestprompt.waitfordevice.md b/docs/api/puppeteer.devicerequestprompt.waitfordevice.md new file mode 100644 index 0000000000000..6cd38101d43ec --- /dev/null +++ b/docs/api/puppeteer.devicerequestprompt.waitfordevice.md @@ -0,0 +1,29 @@ +--- +sidebar_label: DeviceRequestPrompt.waitForDevice +--- + +# DeviceRequestPrompt.waitForDevice() method + +Resolve to the first device in the prompt matching a filter. + +#### Signature: + +```typescript +class DeviceRequestPrompt { + waitForDevice( + filter: (device: DeviceRequestPromptDevice) => boolean, + options?: WaitTimeoutOptions + ): Promise; +} +``` + +## Parameters + +| Parameter | Type | Description | +| --------- | --------------------------------------------------------------------------------------------- | ------------ | +| filter | (device: [DeviceRequestPromptDevice](./puppeteer.devicerequestpromptdevice.md)) => boolean | | +| options | [WaitTimeoutOptions](./puppeteer.waittimeoutoptions.md) | _(Optional)_ | + +**Returns:** + +Promise<[DeviceRequestPromptDevice](./puppeteer.devicerequestpromptdevice.md)> diff --git a/docs/api/puppeteer.devicerequestpromptdevice.md b/docs/api/puppeteer.devicerequestpromptdevice.md new file mode 100644 index 0000000000000..c272f56840adf --- /dev/null +++ b/docs/api/puppeteer.devicerequestpromptdevice.md @@ -0,0 +1,24 @@ +--- +sidebar_label: DeviceRequestPromptDevice +--- + +# DeviceRequestPromptDevice class + +Device in a request prompt. + +#### Signature: + +```typescript +export declare class DeviceRequestPromptDevice +``` + +## Remarks + +The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `DeviceRequestPromptDevice` class. + +## Properties + +| Property | Modifiers | Type | Description | +| -------- | --------- | ------ | -------------------------------------- | +| id | | string | Device id during a prompt. | +| name | | string | Device name as it appears in a prompt. | diff --git a/docs/api/puppeteer.dialog.accept.md b/docs/api/puppeteer.dialog.accept.md index 996989d806e1a..fbf2f90e1a64f 100644 --- a/docs/api/puppeteer.dialog.accept.md +++ b/docs/api/puppeteer.dialog.accept.md @@ -4,6 +4,8 @@ sidebar_label: Dialog.accept # Dialog.accept() method +A promise that resolves when the dialog has been accepted. + #### Signature: ```typescript @@ -21,5 +23,3 @@ class Dialog { **Returns:** Promise<void> - -A promise that resolves when the dialog has been accepted. diff --git a/docs/api/puppeteer.dialog.defaultvalue.md b/docs/api/puppeteer.dialog.defaultvalue.md index 75c236182766e..6041646d0b6fa 100644 --- a/docs/api/puppeteer.dialog.defaultvalue.md +++ b/docs/api/puppeteer.dialog.defaultvalue.md @@ -4,6 +4,8 @@ sidebar_label: Dialog.defaultValue # Dialog.defaultValue() method +The default value of the prompt, or an empty string if the dialog is not a `prompt`. + #### Signature: ```typescript @@ -15,5 +17,3 @@ class Dialog { **Returns:** string - -The default value of the prompt, or an empty string if the dialog is not a `prompt`. diff --git a/docs/api/puppeteer.dialog.dismiss.md b/docs/api/puppeteer.dialog.dismiss.md index c76ff4e33b8eb..8f4889b4db020 100644 --- a/docs/api/puppeteer.dialog.dismiss.md +++ b/docs/api/puppeteer.dialog.dismiss.md @@ -4,6 +4,8 @@ sidebar_label: Dialog.dismiss # Dialog.dismiss() method +A promise which will resolve once the dialog has been dismissed + #### Signature: ```typescript @@ -15,5 +17,3 @@ class Dialog { **Returns:** Promise<void> - -A promise which will resolve once the dialog has been dismissed diff --git a/docs/api/puppeteer.dialog.md b/docs/api/puppeteer.dialog.md index 4851c802268b1..2b65ef359837c 100644 --- a/docs/api/puppeteer.dialog.md +++ b/docs/api/puppeteer.dialog.md @@ -35,10 +35,10 @@ import puppeteer from 'puppeteer'; ## Methods -| Method | Modifiers | Description | -| ---------------------------------------------------- | --------- | ----------- | -| [accept(promptText)](./puppeteer.dialog.accept.md) | | | -| [defaultValue()](./puppeteer.dialog.defaultvalue.md) | | | -| [dismiss()](./puppeteer.dialog.dismiss.md) | | | -| [message()](./puppeteer.dialog.message.md) | | | -| [type()](./puppeteer.dialog.type.md) | | | +| Method | Modifiers | Description | +| ---------------------------------------------------- | --------- | ----------------------------------------------------------------------------------------------- | +| [accept(promptText)](./puppeteer.dialog.accept.md) | | A promise that resolves when the dialog has been accepted. | +| [defaultValue()](./puppeteer.dialog.defaultvalue.md) | | The default value of the prompt, or an empty string if the dialog is not a prompt. | +| [dismiss()](./puppeteer.dialog.dismiss.md) | | A promise which will resolve once the dialog has been dismissed | +| [message()](./puppeteer.dialog.message.md) | | The message displayed in the dialog. | +| [type()](./puppeteer.dialog.type.md) | | The type of the dialog. | diff --git a/docs/api/puppeteer.dialog.message.md b/docs/api/puppeteer.dialog.message.md index e837d1dec0241..b39526eafba57 100644 --- a/docs/api/puppeteer.dialog.message.md +++ b/docs/api/puppeteer.dialog.message.md @@ -4,6 +4,8 @@ sidebar_label: Dialog.message # Dialog.message() method +The message displayed in the dialog. + #### Signature: ```typescript @@ -15,5 +17,3 @@ class Dialog { **Returns:** string - -The message displayed in the dialog. diff --git a/docs/api/puppeteer.dialog.type.md b/docs/api/puppeteer.dialog.type.md index 948b751523aa2..9ef343d2f2e81 100644 --- a/docs/api/puppeteer.dialog.type.md +++ b/docs/api/puppeteer.dialog.type.md @@ -4,6 +4,8 @@ sidebar_label: Dialog.type # Dialog.type() method +The type of the dialog. + #### Signature: ```typescript @@ -15,5 +17,3 @@ class Dialog { **Returns:** Protocol.Page.DialogType - -The type of the dialog. diff --git a/docs/api/puppeteer.elementfor.md b/docs/api/puppeteer.elementfor.md index 53ec75ee46df5..b1484291204d5 100644 --- a/docs/api/puppeteer.elementfor.md +++ b/docs/api/puppeteer.elementfor.md @@ -8,7 +8,7 @@ sidebar_label: ElementFor ```typescript export type ElementFor< - TagName extends keyof HTMLElementTagNameMap | keyof SVGElementTagNameMap + TagName extends keyof HTMLElementTagNameMap | keyof SVGElementTagNameMap, > = TagName extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[TagName] : TagName extends keyof SVGElementTagNameMap diff --git a/docs/api/puppeteer.elementhandle.__eval.md b/docs/api/puppeteer.elementhandle.__eval.md index bdad10eadd78b..db2db5c1eac7b 100644 --- a/docs/api/puppeteer.elementhandle.__eval.md +++ b/docs/api/puppeteer.elementhandle.__eval.md @@ -18,7 +18,7 @@ class ElementHandle { Func extends EvaluateFuncWith< Array>, Params - > = EvaluateFuncWith>, Params> + > = EvaluateFuncWith>, Params>, >( selector: Selector, pageFunction: Func | string, diff --git a/docs/api/puppeteer.elementhandle._eval.md b/docs/api/puppeteer.elementhandle._eval.md index e1f6d14e85cdf..899f891481e3f 100644 --- a/docs/api/puppeteer.elementhandle._eval.md +++ b/docs/api/puppeteer.elementhandle._eval.md @@ -18,7 +18,7 @@ class ElementHandle { Func extends EvaluateFuncWith, Params> = EvaluateFuncWith< NodeFor, Params - > + >, >( selector: Selector, pageFunction: Func | string, diff --git a/docs/api/puppeteer.elementhandle.autofill.md b/docs/api/puppeteer.elementhandle.autofill.md new file mode 100644 index 0000000000000..13a7306620acf --- /dev/null +++ b/docs/api/puppeteer.elementhandle.autofill.md @@ -0,0 +1,44 @@ +--- +sidebar_label: ElementHandle.autofill +--- + +# ElementHandle.autofill() method + +If the element is a form input, you can use [ElementHandle.autofill()](./puppeteer.elementhandle.autofill.md) to test if the form is compatible with the browser's autofill implementation. Throws an error if the form cannot be autofilled. + +#### Signature: + +```typescript +class ElementHandle { + autofill(data: AutofillData): Promise; +} +``` + +## Parameters + +| Parameter | Type | Description | +| --------- | ------------------------------------------- | ----------- | +| data | [AutofillData](./puppeteer.autofilldata.md) | | + +**Returns:** + +Promise<void> + +## Remarks + +Currently, Puppeteer supports auto-filling credit card information only and in Chrome in the new headless and headful modes only. + +```ts +// Select an input on the credit card form. +const name = await page.waitForSelector('form #name'); +// Trigger autofill with the desired data. +await name.autofill({ + creditCard: { + number: '4444444444444444', + name: 'John Smith', + expiryMonth: '01', + expiryYear: '2030', + cvc: '123', + }, +}); +``` diff --git a/docs/api/puppeteer.elementhandle.click.md b/docs/api/puppeteer.elementhandle.click.md index 62dac9df204dc..a94f93ca07812 100644 --- a/docs/api/puppeteer.elementhandle.click.md +++ b/docs/api/puppeteer.elementhandle.click.md @@ -4,7 +4,7 @@ sidebar_label: ElementHandle.click # ElementHandle.click() method -This method scrolls element into view if needed, and then uses [Page.mouse](./puppeteer.page.mouse.md) to click in the center of the element. If the element is detached from DOM, the method throws an error. +This method scrolls element into view if needed, and then uses [Page.mouse](./puppeteer.page.md) to click in the center of the element. If the element is detached from DOM, the method throws an error. #### Signature: diff --git a/docs/api/puppeteer.elementhandle.frame.md b/docs/api/puppeteer.elementhandle.frame.md deleted file mode 100644 index fd6d2529d821d..0000000000000 --- a/docs/api/puppeteer.elementhandle.frame.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: ElementHandle.frame ---- - -# ElementHandle.frame property - -#### Signature: - -```typescript -class ElementHandle { - get frame(): Frame; -} -``` diff --git a/docs/api/puppeteer.elementhandle.hover.md b/docs/api/puppeteer.elementhandle.hover.md index e6f9c55c3ff84..af325f51d91bb 100644 --- a/docs/api/puppeteer.elementhandle.hover.md +++ b/docs/api/puppeteer.elementhandle.hover.md @@ -4,7 +4,7 @@ sidebar_label: ElementHandle.hover # ElementHandle.hover() method -This method scrolls element into view if needed, and then uses [Page.mouse](./puppeteer.page.mouse.md) to hover over the center of the element. If the element is detached from DOM, the method throws an error. +This method scrolls element into view if needed, and then uses [Page](./puppeteer.page.md) to hover over the center of the element. If the element is detached from DOM, the method throws an error. #### Signature: diff --git a/docs/api/puppeteer.elementhandle.ishidden.md b/docs/api/puppeteer.elementhandle.ishidden.md new file mode 100644 index 0000000000000..235b0c6c6b23e --- /dev/null +++ b/docs/api/puppeteer.elementhandle.ishidden.md @@ -0,0 +1,19 @@ +--- +sidebar_label: ElementHandle.isHidden +--- + +# ElementHandle.isHidden() method + +Checks if an element is hidden using the same mechanism as [ElementHandle.waitForSelector()](./puppeteer.elementhandle.waitforselector.md). + +#### Signature: + +```typescript +class ElementHandle { + isHidden(): Promise; +} +``` + +**Returns:** + +Promise<boolean> diff --git a/docs/api/puppeteer.elementhandle.isintersectingviewport.md b/docs/api/puppeteer.elementhandle.isintersectingviewport.md index de11847e68f92..691fac62c2075 100644 --- a/docs/api/puppeteer.elementhandle.isintersectingviewport.md +++ b/docs/api/puppeteer.elementhandle.isintersectingviewport.md @@ -4,7 +4,7 @@ sidebar_label: ElementHandle.isIntersectingViewport # ElementHandle.isIntersectingViewport() method -Resolves to true if the element is visible in the current viewport. +Resolves to true if the element is visible in the current viewport. If an element is an SVG, we check if the svg owner element is in the viewport instead. See https://crbug.com/963246. #### Signature: @@ -21,10 +21,10 @@ class ElementHandle { ## Parameters -| Parameter | Type | Description | -| --------- | ------------------------------------------------------------ | ------------ | -| this | [ElementHandle](./puppeteer.elementhandle.md)<Element> | | -| options | { threshold?: number; } | _(Optional)_ | +| Parameter | Type | Description | +| --------- | ------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------- | +| this | [ElementHandle](./puppeteer.elementhandle.md)<Element> | | +| options | { threshold?: number; } | _(Optional)_ Threshold for the intersection between 0 (no intersection) and 1 (full intersection). Defaults to 1. | **Returns:** diff --git a/docs/api/puppeteer.elementhandle.isvisible.md b/docs/api/puppeteer.elementhandle.isvisible.md new file mode 100644 index 0000000000000..0e79423e19566 --- /dev/null +++ b/docs/api/puppeteer.elementhandle.isvisible.md @@ -0,0 +1,19 @@ +--- +sidebar_label: ElementHandle.isVisible +--- + +# ElementHandle.isVisible() method + +Checks if an element is visible using the same mechanism as [ElementHandle.waitForSelector()](./puppeteer.elementhandle.waitforselector.md). + +#### Signature: + +```typescript +class ElementHandle { + isVisible(): Promise; +} +``` + +**Returns:** + +Promise<boolean> diff --git a/docs/api/puppeteer.elementhandle.md b/docs/api/puppeteer.elementhandle.md index a62395cb48c96..fa40388fdace3 100644 --- a/docs/api/puppeteer.elementhandle.md +++ b/docs/api/puppeteer.elementhandle.md @@ -41,9 +41,9 @@ The constructor for this class is marked as internal. Third-party code should no ## Properties -| Property | Modifiers | Type | Description | -| ------------------------------------------- | --------------------- | ----------------------------- | ----------- | -| [frame](./puppeteer.elementhandle.frame.md) | readonly | [Frame](./puppeteer.frame.md) | | +| Property | Modifiers | Type | Description | +| -------- | --------------------- | ----------------------------- | ----------- | +| frame | readonly | [Frame](./puppeteer.frame.md) | | ## Methods @@ -55,9 +55,10 @@ The constructor for this class is marked as internal. Third-party code should no | [$eval(selector, pageFunction, args)](./puppeteer.elementhandle._eval.md) | |

Runs the given function on the first element matching the given selector in the current element.

If the given function returns a promise, then this method will wait till the promise resolves.

| | [$x(expression)](./puppeteer.elementhandle._x.md) | | | | [asElement()](./puppeteer.elementhandle.aselement.md) | | | +| [autofill(data)](./puppeteer.elementhandle.autofill.md) | | If the element is a form input, you can use [ElementHandle.autofill()](./puppeteer.elementhandle.autofill.md) to test if the form is compatible with the browser's autofill implementation. Throws an error if the form cannot be autofilled. | | [boundingBox()](./puppeteer.elementhandle.boundingbox.md) | | This method returns the bounding box of the element (relative to the main frame), or null if the element is not visible. | | [boxModel()](./puppeteer.elementhandle.boxmodel.md) | | This method returns boxes of the element, or null if the element is not visible. | -| [click(this, options)](./puppeteer.elementhandle.click.md) | | This method scrolls element into view if needed, and then uses [Page.mouse](./puppeteer.page.mouse.md) to click in the center of the element. If the element is detached from DOM, the method throws an error. | +| [click(this, options)](./puppeteer.elementhandle.click.md) | | This method scrolls element into view if needed, and then uses [Page.mouse](./puppeteer.page.md) to click in the center of the element. If the element is detached from DOM, the method throws an error. | | [clickablePoint(offset)](./puppeteer.elementhandle.clickablepoint.md) | | Returns the middle point within an element unless a specific offset is provided. | | [contentFrame()](./puppeteer.elementhandle.contentframe.md) | | Resolves to the content frame for element handles referencing iframe nodes, or null otherwise | | [drag(this, target)](./puppeteer.elementhandle.drag.md) | | This method creates and captures a dragevent from the element. | @@ -66,10 +67,13 @@ The constructor for this class is marked as internal. Third-party code should no | [dragOver(this, data)](./puppeteer.elementhandle.dragover.md) | | This method creates a dragover event on the element. | | [drop(this, data)](./puppeteer.elementhandle.drop.md) | | This method triggers a drop on the element. | | [focus()](./puppeteer.elementhandle.focus.md) | | Calls [focus](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus) on the element. | -| [hover(this)](./puppeteer.elementhandle.hover.md) | | This method scrolls element into view if needed, and then uses [Page.mouse](./puppeteer.page.mouse.md) to hover over the center of the element. If the element is detached from DOM, the method throws an error. | -| [isIntersectingViewport(this, options)](./puppeteer.elementhandle.isintersectingviewport.md) | | Resolves to true if the element is visible in the current viewport. | +| [hover(this)](./puppeteer.elementhandle.hover.md) | | This method scrolls element into view if needed, and then uses [Page](./puppeteer.page.md) to hover over the center of the element. If the element is detached from DOM, the method throws an error. | +| [isHidden()](./puppeteer.elementhandle.ishidden.md) | | Checks if an element is hidden using the same mechanism as [ElementHandle.waitForSelector()](./puppeteer.elementhandle.waitforselector.md). | +| [isIntersectingViewport(this, options)](./puppeteer.elementhandle.isintersectingviewport.md) | | Resolves to true if the element is visible in the current viewport. If an element is an SVG, we check if the svg owner element is in the viewport instead. See https://crbug.com/963246. | +| [isVisible()](./puppeteer.elementhandle.isvisible.md) | | Checks if an element is visible using the same mechanism as [ElementHandle.waitForSelector()](./puppeteer.elementhandle.waitforselector.md). | | [press(key, options)](./puppeteer.elementhandle.press.md) | | Focuses the element, and then uses [Keyboard.down()](./puppeteer.keyboard.down.md) and [Keyboard.up()](./puppeteer.keyboard.up.md). | | [screenshot(this, options)](./puppeteer.elementhandle.screenshot.md) | | This method scrolls element into view if needed, and then uses [Page.screenshot()](./puppeteer.page.screenshot_2.md) to take a screenshot of the element. If the element is detached from DOM, the method throws an error. | +| [scrollIntoView(this)](./puppeteer.elementhandle.scrollintoview.md) | | Scrolls the element into view using either the automation protocol client or by calling element.scrollIntoView. | | [select(values)](./puppeteer.elementhandle.select.md) | | Triggers a change and input event once all the provided options have been selected. If there's no <select> element matching selector, the method throws an error. | | [tap(this)](./puppeteer.elementhandle.tap.md) | | This method scrolls element into view if needed, and then uses [Touchscreen.tap()](./puppeteer.touchscreen.tap.md) to tap in the center of the element. If the element is detached from DOM, the method throws an error. | | [toElement(tagName)](./puppeteer.elementhandle.toelement.md) | | Converts the current handle to the given element type. | @@ -77,6 +81,6 @@ The constructor for this class is marked as internal. Third-party code should no | [touchMove(this)](./puppeteer.elementhandle.touchmove.md) | | | | [touchStart(this)](./puppeteer.elementhandle.touchstart.md) | | | | [type(text, options)](./puppeteer.elementhandle.type.md) | |

Focuses the element, and then sends a keydown, keypress/input, and keyup event for each character in the text.

To press a special key, like Control or ArrowDown, use [ElementHandle.press()](./puppeteer.elementhandle.press.md).

| -| [uploadFile(this, filePaths)](./puppeteer.elementhandle.uploadfile.md) | | This method expects elementHandle to point to an [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input). | +| [uploadFile(this, paths)](./puppeteer.elementhandle.uploadfile.md) | | Sets the value of an [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input) to the given file paths. | | [waitForSelector(selector, options)](./puppeteer.elementhandle.waitforselector.md) | |

Wait for an element matching the given selector to appear in the current element.

Unlike [Frame.waitForSelector()](./puppeteer.frame.waitforselector.md), this method does not work across navigations or if the element is detached from DOM.

| | [waitForXPath(xpath, options)](./puppeteer.elementhandle.waitforxpath.md) | | | diff --git a/docs/api/puppeteer.elementhandle.press.md b/docs/api/puppeteer.elementhandle.press.md index 015874532711b..acfb8cc55d348 100644 --- a/docs/api/puppeteer.elementhandle.press.md +++ b/docs/api/puppeteer.elementhandle.press.md @@ -10,16 +10,16 @@ Focuses the element, and then uses [Keyboard.down()](./puppeteer.keyboard.down.m ```typescript class ElementHandle { - press(key: KeyInput, options?: PressOptions): Promise; + press(key: KeyInput, options?: Readonly): Promise; } ``` ## Parameters -| Parameter | Type | Description | -| --------- | ------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -| key | [KeyInput](./puppeteer.keyinput.md) | Name of key to press, such as ArrowLeft. See [KeyInput](./puppeteer.keyinput.md) for a list of all key names. | -| options | [PressOptions](./puppeteer.pressoptions.md) | _(Optional)_ | +| Parameter | Type | Description | +| --------- | ----------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| key | [KeyInput](./puppeteer.keyinput.md) | Name of key to press, such as ArrowLeft. See [KeyInput](./puppeteer.keyinput.md) for a list of all key names. | +| options | Readonly<[KeyPressOptions](./puppeteer.keypressoptions.md)> | _(Optional)_ | **Returns:** diff --git a/docs/api/puppeteer.elementhandle.scrollintoview.md b/docs/api/puppeteer.elementhandle.scrollintoview.md new file mode 100644 index 0000000000000..9f1f000280875 --- /dev/null +++ b/docs/api/puppeteer.elementhandle.scrollintoview.md @@ -0,0 +1,25 @@ +--- +sidebar_label: ElementHandle.scrollIntoView +--- + +# ElementHandle.scrollIntoView() method + +Scrolls the element into view using either the automation protocol client or by calling element.scrollIntoView. + +#### Signature: + +```typescript +class ElementHandle { + scrollIntoView(this: ElementHandle): Promise; +} +``` + +## Parameters + +| Parameter | Type | Description | +| --------- | ------------------------------------------------------------ | ----------- | +| this | [ElementHandle](./puppeteer.elementhandle.md)<Element> | | + +**Returns:** + +Promise<void> diff --git a/docs/api/puppeteer.elementhandle.type.md b/docs/api/puppeteer.elementhandle.type.md index 323540b0e2b5d..5682e3ee08117 100644 --- a/docs/api/puppeteer.elementhandle.type.md +++ b/docs/api/puppeteer.elementhandle.type.md @@ -12,21 +12,16 @@ To press a special key, like `Control` or `ArrowDown`, use [ElementHandle.press( ```typescript class ElementHandle { - type( - text: string, - options?: { - delay: number; - } - ): Promise; + type(text: string, options?: Readonly): Promise; } ``` ## Parameters -| Parameter | Type | Description | -| --------- | ------------------ | ------------ | -| text | string | | -| options | { delay: number; } | _(Optional)_ | +| Parameter | Type | Description | +| --------- | ------------------------------------------------------------------------- | -------------------------------------------------- | +| text | string | | +| options | Readonly<[KeyboardTypeOptions](./puppeteer.keyboardtypeoptions.md)> | _(Optional)_ Delay in milliseconds. Defaults to 0. | **Returns:** diff --git a/docs/api/puppeteer.elementhandle.uploadfile.md b/docs/api/puppeteer.elementhandle.uploadfile.md index 4024eda91d37e..f9212438a8292 100644 --- a/docs/api/puppeteer.elementhandle.uploadfile.md +++ b/docs/api/puppeteer.elementhandle.uploadfile.md @@ -4,7 +4,7 @@ sidebar_label: ElementHandle.uploadFile # ElementHandle.uploadFile() method -This method expects `elementHandle` to point to an [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input). +Sets the value of an [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input) to the given file paths. #### Signature: @@ -12,18 +12,22 @@ This method expects `elementHandle` to point to an [input element](https://devel class ElementHandle { uploadFile( this: ElementHandle, - ...filePaths: string[] + ...paths: string[] ): Promise; } ``` ## Parameters -| Parameter | Type | Description | -| --------- | --------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| this | [ElementHandle](./puppeteer.elementhandle.md)<HTMLInputElement> | | -| filePaths | string\[\] | Sets the value of the file input to these paths. If a path is relative, then it is resolved against the [current working directory](https://nodejs.org/api/process.html#process_process_cwd). Note for locals script connecting to remote chrome environments, paths must be absolute. | +| Parameter | Type | Description | +| --------- | --------------------------------------------------------------------- | ----------- | +| this | [ElementHandle](./puppeteer.elementhandle.md)<HTMLInputElement> | | +| paths | string\[\] | | **Returns:** Promise<void> + +## Remarks + +This will not validate whether the file paths exists. Also, if a path is relative, then it is resolved against the [current working directory](https://nodejs.org/api/process.html#process_process_cwd). For locals script connecting to remote chrome environments, paths must be absolute. diff --git a/docs/api/puppeteer.elementhandle.waitforxpath.md b/docs/api/puppeteer.elementhandle.waitforxpath.md index a1708401d195d..40e691fa5116b 100644 --- a/docs/api/puppeteer.elementhandle.waitforxpath.md +++ b/docs/api/puppeteer.elementhandle.waitforxpath.md @@ -15,28 +15,6 @@ sidebar_label: ElementHandle.waitForXPath > Wait for the `xpath` within the element. If at the moment of calling the method the `xpath` already exists, the method will return immediately. If the `xpath` doesn't appear after the `timeout` milliseconds of waiting, the function will throw. > > If `xpath` starts with `//` instead of `.//`, the dot will be appended automatically. -> -> This method works across navigation. -> -> ```ts -> import puppeteer from 'puppeteer'; -> (async () => { -> const browser = await puppeteer.launch(); -> const page = await browser.newPage(); -> let currentURL; -> page -> .waitForXPath('//img') -> .then(() => console.log('First URL with image: ' + currentURL)); -> for (currentURL of [ -> 'https://example.com', -> 'https://google.com', -> 'https://bbc.com', -> ]) { -> await page.goto(currentURL); -> } -> await browser.close(); -> })(); -> ``` #### Signature: @@ -75,3 +53,27 @@ The optional Argument `options` have properties: - `hidden`: A boolean wait for element to not be found in the DOM or to be hidden, i.e. have `display: none` or `visibility: hidden` CSS properties. Defaults to `false`. - `timeout`: A number which is maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can be changed by using the [Page.setDefaultTimeout()](./puppeteer.page.setdefaulttimeout.md) method. + +## Example + +This method works across navigation. + +```ts +import puppeteer from 'puppeteer'; +(async () => { + const browser = await puppeteer.launch(); + const page = await browser.newPage(); + let currentURL; + page + .waitForXPath('//img') + .then(() => console.log('First URL with image: ' + currentURL)); + for (currentURL of [ + 'https://example.com', + 'https://google.com', + 'https://bbc.com', + ]) { + await page.goto(currentURL); + } + await browser.close(); +})(); +``` diff --git a/docs/api/puppeteer.evaluation_script_url.md b/docs/api/puppeteer.evaluation_script_url.md deleted file mode 100644 index e00bbc863e9c1..0000000000000 --- a/docs/api/puppeteer.evaluation_script_url.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -sidebar_label: EVALUATION_SCRIPT_URL ---- - -# EVALUATION_SCRIPT_URL variable - -#### Signature: - -```typescript -EVALUATION_SCRIPT_URL = 'pptr://__puppeteer_evaluation_script__'; -``` diff --git a/docs/api/puppeteer.eventemitter.addlistener.md b/docs/api/puppeteer.eventemitter.addlistener.md index c139bd20f7dad..1a53701c7679b 100644 --- a/docs/api/puppeteer.eventemitter.addlistener.md +++ b/docs/api/puppeteer.eventemitter.addlistener.md @@ -14,7 +14,7 @@ Add an event listener. ```typescript class EventEmitter { - addListener(event: EventType, handler: Handler): EventEmitter; + addListener(event: EventType, handler: Handler): this; } ``` @@ -27,4 +27,4 @@ class EventEmitter { **Returns:** -[EventEmitter](./puppeteer.eventemitter.md) +this diff --git a/docs/api/puppeteer.eventemitter.off.md b/docs/api/puppeteer.eventemitter.off.md index 98f6eac89e956..107082b191d50 100644 --- a/docs/api/puppeteer.eventemitter.off.md +++ b/docs/api/puppeteer.eventemitter.off.md @@ -10,7 +10,7 @@ Remove an event listener from firing. ```typescript class EventEmitter { - off(event: EventType, handler: Handler): EventEmitter; + off(event: EventType, handler: Handler): this; } ``` @@ -23,6 +23,6 @@ class EventEmitter { **Returns:** -[EventEmitter](./puppeteer.eventemitter.md) +this `this` to enable you to chain method calls. diff --git a/docs/api/puppeteer.eventemitter.on.md b/docs/api/puppeteer.eventemitter.on.md index e1fee2a2ae734..f04ea8d5e099a 100644 --- a/docs/api/puppeteer.eventemitter.on.md +++ b/docs/api/puppeteer.eventemitter.on.md @@ -10,7 +10,7 @@ Bind an event listener to fire when an event occurs. ```typescript class EventEmitter { - on(event: EventType, handler: Handler): EventEmitter; + on(event: EventType, handler: Handler): this; } ``` @@ -23,6 +23,6 @@ class EventEmitter { **Returns:** -[EventEmitter](./puppeteer.eventemitter.md) +this `this` to enable you to chain method calls. diff --git a/docs/api/puppeteer.eventemitter.once.md b/docs/api/puppeteer.eventemitter.once.md index 94054eb2c2da8..5d12b89606403 100644 --- a/docs/api/puppeteer.eventemitter.once.md +++ b/docs/api/puppeteer.eventemitter.once.md @@ -10,7 +10,7 @@ Like `on` but the listener will only be fired once and then it will be removed. ```typescript class EventEmitter { - once(event: EventType, handler: Handler): EventEmitter; + once(event: EventType, handler: Handler): this; } ``` @@ -23,6 +23,6 @@ class EventEmitter { **Returns:** -[EventEmitter](./puppeteer.eventemitter.md) +this `this` to enable you to chain method calls. diff --git a/docs/api/puppeteer.eventemitter.removealllisteners.md b/docs/api/puppeteer.eventemitter.removealllisteners.md index a339bbdd42e13..1badbe777d9cc 100644 --- a/docs/api/puppeteer.eventemitter.removealllisteners.md +++ b/docs/api/puppeteer.eventemitter.removealllisteners.md @@ -10,7 +10,7 @@ Removes all listeners. If given an event argument, it will remove only listeners ```typescript class EventEmitter { - removeAllListeners(event?: EventType): EventEmitter; + removeAllListeners(event?: EventType): this; } ``` @@ -22,6 +22,6 @@ class EventEmitter { **Returns:** -[EventEmitter](./puppeteer.eventemitter.md) +this `this` to enable you to chain method calls. diff --git a/docs/api/puppeteer.eventemitter.removelistener.md b/docs/api/puppeteer.eventemitter.removelistener.md index 76e25571e3a5a..72e5ac7bd9971 100644 --- a/docs/api/puppeteer.eventemitter.removelistener.md +++ b/docs/api/puppeteer.eventemitter.removelistener.md @@ -14,7 +14,7 @@ Remove an event listener. ```typescript class EventEmitter { - removeListener(event: EventType, handler: Handler): EventEmitter; + removeListener(event: EventType, handler: Handler): this; } ``` @@ -27,4 +27,4 @@ class EventEmitter { **Returns:** -[EventEmitter](./puppeteer.eventemitter.md) +this diff --git a/docs/api/puppeteer.experimentsconfiguration.macarmchromiumenabled.md b/docs/api/puppeteer.experimentsconfiguration.macarmchromiumenabled.md deleted file mode 100644 index 1035c5acd2012..0000000000000 --- a/docs/api/puppeteer.experimentsconfiguration.macarmchromiumenabled.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -sidebar_label: ExperimentsConfiguration.macArmChromiumEnabled ---- - -# ExperimentsConfiguration.macArmChromiumEnabled property - -Require Puppeteer to download Chromium for Apple M1. - -On Apple M1 devices Puppeteer by default downloads the version for Intel's processor which runs via Rosetta. It works without any problems, however, with this option, you should get more efficient resource usage (CPU and RAM) that could lead to a faster execution time. - -Can be overridden by `PUPPETEER_EXPERIMENTAL_CHROMIUM_MAC_ARM`. - -#### Signature: - -```typescript -interface ExperimentsConfiguration { - macArmChromiumEnabled?: boolean; -} -``` - -#### Default value: - -`false` diff --git a/docs/api/puppeteer.experimentsconfiguration.md b/docs/api/puppeteer.experimentsconfiguration.md index 295334c55f70d..9c7ae85053c97 100644 --- a/docs/api/puppeteer.experimentsconfiguration.md +++ b/docs/api/puppeteer.experimentsconfiguration.md @@ -2,7 +2,7 @@ sidebar_label: ExperimentsConfiguration --- -# ExperimentsConfiguration interface +# ExperimentsConfiguration type Defines experiment options for Puppeteer. @@ -11,11 +11,5 @@ See individual properties for more information. #### Signature: ```typescript -export interface ExperimentsConfiguration +export type ExperimentsConfiguration = Record; ``` - -## Properties - -| Property | Modifiers | Type | Description | Default | -| --------------------------------------------------------------------------------------- | --------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | -| [macArmChromiumEnabled?](./puppeteer.experimentsconfiguration.macarmchromiumenabled.md) | | boolean |

_(Optional)_ Require Puppeteer to download Chromium for Apple M1.

On Apple M1 devices Puppeteer by default downloads the version for Intel's processor which runs via Rosetta. It works without any problems, however, with this option, you should get more efficient resource usage (CPU and RAM) that could lead to a faster execution time.

Can be overridden by PUPPETEER_EXPERIMENTAL_CHROMIUM_MAC_ARM.

| false | diff --git a/docs/api/puppeteer.filechooser.accept.md b/docs/api/puppeteer.filechooser.accept.md index 93f573bbb7ed9..b5cd9e3035a5c 100644 --- a/docs/api/puppeteer.filechooser.accept.md +++ b/docs/api/puppeteer.filechooser.accept.md @@ -4,22 +4,26 @@ sidebar_label: FileChooser.accept # FileChooser.accept() method -Accept the file chooser request with given paths. +Accept the file chooser request with the given file paths. #### Signature: ```typescript class FileChooser { - accept(filePaths: string[]): Promise; + accept(paths: string[]): Promise; } ``` ## Parameters -| Parameter | Type | Description | -| --------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| filePaths | string\[\] | If some of the filePaths are relative paths, then they are resolved relative to the [current working directory](https://nodejs.org/api/process.html#process_process_cwd). | +| Parameter | Type | Description | +| --------- | ---------- | ----------- | +| paths | string\[\] | | **Returns:** Promise<void> + +## Remarks + +This will not validate whether the file paths exists. Also, if a path is relative, then it is resolved against the [current working directory](https://nodejs.org/api/process.html#process_process_cwd). For locals script connecting to remote chrome environments, paths must be absolute. diff --git a/docs/api/puppeteer.filechooser.md b/docs/api/puppeteer.filechooser.md index afa5998c956ab..9e9dfe718c84c 100644 --- a/docs/api/puppeteer.filechooser.md +++ b/docs/api/puppeteer.filechooser.md @@ -32,8 +32,8 @@ await fileChooser.accept(['/tmp/myfile.pdf']); ## Methods -| Method | Modifiers | Description | -| ------------------------------------------------------ | --------- | --------------------------------------------------------------------------------------------------------------------------------------------- | -| [accept(filePaths)](./puppeteer.filechooser.accept.md) | | Accept the file chooser request with given paths. | -| [cancel()](./puppeteer.filechooser.cancel.md) | | Closes the file chooser without selecting any files. | -| [isMultiple()](./puppeteer.filechooser.ismultiple.md) | | Whether file chooser allow for [multiple](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#attr-multiple) file selection. | +| Method | Modifiers | Description | +| ----------------------------------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------- | +| [accept(paths)](./puppeteer.filechooser.accept.md) | | Accept the file chooser request with the given file paths. | +| [cancel()](./puppeteer.filechooser.cancel.md) | | Closes the file chooser without selecting any files. | +| [isMultiple()](./puppeteer.filechooser.ismultiple.md) | | Whether file chooser allow for [multiple](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#attr-multiple) file selection. | diff --git a/docs/api/puppeteer.frame.__eval.md b/docs/api/puppeteer.frame.__eval.md index 0ef3030aa4ae3..a2ec8290e00fe 100644 --- a/docs/api/puppeteer.frame.__eval.md +++ b/docs/api/puppeteer.frame.__eval.md @@ -18,7 +18,7 @@ class Frame { Func extends EvaluateFuncWith< Array>, Params - > = EvaluateFuncWith>, Params> + > = EvaluateFuncWith>, Params>, >( selector: Selector, pageFunction: Func | string, diff --git a/docs/api/puppeteer.frame._eval.md b/docs/api/puppeteer.frame._eval.md index e5258914a0f96..f7322ceee33c6 100644 --- a/docs/api/puppeteer.frame._eval.md +++ b/docs/api/puppeteer.frame._eval.md @@ -18,7 +18,7 @@ class Frame { Func extends EvaluateFuncWith, Params> = EvaluateFuncWith< NodeFor, Params - > + >, >( selector: Selector, pageFunction: Func | string, diff --git a/docs/api/puppeteer.frame.childframes.md b/docs/api/puppeteer.frame.childframes.md index 8d9a140006916..e62165680f102 100644 --- a/docs/api/puppeteer.frame.childframes.md +++ b/docs/api/puppeteer.frame.childframes.md @@ -4,6 +4,8 @@ sidebar_label: Frame.childFrames # Frame.childFrames() method +An array of child frames. + #### Signature: ```typescript @@ -15,5 +17,3 @@ class Frame { **Returns:** [Frame](./puppeteer.frame.md)\[\] - -An array of child frames. diff --git a/docs/api/puppeteer.frame.click.md b/docs/api/puppeteer.frame.click.md index 7a91615399140..ac169ea1c4912 100644 --- a/docs/api/puppeteer.frame.click.md +++ b/docs/api/puppeteer.frame.click.md @@ -10,23 +10,16 @@ Clicks the first element found that matches `selector`. ```typescript class Frame { - click( - selector: string, - options?: { - delay?: number; - button?: MouseButton; - clickCount?: number; - } - ): Promise; + click(selector: string, options?: Readonly): Promise; } ``` ## Parameters -| Parameter | Type | Description | -| --------- | -------------------------------------------------------------------------------------------- | -------------------------- | -| selector | string | The selector to query for. | -| options | { delay?: number; button?: [MouseButton](./puppeteer.mousebutton.md); clickCount?: number; } | _(Optional)_ | +| Parameter | Type | Description | +| --------- | ----------------------------------------------------------- | -------------------------- | +| selector | string | The selector to query for. | +| options | Readonly<[ClickOptions](./puppeteer.clickoptions.md)> | _(Optional)_ | **Returns:** diff --git a/docs/api/puppeteer.frame.content.md b/docs/api/puppeteer.frame.content.md index 14ad7535cd274..ec9852e0aad5d 100644 --- a/docs/api/puppeteer.frame.content.md +++ b/docs/api/puppeteer.frame.content.md @@ -4,6 +4,8 @@ sidebar_label: Frame.content # Frame.content() method +The full HTML contents of the frame, including the DOCTYPE. + #### Signature: ```typescript @@ -15,5 +17,3 @@ class Frame { **Returns:** Promise<string> - -The full HTML contents of the frame, including the DOCTYPE. diff --git a/docs/api/puppeteer.frame.evaluate.md b/docs/api/puppeteer.frame.evaluate.md index 61f5e05dfa11b..c6274e2a530de 100644 --- a/docs/api/puppeteer.frame.evaluate.md +++ b/docs/api/puppeteer.frame.evaluate.md @@ -12,7 +12,7 @@ Behaves identically to [Page.evaluate()](./puppeteer.page.evaluate.md) except it class Frame { evaluate< Params extends unknown[], - Func extends EvaluateFunc = EvaluateFunc + Func extends EvaluateFunc = EvaluateFunc, >( pageFunction: Func | string, ...args: Params diff --git a/docs/api/puppeteer.frame.evaluatehandle.md b/docs/api/puppeteer.frame.evaluatehandle.md index 39a98b37ed72e..fba17ba7e10d4 100644 --- a/docs/api/puppeteer.frame.evaluatehandle.md +++ b/docs/api/puppeteer.frame.evaluatehandle.md @@ -12,7 +12,7 @@ Behaves identically to [Page.evaluateHandle()](./puppeteer.page.evaluatehandle.m class Frame { evaluateHandle< Params extends unknown[], - Func extends EvaluateFunc = EvaluateFunc + Func extends EvaluateFunc = EvaluateFunc, >( pageFunction: Func | string, ...args: Params diff --git a/docs/api/puppeteer.frame.isdetached.md b/docs/api/puppeteer.frame.isdetached.md index c994ff1b07657..a43bcb70e3aa7 100644 --- a/docs/api/puppeteer.frame.isdetached.md +++ b/docs/api/puppeteer.frame.isdetached.md @@ -4,6 +4,8 @@ sidebar_label: Frame.isDetached # Frame.isDetached() method +Is`true` if the frame has been detached. Otherwise, `false`. + #### Signature: ```typescript @@ -15,5 +17,3 @@ class Frame { **Returns:** boolean - -`true` if the frame has been detached. Otherwise, `false`. diff --git a/docs/api/puppeteer.frame.isoopframe.md b/docs/api/puppeteer.frame.isoopframe.md index 8f6da464b12fc..222faa07b73c8 100644 --- a/docs/api/puppeteer.frame.isoopframe.md +++ b/docs/api/puppeteer.frame.isoopframe.md @@ -4,6 +4,8 @@ sidebar_label: Frame.isOOPFrame # Frame.isOOPFrame() method +Is `true` if the frame is an out-of-process (OOP) frame. Otherwise, `false`. + #### Signature: ```typescript @@ -15,5 +17,3 @@ class Frame { **Returns:** boolean - -`true` if the frame is an out-of-process (OOP) frame. Otherwise, `false`. diff --git a/docs/api/puppeteer.frame.locator.md b/docs/api/puppeteer.frame.locator.md new file mode 100644 index 0000000000000..eb19c5712f119 --- /dev/null +++ b/docs/api/puppeteer.frame.locator.md @@ -0,0 +1,31 @@ +--- +sidebar_label: Frame.locator +--- + +# Frame.locator() method + +Creates a locator for the provided `selector`. See [Locator](./puppeteer.locator.md) for details and supported actions. + +#### Signature: + +```typescript +class Frame { + locator( + selector: Selector + ): Locator>; +} +``` + +## Parameters + +| Parameter | Type | Description | +| --------- | -------- | ----------- | +| selector | Selector | | + +**Returns:** + +[Locator](./puppeteer.locator.md)<[NodeFor](./puppeteer.nodefor.md)<Selector>> + +## Remarks + +Locators API is experimental and we will not follow semver for breaking change in the Locators API. diff --git a/docs/api/puppeteer.frame.md b/docs/api/puppeteer.frame.md index ad1806f23fa1d..574284b34ad93 100644 --- a/docs/api/puppeteer.frame.md +++ b/docs/api/puppeteer.frame.md @@ -71,25 +71,27 @@ console.log(text); | [addScriptTag(options)](./puppeteer.frame.addscripttag.md) | | Adds a <script> tag into the page with the desired url or content. | | [addStyleTag(options)](./puppeteer.frame.addstyletag.md) | | Adds a <link rel="stylesheet"> tag into the page with the desired URL or a <style type="text/css"> tag with the content. | | [addStyleTag(options)](./puppeteer.frame.addstyletag_1.md) | | | -| [childFrames()](./puppeteer.frame.childframes.md) | | | +| [childFrames()](./puppeteer.frame.childframes.md) | | An array of child frames. | | [click(selector, options)](./puppeteer.frame.click.md) | | Clicks the first element found that matches selector. | -| [content()](./puppeteer.frame.content.md) | | | +| [content()](./puppeteer.frame.content.md) | | The full HTML contents of the frame, including the DOCTYPE. | | [evaluate(pageFunction, args)](./puppeteer.frame.evaluate.md) | | Behaves identically to [Page.evaluate()](./puppeteer.page.evaluate.md) except it's run within the the context of this frame. | | [evaluateHandle(pageFunction, args)](./puppeteer.frame.evaluatehandle.md) | | Behaves identically to [Page.evaluateHandle()](./puppeteer.page.evaluatehandle.md) except it's run within the context of this frame. | | [focus(selector)](./puppeteer.frame.focus.md) | | Focuses the first element that matches the selector. | | [goto(url, options)](./puppeteer.frame.goto.md) | | Navigates a frame to the given url. | | [hover(selector)](./puppeteer.frame.hover.md) | | Hovers the pointer over the center of the first element that matches the selector. | -| [isDetached()](./puppeteer.frame.isdetached.md) | | | -| [isOOPFrame()](./puppeteer.frame.isoopframe.md) | | | -| [name()](./puppeteer.frame.name.md) | | | -| [page()](./puppeteer.frame.page.md) | | | -| [parentFrame()](./puppeteer.frame.parentframe.md) | | | +| [isDetached()](./puppeteer.frame.isdetached.md) | | Istrue if the frame has been detached. Otherwise, false. | +| [isOOPFrame()](./puppeteer.frame.isoopframe.md) | | Is true if the frame is an out-of-process (OOP) frame. Otherwise, false. | +| [locator(selector)](./puppeteer.frame.locator.md) | | Creates a locator for the provided selector. See [Locator](./puppeteer.locator.md) for details and supported actions. | +| [name()](./puppeteer.frame.name.md) | | The frame's name attribute as specified in the tag. | +| [page()](./puppeteer.frame.page.md) | | The page associated with the frame. | +| [parentFrame()](./puppeteer.frame.parentframe.md) | | The parent frame, if any. Detached and main frames return null. | | [select(selector, values)](./puppeteer.frame.select.md) | | Selects a set of value on the first <select> element that matches the selector. | | [setContent(html, options)](./puppeteer.frame.setcontent.md) | | Set the content of the frame. | | [tap(selector)](./puppeteer.frame.tap.md) | | Taps the first element that matches the selector. | -| [title()](./puppeteer.frame.title.md) | | | +| [title()](./puppeteer.frame.title.md) | | The frame's title. | | [type(selector, text, options)](./puppeteer.frame.type.md) | | Sends a keydown, keypress/input, and keyup event for each character in the text. | -| [url()](./puppeteer.frame.url.md) | | | +| [url()](./puppeteer.frame.url.md) | | The frame's URL. | +| [waitForDevicePrompt(options)](./puppeteer.frame.waitfordeviceprompt.md) | |

This method is typically coupled with an action that triggers a device request from an api such as WebBluetooth.

:::caution

This must be called before the device request is made. It will not return a currently active device prompt.

:::

| | [waitForFunction(pageFunction, options, args)](./puppeteer.frame.waitforfunction.md) | | | | [waitForNavigation(options)](./puppeteer.frame.waitfornavigation.md) | |

Waits for the frame to navigate. It is useful for when you run code which will indirectly cause the frame to navigate.

Usage of the [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) to change the URL is considered a navigation.

| | [waitForSelector(selector, options)](./puppeteer.frame.waitforselector.md) | |

Waits for an element matching the given selector to appear in the frame.

This method works across navigations.

| diff --git a/docs/api/puppeteer.frame.name.md b/docs/api/puppeteer.frame.name.md index a5995fe1578c2..cfb472d233cff 100644 --- a/docs/api/puppeteer.frame.name.md +++ b/docs/api/puppeteer.frame.name.md @@ -4,6 +4,8 @@ sidebar_label: Frame.name # Frame.name() method +The frame's `name` attribute as specified in the tag. + #### Signature: ```typescript @@ -16,8 +18,6 @@ class Frame { string -The frame's `name` attribute as specified in the tag. - ## Remarks This value is calculated once when the frame is created, and will not update if the attribute is changed later. diff --git a/docs/api/puppeteer.frame.page.md b/docs/api/puppeteer.frame.page.md index 96dce12e295d2..dd4027c71dee8 100644 --- a/docs/api/puppeteer.frame.page.md +++ b/docs/api/puppeteer.frame.page.md @@ -4,6 +4,8 @@ sidebar_label: Frame.page # Frame.page() method +The page associated with the frame. + #### Signature: ```typescript @@ -15,5 +17,3 @@ class Frame { **Returns:** [Page](./puppeteer.page.md) - -The page associated with the frame. diff --git a/docs/api/puppeteer.frame.parentframe.md b/docs/api/puppeteer.frame.parentframe.md index ac1a5fa0f1227..5b0879b18272a 100644 --- a/docs/api/puppeteer.frame.parentframe.md +++ b/docs/api/puppeteer.frame.parentframe.md @@ -4,6 +4,8 @@ sidebar_label: Frame.parentFrame # Frame.parentFrame() method +The parent frame, if any. Detached and main frames return `null`. + #### Signature: ```typescript @@ -15,5 +17,3 @@ class Frame { **Returns:** [Frame](./puppeteer.frame.md) \| null - -The parent frame, if any. Detached and main frames return `null`. diff --git a/docs/api/puppeteer.frame.title.md b/docs/api/puppeteer.frame.title.md index 96e474f20fca6..a6fe9945c0b8e 100644 --- a/docs/api/puppeteer.frame.title.md +++ b/docs/api/puppeteer.frame.title.md @@ -4,6 +4,8 @@ sidebar_label: Frame.title # Frame.title() method +The frame's title. + #### Signature: ```typescript @@ -15,5 +17,3 @@ class Frame { **Returns:** Promise<string> - -the frame's title. diff --git a/docs/api/puppeteer.frame.type.md b/docs/api/puppeteer.frame.type.md index e4601a67401e2..341ca04c1510a 100644 --- a/docs/api/puppeteer.frame.type.md +++ b/docs/api/puppeteer.frame.type.md @@ -13,20 +13,18 @@ class Frame { type( selector: string, text: string, - options?: { - delay: number; - } + options?: Readonly ): Promise; } ``` ## Parameters -| Parameter | Type | Description | -| --------- | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- | -| selector | string | the selector for the element to type into. If there are multiple the first will be used. | -| text | string | text to type into the element | -| options | { delay: number; } | _(Optional)_ takes one option, delay, which sets the time to wait between key presses in milliseconds. Defaults to 0. | +| Parameter | Type | Description | +| --------- | ------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | +| selector | string | the selector for the element to type into. If there are multiple the first will be used. | +| text | string | text to type into the element | +| options | Readonly<[KeyboardTypeOptions](./puppeteer.keyboardtypeoptions.md)> | _(Optional)_ takes one option, delay, which sets the time to wait between key presses in milliseconds. Defaults to 0. | **Returns:** diff --git a/docs/api/puppeteer.frame.url.md b/docs/api/puppeteer.frame.url.md index d6339c6cbdcec..7c757b426436d 100644 --- a/docs/api/puppeteer.frame.url.md +++ b/docs/api/puppeteer.frame.url.md @@ -4,6 +4,8 @@ sidebar_label: Frame.url # Frame.url() method +The frame's URL. + #### Signature: ```typescript @@ -15,5 +17,3 @@ class Frame { **Returns:** string - -The frame's URL. diff --git a/docs/api/puppeteer.frame.waitfordeviceprompt.md b/docs/api/puppeteer.frame.waitfordeviceprompt.md new file mode 100644 index 0000000000000..b9cba72528180 --- /dev/null +++ b/docs/api/puppeteer.frame.waitfordeviceprompt.md @@ -0,0 +1,45 @@ +--- +sidebar_label: Frame.waitForDevicePrompt +--- + +# Frame.waitForDevicePrompt() method + +This method is typically coupled with an action that triggers a device request from an api such as WebBluetooth. + +:::caution + +This must be called before the device request is made. It will not return a currently active device prompt. + +::: + +#### Signature: + +```typescript +class Frame { + waitForDevicePrompt( + options?: WaitTimeoutOptions + ): Promise; +} +``` + +## Parameters + +| Parameter | Type | Description | +| --------- | ------------------------------------------------------- | ------------ | +| options | [WaitTimeoutOptions](./puppeteer.waittimeoutoptions.md) | _(Optional)_ | + +**Returns:** + +Promise<[DeviceRequestPrompt](./puppeteer.devicerequestprompt.md)> + +## Example + +```ts +const [devicePrompt] = Promise.all([ + frame.waitForDevicePrompt(), + frame.click('#connect-bluetooth'), +]); +await devicePrompt.select( + await devicePrompt.waitForDevice(({name}) => name.includes('My Device')) +); +``` diff --git a/docs/api/puppeteer.frame.waitforfunction.md b/docs/api/puppeteer.frame.waitforfunction.md index be029c95aec8c..b7399d3e25aa0 100644 --- a/docs/api/puppeteer.frame.waitforfunction.md +++ b/docs/api/puppeteer.frame.waitforfunction.md @@ -10,7 +10,7 @@ sidebar_label: Frame.waitForFunction class Frame { waitForFunction< Params extends unknown[], - Func extends EvaluateFunc = EvaluateFunc + Func extends EvaluateFunc = EvaluateFunc, >( pageFunction: Func | string, options?: FrameWaitForFunctionOptions, diff --git a/docs/api/puppeteer.frameaddscripttagoptions.content.md b/docs/api/puppeteer.frameaddscripttagoptions.content.md deleted file mode 100644 index 1620f959ac0d3..0000000000000 --- a/docs/api/puppeteer.frameaddscripttagoptions.content.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: FrameAddScriptTagOptions.content ---- - -# FrameAddScriptTagOptions.content property - -JavaScript to be injected into the frame. - -#### Signature: - -```typescript -interface FrameAddScriptTagOptions { - content?: string; -} -``` diff --git a/docs/api/puppeteer.frameaddscripttagoptions.id.md b/docs/api/puppeteer.frameaddscripttagoptions.id.md deleted file mode 100644 index abf5cd45aedca..0000000000000 --- a/docs/api/puppeteer.frameaddscripttagoptions.id.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: FrameAddScriptTagOptions.id ---- - -# FrameAddScriptTagOptions.id property - -Sets the `id` of the script. - -#### Signature: - -```typescript -interface FrameAddScriptTagOptions { - id?: string; -} -``` diff --git a/docs/api/puppeteer.frameaddscripttagoptions.md b/docs/api/puppeteer.frameaddscripttagoptions.md index ccba6a5fc5a01..83fe47b19bb69 100644 --- a/docs/api/puppeteer.frameaddscripttagoptions.md +++ b/docs/api/puppeteer.frameaddscripttagoptions.md @@ -12,10 +12,10 @@ export interface FrameAddScriptTagOptions ## Properties -| Property | Modifiers | Type | Description | Default | -| ----------------------------------------------------------- | --------- | ------ | ----------------------------------------------------------------------------------------------------------------- | ------- | -| [content?](./puppeteer.frameaddscripttagoptions.content.md) | | string | _(Optional)_ JavaScript to be injected into the frame. | | -| [id?](./puppeteer.frameaddscripttagoptions.id.md) | | string | _(Optional)_ Sets the id of the script. | | -| [path?](./puppeteer.frameaddscripttagoptions.path.md) | | string | _(Optional)_ Path to a JavaScript file to be injected into the frame. | | -| [type?](./puppeteer.frameaddscripttagoptions.type.md) | | string | _(Optional)_ Sets the type of the script. Use module in order to load an ES2015 module. | | -| [url?](./puppeteer.frameaddscripttagoptions.url.md) | | string | _(Optional)_ URL of the script to be added. | | +| Property | Modifiers | Type | Description | Default | +| -------- | --------------------- | ------ | ---------------------------------------------------------------------------------------------------- | ------- | +| content | optional | string | JavaScript to be injected into the frame. | | +| id | optional | string | Sets the id of the script. | | +| path | optional | string | Path to a JavaScript file to be injected into the frame. | | +| type | optional | string | Sets the type of the script. Use module in order to load an ES2015 module. | | +| url | optional | string | URL of the script to be added. | | diff --git a/docs/api/puppeteer.frameaddscripttagoptions.path.md b/docs/api/puppeteer.frameaddscripttagoptions.path.md deleted file mode 100644 index 2253e7953efd8..0000000000000 --- a/docs/api/puppeteer.frameaddscripttagoptions.path.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: FrameAddScriptTagOptions.path ---- - -# FrameAddScriptTagOptions.path property - -Path to a JavaScript file to be injected into the frame. - -#### Signature: - -```typescript -interface FrameAddScriptTagOptions { - path?: string; -} -``` - -## Remarks - -If `path` is a relative path, it is resolved relative to the current working directory (`process.cwd()` in Node.js). diff --git a/docs/api/puppeteer.frameaddscripttagoptions.type.md b/docs/api/puppeteer.frameaddscripttagoptions.type.md deleted file mode 100644 index 7e9c990cd1f9d..0000000000000 --- a/docs/api/puppeteer.frameaddscripttagoptions.type.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: FrameAddScriptTagOptions.type ---- - -# FrameAddScriptTagOptions.type property - -Sets the `type` of the script. Use `module` in order to load an ES2015 module. - -#### Signature: - -```typescript -interface FrameAddScriptTagOptions { - type?: string; -} -``` diff --git a/docs/api/puppeteer.frameaddscripttagoptions.url.md b/docs/api/puppeteer.frameaddscripttagoptions.url.md deleted file mode 100644 index 12a92c62bcdaf..0000000000000 --- a/docs/api/puppeteer.frameaddscripttagoptions.url.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: FrameAddScriptTagOptions.url ---- - -# FrameAddScriptTagOptions.url property - -URL of the script to be added. - -#### Signature: - -```typescript -interface FrameAddScriptTagOptions { - url?: string; -} -``` diff --git a/docs/api/puppeteer.frameaddstyletagoptions.content.md b/docs/api/puppeteer.frameaddstyletagoptions.content.md deleted file mode 100644 index d4d0c9a4653fd..0000000000000 --- a/docs/api/puppeteer.frameaddstyletagoptions.content.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: FrameAddStyleTagOptions.content ---- - -# FrameAddStyleTagOptions.content property - -Raw CSS content to be injected into the frame. - -#### Signature: - -```typescript -interface FrameAddStyleTagOptions { - content?: string; -} -``` diff --git a/docs/api/puppeteer.frameaddstyletagoptions.md b/docs/api/puppeteer.frameaddstyletagoptions.md index 94cc9972a4a60..8a1fcf6ffb40b 100644 --- a/docs/api/puppeteer.frameaddstyletagoptions.md +++ b/docs/api/puppeteer.frameaddstyletagoptions.md @@ -12,8 +12,8 @@ export interface FrameAddStyleTagOptions ## Properties -| Property | Modifiers | Type | Description | Default | -| ---------------------------------------------------------- | --------- | ------ | ------------------------------------------------------------------ | ------- | -| [content?](./puppeteer.frameaddstyletagoptions.content.md) | | string | _(Optional)_ Raw CSS content to be injected into the frame. | | -| [path?](./puppeteer.frameaddstyletagoptions.path.md) | | string | _(Optional)_ The path to a CSS file to be injected into the frame. | | -| [url?](./puppeteer.frameaddstyletagoptions.url.md) | | string | _(Optional)_ the URL of the CSS file to be added. | | +| Property | Modifiers | Type | Description | Default | +| -------- | --------------------- | ------ | ----------------------------------------------------- | ------- | +| content | optional | string | Raw CSS content to be injected into the frame. | | +| path | optional | string | The path to a CSS file to be injected into the frame. | | +| url | optional | string | the URL of the CSS file to be added. | | diff --git a/docs/api/puppeteer.frameaddstyletagoptions.path.md b/docs/api/puppeteer.frameaddstyletagoptions.path.md deleted file mode 100644 index 1aeec17bc65ad..0000000000000 --- a/docs/api/puppeteer.frameaddstyletagoptions.path.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: FrameAddStyleTagOptions.path ---- - -# FrameAddStyleTagOptions.path property - -The path to a CSS file to be injected into the frame. - -#### Signature: - -```typescript -interface FrameAddStyleTagOptions { - path?: string; -} -``` - -## Remarks - -If `path` is a relative path, it is resolved relative to the current working directory (`process.cwd()` in Node.js). diff --git a/docs/api/puppeteer.frameaddstyletagoptions.url.md b/docs/api/puppeteer.frameaddstyletagoptions.url.md deleted file mode 100644 index 0339f3f78a374..0000000000000 --- a/docs/api/puppeteer.frameaddstyletagoptions.url.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: FrameAddStyleTagOptions.url ---- - -# FrameAddStyleTagOptions.url property - -the URL of the CSS file to be added. - -#### Signature: - -```typescript -interface FrameAddStyleTagOptions { - url?: string; -} -``` diff --git a/docs/api/puppeteer.framewaitforfunctionoptions.md b/docs/api/puppeteer.framewaitforfunctionoptions.md index 2428dd8102518..7215d9ac08070 100644 --- a/docs/api/puppeteer.framewaitforfunctionoptions.md +++ b/docs/api/puppeteer.framewaitforfunctionoptions.md @@ -12,7 +12,8 @@ export interface FrameWaitForFunctionOptions ## Properties -| Property | Modifiers | Type | Description | Default | -| -------------------------------------------------------------- | --------- | ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | -| [polling?](./puppeteer.framewaitforfunctionoptions.polling.md) | | 'raf' \| 'mutation' \| number |

_(Optional)_ An interval at which the pageFunction is executed, defaults to raf. If polling is a number, then it is treated as an interval in milliseconds at which the function would be executed. If polling is a string, then it can be one of the following values:

- raf - to constantly execute pageFunction in requestAnimationFrame callback. This is the tightest polling mode which is suitable to observe styling changes.

- mutation - to execute pageFunction on every DOM mutation.

| | -| [timeout?](./puppeteer.framewaitforfunctionoptions.timeout.md) | | number | _(Optional)_ Maximum time to wait in milliseconds. Defaults to 30000 (30 seconds). Pass 0 to disable the timeout. Puppeteer's default timeout can be changed using [Page.setDefaultTimeout()](./puppeteer.page.setdefaulttimeout.md). | | +| Property | Modifiers | Type | Description | Default | +| -------- | --------------------- | ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | +| polling | optional | 'raf' \| 'mutation' \| number |

An interval at which the pageFunction is executed, defaults to raf. If polling is a number, then it is treated as an interval in milliseconds at which the function would be executed. If polling is a string, then it can be one of the following values:

- raf - to constantly execute pageFunction in requestAnimationFrame callback. This is the tightest polling mode which is suitable to observe styling changes.

- mutation - to execute pageFunction on every DOM mutation.

| | +| signal | optional | AbortSignal | A signal object that allows you to cancel a waitForFunction call. | | +| timeout | optional | number | Maximum time to wait in milliseconds. Defaults to 30000 (30 seconds). Pass 0 to disable the timeout. Puppeteer's default timeout can be changed using [Page.setDefaultTimeout()](./puppeteer.page.setdefaulttimeout.md). | | diff --git a/docs/api/puppeteer.framewaitforfunctionoptions.polling.md b/docs/api/puppeteer.framewaitforfunctionoptions.polling.md deleted file mode 100644 index f4f2b40cef976..0000000000000 --- a/docs/api/puppeteer.framewaitforfunctionoptions.polling.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: FrameWaitForFunctionOptions.polling ---- - -# FrameWaitForFunctionOptions.polling property - -An interval at which the `pageFunction` is executed, defaults to `raf`. If `polling` is a number, then it is treated as an interval in milliseconds at which the function would be executed. If `polling` is a string, then it can be one of the following values: - -- `raf` - to constantly execute `pageFunction` in `requestAnimationFrame` callback. This is the tightest polling mode which is suitable to observe styling changes. - -- `mutation` - to execute `pageFunction` on every DOM mutation. - -#### Signature: - -```typescript -interface FrameWaitForFunctionOptions { - polling?: 'raf' | 'mutation' | number; -} -``` diff --git a/docs/api/puppeteer.framewaitforfunctionoptions.timeout.md b/docs/api/puppeteer.framewaitforfunctionoptions.timeout.md deleted file mode 100644 index 4b60d241e4dd5..0000000000000 --- a/docs/api/puppeteer.framewaitforfunctionoptions.timeout.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: FrameWaitForFunctionOptions.timeout ---- - -# FrameWaitForFunctionOptions.timeout property - -Maximum time to wait in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable the timeout. Puppeteer's default timeout can be changed using [Page.setDefaultTimeout()](./puppeteer.page.setdefaulttimeout.md). - -#### Signature: - -```typescript -interface FrameWaitForFunctionOptions { - timeout?: number; -} -``` diff --git a/docs/api/puppeteer.geolocationoptions.accuracy.md b/docs/api/puppeteer.geolocationoptions.accuracy.md deleted file mode 100644 index 2ce82b0f8965c..0000000000000 --- a/docs/api/puppeteer.geolocationoptions.accuracy.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: GeolocationOptions.accuracy ---- - -# GeolocationOptions.accuracy property - -Optional non-negative accuracy value. - -#### Signature: - -```typescript -interface GeolocationOptions { - accuracy?: number; -} -``` diff --git a/docs/api/puppeteer.geolocationoptions.latitude.md b/docs/api/puppeteer.geolocationoptions.latitude.md deleted file mode 100644 index de311f798c501..0000000000000 --- a/docs/api/puppeteer.geolocationoptions.latitude.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: GeolocationOptions.latitude ---- - -# GeolocationOptions.latitude property - -Longitude between `-180` and `180`. - -#### Signature: - -```typescript -interface GeolocationOptions { - latitude: number; -} -``` diff --git a/docs/api/puppeteer.geolocationoptions.longitude.md b/docs/api/puppeteer.geolocationoptions.longitude.md deleted file mode 100644 index 59ee79a63df49..0000000000000 --- a/docs/api/puppeteer.geolocationoptions.longitude.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: GeolocationOptions.longitude ---- - -# GeolocationOptions.longitude property - -Latitude between `-90` and `90`. - -#### Signature: - -```typescript -interface GeolocationOptions { - longitude: number; -} -``` diff --git a/docs/api/puppeteer.geolocationoptions.md b/docs/api/puppeteer.geolocationoptions.md index 2e621940f840f..dcbdfc270fb5b 100644 --- a/docs/api/puppeteer.geolocationoptions.md +++ b/docs/api/puppeteer.geolocationoptions.md @@ -12,8 +12,8 @@ export interface GeolocationOptions ## Properties -| Property | Modifiers | Type | Description | Default | -| -------------------------------------------------------- | --------- | ------ | --------------------------------------------------------- | ------- | -| [accuracy?](./puppeteer.geolocationoptions.accuracy.md) | | number | _(Optional)_ Optional non-negative accuracy value. | | -| [latitude](./puppeteer.geolocationoptions.latitude.md) | | number | Longitude between -180 and 180. | | -| [longitude](./puppeteer.geolocationoptions.longitude.md) | | number | Latitude between -90 and 90. | | +| Property | Modifiers | Type | Description | Default | +| --------- | --------------------- | ------ | --------------------------------------------------------- | ------- | +| accuracy | optional | number | Optional non-negative accuracy value. | | +| latitude | | number | Longitude between -180 and 180. | | +| longitude | | number | Latitude between -90 and 90. | | diff --git a/docs/api/puppeteer.httprequest.aborterrorreason.md b/docs/api/puppeteer.httprequest.aborterrorreason.md index b5ca91c3e09c2..ed4c782d923b9 100644 --- a/docs/api/puppeteer.httprequest.aborterrorreason.md +++ b/docs/api/puppeteer.httprequest.aborterrorreason.md @@ -4,6 +4,8 @@ sidebar_label: HTTPRequest.abortErrorReason # HTTPRequest.abortErrorReason() method +The most recent reason for aborting the request + #### Signature: ```typescript @@ -15,5 +17,3 @@ class HTTPRequest { **Returns:** Protocol.Network.ErrorReason \| null - -the most recent reason for aborting the request diff --git a/docs/api/puppeteer.httprequest.client.md b/docs/api/puppeteer.httprequest.client.md deleted file mode 100644 index 523d07b07c26a..0000000000000 --- a/docs/api/puppeteer.httprequest.client.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: HTTPRequest.client ---- - -# HTTPRequest.client property - -Warning! Using this client can break Puppeteer. Use with caution. - -#### Signature: - -```typescript -class HTTPRequest { - get client(): CDPSession; -} -``` diff --git a/docs/api/puppeteer.httprequest.continuerequestoverrides.md b/docs/api/puppeteer.httprequest.continuerequestoverrides.md index 597f66a5fb1fc..832d430deeb5a 100644 --- a/docs/api/puppeteer.httprequest.continuerequestoverrides.md +++ b/docs/api/puppeteer.httprequest.continuerequestoverrides.md @@ -4,6 +4,8 @@ sidebar_label: HTTPRequest.continueRequestOverrides # HTTPRequest.continueRequestOverrides() method +The `ContinueRequestOverrides` that will be used if the interception is allowed to continue (ie, `abort()` and `respond()` aren't called). + #### Signature: ```typescript @@ -15,5 +17,3 @@ class HTTPRequest { **Returns:** [ContinueRequestOverrides](./puppeteer.continuerequestoverrides.md) - -the `ContinueRequestOverrides` that will be used if the interception is allowed to continue (ie, `abort()` and `respond()` aren't called). diff --git a/docs/api/puppeteer.httprequest.frame.md b/docs/api/puppeteer.httprequest.frame.md index 718486e462dc3..f32e9cfbb01c9 100644 --- a/docs/api/puppeteer.httprequest.frame.md +++ b/docs/api/puppeteer.httprequest.frame.md @@ -4,6 +4,8 @@ sidebar_label: HTTPRequest.frame # HTTPRequest.frame() method +The frame that initiated the request, or null if navigating to error pages. + #### Signature: ```typescript @@ -15,5 +17,3 @@ class HTTPRequest { **Returns:** [Frame](./puppeteer.frame.md) \| null - -the frame that initiated the request, or null if navigating to error pages. diff --git a/docs/api/puppeteer.httprequest.headers.md b/docs/api/puppeteer.httprequest.headers.md index 750af334a9fe5..6c0a749678756 100644 --- a/docs/api/puppeteer.httprequest.headers.md +++ b/docs/api/puppeteer.httprequest.headers.md @@ -4,6 +4,8 @@ sidebar_label: HTTPRequest.headers # HTTPRequest.headers() method +An object with HTTP headers associated with the request. All header names are lower-case. + #### Signature: ```typescript @@ -15,5 +17,3 @@ class HTTPRequest { **Returns:** Record<string, string> - -an object with HTTP headers associated with the request. All header names are lower-case. diff --git a/docs/api/puppeteer.httprequest.initiator.md b/docs/api/puppeteer.httprequest.initiator.md index e413108c6100d..cd98a3fa67adc 100644 --- a/docs/api/puppeteer.httprequest.initiator.md +++ b/docs/api/puppeteer.httprequest.initiator.md @@ -4,16 +4,16 @@ sidebar_label: HTTPRequest.initiator # HTTPRequest.initiator() method +The initiator of the request. + #### Signature: ```typescript class HTTPRequest { - initiator(): Protocol.Network.Initiator; + initiator(): Protocol.Network.Initiator | undefined; } ``` **Returns:** -Protocol.Network.Initiator - -the initiator of the request. +Protocol.Network.Initiator \| undefined diff --git a/docs/api/puppeteer.httprequest.interceptresolutionstate.md b/docs/api/puppeteer.httprequest.interceptresolutionstate.md index 08bd85a1dc324..2adca7ac17b71 100644 --- a/docs/api/puppeteer.httprequest.interceptresolutionstate.md +++ b/docs/api/puppeteer.httprequest.interceptresolutionstate.md @@ -4,6 +4,12 @@ sidebar_label: HTTPRequest.interceptResolutionState # HTTPRequest.interceptResolutionState() method +An InterceptResolutionState object describing the current resolution action and priority. + +InterceptResolutionState contains: action: InterceptResolutionAction priority?: number + +InterceptResolutionAction is one of: `abort`, `respond`, `continue`, `disabled`, `none`, or `already-handled`. + #### Signature: ```typescript @@ -15,9 +21,3 @@ class HTTPRequest { **Returns:** [InterceptResolutionState](./puppeteer.interceptresolutionstate.md) - -An InterceptResolutionState object describing the current resolution action and priority. - -InterceptResolutionState contains: action: InterceptResolutionAction priority?: number - -InterceptResolutionAction is one of: `abort`, `respond`, `continue`, `disabled`, `none`, or `already-handled`. diff --git a/docs/api/puppeteer.httprequest.isinterceptresolutionhandled.md b/docs/api/puppeteer.httprequest.isinterceptresolutionhandled.md index 4bc772fe2ac0c..2807a9cfb1693 100644 --- a/docs/api/puppeteer.httprequest.isinterceptresolutionhandled.md +++ b/docs/api/puppeteer.httprequest.isinterceptresolutionhandled.md @@ -4,6 +4,8 @@ sidebar_label: HTTPRequest.isInterceptResolutionHandled # HTTPRequest.isInterceptResolutionHandled() method +Is `true` if the intercept resolution has already been handled, `false` otherwise. + #### Signature: ```typescript @@ -15,5 +17,3 @@ class HTTPRequest { **Returns:** boolean - -`true` if the intercept resolution has already been handled, `false` otherwise. diff --git a/docs/api/puppeteer.httprequest.isnavigationrequest.md b/docs/api/puppeteer.httprequest.isnavigationrequest.md index 35f03cd1784e1..cfb120e2bc5ba 100644 --- a/docs/api/puppeteer.httprequest.isnavigationrequest.md +++ b/docs/api/puppeteer.httprequest.isnavigationrequest.md @@ -4,6 +4,8 @@ sidebar_label: HTTPRequest.isNavigationRequest # HTTPRequest.isNavigationRequest() method +True if the request is the driver of the current frame's navigation. + #### Signature: ```typescript @@ -15,5 +17,3 @@ class HTTPRequest { **Returns:** boolean - -true if the request is the driver of the current frame's navigation. diff --git a/docs/api/puppeteer.httprequest.md b/docs/api/puppeteer.httprequest.md index 6db6e461fcf0d..500d4c10e4e27 100644 --- a/docs/api/puppeteer.httprequest.md +++ b/docs/api/puppeteer.httprequest.md @@ -34,32 +34,32 @@ The constructor for this class is marked as internal. Third-party code should no ## Properties -| Property | Modifiers | Type | Description | -| ------------------------------------------- | --------------------- | --------------------------------------- | ----------------------------------------------------------------- | -| [client](./puppeteer.httprequest.client.md) | readonly | [CDPSession](./puppeteer.cdpsession.md) | Warning! Using this client can break Puppeteer. Use with caution. | +| Property | Modifiers | Type | Description | +| -------- | --------------------- | --------------------------------------- | ----------------------------------------------------------------- | +| client | readonly | [CDPSession](./puppeteer.cdpsession.md) | Warning! Using this client can break Puppeteer. Use with caution. | ## Methods -| Method | Modifiers | Description | -| ------------------------------------------------------------------------------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [abort(errorCode, priority)](./puppeteer.httprequest.abort.md) | | Aborts a request. | -| [abortErrorReason()](./puppeteer.httprequest.aborterrorreason.md) | | | -| [continue(overrides, priority)](./puppeteer.httprequest.continue.md) | | Continues request with optional request overrides. | -| [continueRequestOverrides()](./puppeteer.httprequest.continuerequestoverrides.md) | | | -| [enqueueInterceptAction(pendingHandler)](./puppeteer.httprequest.enqueueinterceptaction.md) | | Adds an async request handler to the processing queue. Deferred handlers are not guaranteed to execute in any particular order, but they are guaranteed to resolve before the request interception is finalized. | -| [failure()](./puppeteer.httprequest.failure.md) | | Access information about the request's failure. | -| [finalizeInterceptions()](./puppeteer.httprequest.finalizeinterceptions.md) | | Awaits pending interception handlers and then decides how to fulfill the request interception. | -| [frame()](./puppeteer.httprequest.frame.md) | | | -| [headers()](./puppeteer.httprequest.headers.md) | | | -| [initiator()](./puppeteer.httprequest.initiator.md) | | | -| [interceptResolutionState()](./puppeteer.httprequest.interceptresolutionstate.md) | | | -| [isInterceptResolutionHandled()](./puppeteer.httprequest.isinterceptresolutionhandled.md) | | | -| [isNavigationRequest()](./puppeteer.httprequest.isnavigationrequest.md) | | | -| [method()](./puppeteer.httprequest.method.md) | | | -| [postData()](./puppeteer.httprequest.postdata.md) | | | -| [redirectChain()](./puppeteer.httprequest.redirectchain.md) | | A redirectChain is a chain of requests initiated to fetch a resource. | -| [resourceType()](./puppeteer.httprequest.resourcetype.md) | | Contains the request's resource type as it was perceived by the rendering engine. | -| [respond(response, priority)](./puppeteer.httprequest.respond.md) | | Fulfills a request with the given response. | -| [response()](./puppeteer.httprequest.response.md) | | | -| [responseForRequest()](./puppeteer.httprequest.responseforrequest.md) | | | -| [url()](./puppeteer.httprequest.url.md) | | | +| Method | Modifiers | Description | +| ------------------------------------------------------------------------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [abort(errorCode, priority)](./puppeteer.httprequest.abort.md) | | Aborts a request. | +| [abortErrorReason()](./puppeteer.httprequest.aborterrorreason.md) | | The most recent reason for aborting the request | +| [continue(overrides, priority)](./puppeteer.httprequest.continue.md) | | Continues request with optional request overrides. | +| [continueRequestOverrides()](./puppeteer.httprequest.continuerequestoverrides.md) | | The ContinueRequestOverrides that will be used if the interception is allowed to continue (ie, abort() and respond() aren't called). | +| [enqueueInterceptAction(pendingHandler)](./puppeteer.httprequest.enqueueinterceptaction.md) | | Adds an async request handler to the processing queue. Deferred handlers are not guaranteed to execute in any particular order, but they are guaranteed to resolve before the request interception is finalized. | +| [failure()](./puppeteer.httprequest.failure.md) | | Access information about the request's failure. | +| [finalizeInterceptions()](./puppeteer.httprequest.finalizeinterceptions.md) | | Awaits pending interception handlers and then decides how to fulfill the request interception. | +| [frame()](./puppeteer.httprequest.frame.md) | | The frame that initiated the request, or null if navigating to error pages. | +| [headers()](./puppeteer.httprequest.headers.md) | | An object with HTTP headers associated with the request. All header names are lower-case. | +| [initiator()](./puppeteer.httprequest.initiator.md) | | The initiator of the request. | +| [interceptResolutionState()](./puppeteer.httprequest.interceptresolutionstate.md) | |

An InterceptResolutionState object describing the current resolution action and priority.

InterceptResolutionState contains: action: InterceptResolutionAction priority?: number

InterceptResolutionAction is one of: abort, respond, continue, disabled, none, or already-handled.

| +| [isInterceptResolutionHandled()](./puppeteer.httprequest.isinterceptresolutionhandled.md) | | Is true if the intercept resolution has already been handled, false otherwise. | +| [isNavigationRequest()](./puppeteer.httprequest.isnavigationrequest.md) | | True if the request is the driver of the current frame's navigation. | +| [method()](./puppeteer.httprequest.method.md) | | The method used (GET, POST, etc.) | +| [postData()](./puppeteer.httprequest.postdata.md) | | The request's post body, if any. | +| [redirectChain()](./puppeteer.httprequest.redirectchain.md) | | A redirectChain is a chain of requests initiated to fetch a resource. | +| [resourceType()](./puppeteer.httprequest.resourcetype.md) | | Contains the request's resource type as it was perceived by the rendering engine. | +| [respond(response, priority)](./puppeteer.httprequest.respond.md) | | Fulfills a request with the given response. | +| [response()](./puppeteer.httprequest.response.md) | | A matching HTTPResponse object, or null if the response has not been received yet. | +| [responseForRequest()](./puppeteer.httprequest.responseforrequest.md) | | The ResponseForRequest that gets used if the interception is allowed to respond (ie, abort() is not called). | +| [url()](./puppeteer.httprequest.url.md) | | The URL of the request | diff --git a/docs/api/puppeteer.httprequest.method.md b/docs/api/puppeteer.httprequest.method.md index aec833c36f87f..ce261ac28ff12 100644 --- a/docs/api/puppeteer.httprequest.method.md +++ b/docs/api/puppeteer.httprequest.method.md @@ -4,6 +4,8 @@ sidebar_label: HTTPRequest.method # HTTPRequest.method() method +The method used (`GET`, `POST`, etc.) + #### Signature: ```typescript @@ -15,5 +17,3 @@ class HTTPRequest { **Returns:** string - -the method used (`GET`, `POST`, etc.) diff --git a/docs/api/puppeteer.httprequest.postdata.md b/docs/api/puppeteer.httprequest.postdata.md index 6461de652f72f..7b7e1b328d518 100644 --- a/docs/api/puppeteer.httprequest.postdata.md +++ b/docs/api/puppeteer.httprequest.postdata.md @@ -4,6 +4,8 @@ sidebar_label: HTTPRequest.postData # HTTPRequest.postData() method +The request's post body, if any. + #### Signature: ```typescript @@ -15,5 +17,3 @@ class HTTPRequest { **Returns:** string \| undefined - -the request's post body, if any. diff --git a/docs/api/puppeteer.httprequest.response.md b/docs/api/puppeteer.httprequest.response.md index e797a055ebb92..57a193bb74e15 100644 --- a/docs/api/puppeteer.httprequest.response.md +++ b/docs/api/puppeteer.httprequest.response.md @@ -4,6 +4,8 @@ sidebar_label: HTTPRequest.response # HTTPRequest.response() method +A matching `HTTPResponse` object, or null if the response has not been received yet. + #### Signature: ```typescript @@ -15,5 +17,3 @@ class HTTPRequest { **Returns:** [HTTPResponse](./puppeteer.httpresponse.md) \| null - -A matching `HTTPResponse` object, or null if the response has not been received yet. diff --git a/docs/api/puppeteer.httprequest.responseforrequest.md b/docs/api/puppeteer.httprequest.responseforrequest.md index 4e4ea2524cf9c..168b83131b1bd 100644 --- a/docs/api/puppeteer.httprequest.responseforrequest.md +++ b/docs/api/puppeteer.httprequest.responseforrequest.md @@ -4,6 +4,8 @@ sidebar_label: HTTPRequest.responseForRequest # HTTPRequest.responseForRequest() method +The `ResponseForRequest` that gets used if the interception is allowed to respond (ie, `abort()` is not called). + #### Signature: ```typescript @@ -15,5 +17,3 @@ class HTTPRequest { **Returns:** Partial<[ResponseForRequest](./puppeteer.responseforrequest.md)> \| null - -The `ResponseForRequest` that gets used if the interception is allowed to respond (ie, `abort()` is not called). diff --git a/docs/api/puppeteer.httprequest.url.md b/docs/api/puppeteer.httprequest.url.md index b76e21ff16a59..ec8e667fa5f58 100644 --- a/docs/api/puppeteer.httprequest.url.md +++ b/docs/api/puppeteer.httprequest.url.md @@ -4,6 +4,8 @@ sidebar_label: HTTPRequest.url # HTTPRequest.url() method +The URL of the request + #### Signature: ```typescript @@ -15,5 +17,3 @@ class HTTPRequest { **Returns:** string - -the URL of the request diff --git a/docs/api/puppeteer.httpresponse.buffer.md b/docs/api/puppeteer.httpresponse.buffer.md index 156072790511b..75c64d4ac678c 100644 --- a/docs/api/puppeteer.httpresponse.buffer.md +++ b/docs/api/puppeteer.httpresponse.buffer.md @@ -4,6 +4,8 @@ sidebar_label: HTTPResponse.buffer # HTTPResponse.buffer() method +Promise which resolves to a buffer with response body. + #### Signature: ```typescript @@ -15,5 +17,3 @@ class HTTPResponse { **Returns:** Promise<Buffer> - -Promise which resolves to a buffer with response body. diff --git a/docs/api/puppeteer.httpresponse.frame.md b/docs/api/puppeteer.httpresponse.frame.md index 83a0964c9f9bc..781736cd29beb 100644 --- a/docs/api/puppeteer.httpresponse.frame.md +++ b/docs/api/puppeteer.httpresponse.frame.md @@ -4,6 +4,8 @@ sidebar_label: HTTPResponse.frame # HTTPResponse.frame() method +A [Frame](./puppeteer.frame.md) that initiated this response, or `null` if navigating to error pages. + #### Signature: ```typescript @@ -15,5 +17,3 @@ class HTTPResponse { **Returns:** [Frame](./puppeteer.frame.md) \| null - -A [Frame](./puppeteer.frame.md) that initiated this response, or `null` if navigating to error pages. diff --git a/docs/api/puppeteer.httpresponse.fromcache.md b/docs/api/puppeteer.httpresponse.fromcache.md index ddf029ff91282..ec38a9ebb449d 100644 --- a/docs/api/puppeteer.httpresponse.fromcache.md +++ b/docs/api/puppeteer.httpresponse.fromcache.md @@ -4,6 +4,8 @@ sidebar_label: HTTPResponse.fromCache # HTTPResponse.fromCache() method +True if the response was served from either the browser's disk cache or memory cache. + #### Signature: ```typescript @@ -15,5 +17,3 @@ class HTTPResponse { **Returns:** boolean - -True if the response was served from either the browser's disk cache or memory cache. diff --git a/docs/api/puppeteer.httpresponse.fromserviceworker.md b/docs/api/puppeteer.httpresponse.fromserviceworker.md index e5a126694bf03..7de43d3c17ae9 100644 --- a/docs/api/puppeteer.httpresponse.fromserviceworker.md +++ b/docs/api/puppeteer.httpresponse.fromserviceworker.md @@ -4,6 +4,8 @@ sidebar_label: HTTPResponse.fromServiceWorker # HTTPResponse.fromServiceWorker() method +True if the response was served by a service worker. + #### Signature: ```typescript @@ -15,5 +17,3 @@ class HTTPResponse { **Returns:** boolean - -True if the response was served by a service worker. diff --git a/docs/api/puppeteer.httpresponse.headers.md b/docs/api/puppeteer.httpresponse.headers.md index 775d4a412469c..05790794ffd61 100644 --- a/docs/api/puppeteer.httpresponse.headers.md +++ b/docs/api/puppeteer.httpresponse.headers.md @@ -4,6 +4,8 @@ sidebar_label: HTTPResponse.headers # HTTPResponse.headers() method +An object with HTTP headers associated with the response. All header names are lower-case. + #### Signature: ```typescript @@ -15,5 +17,3 @@ class HTTPResponse { **Returns:** Record<string, string> - -An object with HTTP headers associated with the response. All header names are lower-case. diff --git a/docs/api/puppeteer.httpresponse.json.md b/docs/api/puppeteer.httpresponse.json.md index 229a50b3133d9..d3641eb54545a 100644 --- a/docs/api/puppeteer.httpresponse.json.md +++ b/docs/api/puppeteer.httpresponse.json.md @@ -4,6 +4,8 @@ sidebar_label: HTTPResponse.json # HTTPResponse.json() method +Promise which resolves to a JSON representation of response body. + #### Signature: ```typescript @@ -16,8 +18,6 @@ class HTTPResponse { Promise<any> -Promise which resolves to a JSON representation of response body. - ## Remarks This method will throw if the response body is not parsable via `JSON.parse`. diff --git a/docs/api/puppeteer.httpresponse.md b/docs/api/puppeteer.httpresponse.md index d9be4dd79e042..411b48c7cff77 100644 --- a/docs/api/puppeteer.httpresponse.md +++ b/docs/api/puppeteer.httpresponse.md @@ -18,20 +18,20 @@ The constructor for this class is marked as internal. Third-party code should no ## Methods -| Method | Modifiers | Description | -| -------------------------------------------------------------------- | --------- | ----------- | -| [buffer()](./puppeteer.httpresponse.buffer.md) | | | -| [frame()](./puppeteer.httpresponse.frame.md) | | | -| [fromCache()](./puppeteer.httpresponse.fromcache.md) | | | -| [fromServiceWorker()](./puppeteer.httpresponse.fromserviceworker.md) | | | -| [headers()](./puppeteer.httpresponse.headers.md) | | | -| [json()](./puppeteer.httpresponse.json.md) | | | -| [ok()](./puppeteer.httpresponse.ok.md) | | | -| [remoteAddress()](./puppeteer.httpresponse.remoteaddress.md) | | | -| [request()](./puppeteer.httpresponse.request.md) | | | -| [securityDetails()](./puppeteer.httpresponse.securitydetails.md) | | | -| [status()](./puppeteer.httpresponse.status.md) | | | -| [statusText()](./puppeteer.httpresponse.statustext.md) | | | -| [text()](./puppeteer.httpresponse.text.md) | | | -| [timing()](./puppeteer.httpresponse.timing.md) | | | -| [url()](./puppeteer.httpresponse.url.md) | | | +| Method | Modifiers | Description | +| -------------------------------------------------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------ | +| [buffer()](./puppeteer.httpresponse.buffer.md) | | Promise which resolves to a buffer with response body. | +| [frame()](./puppeteer.httpresponse.frame.md) | | A [Frame](./puppeteer.frame.md) that initiated this response, or null if navigating to error pages. | +| [fromCache()](./puppeteer.httpresponse.fromcache.md) | | True if the response was served from either the browser's disk cache or memory cache. | +| [fromServiceWorker()](./puppeteer.httpresponse.fromserviceworker.md) | | True if the response was served by a service worker. | +| [headers()](./puppeteer.httpresponse.headers.md) | | An object with HTTP headers associated with the response. All header names are lower-case. | +| [json()](./puppeteer.httpresponse.json.md) | | Promise which resolves to a JSON representation of response body. | +| [ok()](./puppeteer.httpresponse.ok.md) | | True if the response was successful (status in the range 200-299). | +| [remoteAddress()](./puppeteer.httpresponse.remoteaddress.md) | | The IP address and port number used to connect to the remote server. | +| [request()](./puppeteer.httpresponse.request.md) | | A matching [HTTPRequest](./puppeteer.httprequest.md) object. | +| [securityDetails()](./puppeteer.httpresponse.securitydetails.md) | | [SecurityDetails](./puppeteer.securitydetails.md) if the response was received over the secure connection, or null otherwise. | +| [status()](./puppeteer.httpresponse.status.md) | | The status code of the response (e.g., 200 for a success). | +| [statusText()](./puppeteer.httpresponse.statustext.md) | | The status text of the response (e.g. usually an "OK" for a success). | +| [text()](./puppeteer.httpresponse.text.md) | | Promise which resolves to a text representation of response body. | +| [timing()](./puppeteer.httpresponse.timing.md) | | Timing information related to the response. | +| [url()](./puppeteer.httpresponse.url.md) | | The URL of the response. | diff --git a/docs/api/puppeteer.httpresponse.ok.md b/docs/api/puppeteer.httpresponse.ok.md index 287faf095848c..bc0955eb1b7ab 100644 --- a/docs/api/puppeteer.httpresponse.ok.md +++ b/docs/api/puppeteer.httpresponse.ok.md @@ -4,6 +4,8 @@ sidebar_label: HTTPResponse.ok # HTTPResponse.ok() method +True if the response was successful (status in the range 200-299). + #### Signature: ```typescript @@ -15,5 +17,3 @@ class HTTPResponse { **Returns:** boolean - -True if the response was successful (status in the range 200-299). diff --git a/docs/api/puppeteer.httpresponse.remoteaddress.md b/docs/api/puppeteer.httpresponse.remoteaddress.md index e9dee405e89a7..fb34ae9eb0951 100644 --- a/docs/api/puppeteer.httpresponse.remoteaddress.md +++ b/docs/api/puppeteer.httpresponse.remoteaddress.md @@ -4,6 +4,8 @@ sidebar_label: HTTPResponse.remoteAddress # HTTPResponse.remoteAddress() method +The IP address and port number used to connect to the remote server. + #### Signature: ```typescript @@ -15,5 +17,3 @@ class HTTPResponse { **Returns:** [RemoteAddress](./puppeteer.remoteaddress.md) - -The IP address and port number used to connect to the remote server. diff --git a/docs/api/puppeteer.httpresponse.request.md b/docs/api/puppeteer.httpresponse.request.md index 21e06ec360928..aeb88988dbcb1 100644 --- a/docs/api/puppeteer.httpresponse.request.md +++ b/docs/api/puppeteer.httpresponse.request.md @@ -4,6 +4,8 @@ sidebar_label: HTTPResponse.request # HTTPResponse.request() method +A matching [HTTPRequest](./puppeteer.httprequest.md) object. + #### Signature: ```typescript @@ -15,5 +17,3 @@ class HTTPResponse { **Returns:** [HTTPRequest](./puppeteer.httprequest.md) - -A matching [HTTPRequest](./puppeteer.httprequest.md) object. diff --git a/docs/api/puppeteer.httpresponse.securitydetails.md b/docs/api/puppeteer.httpresponse.securitydetails.md index bd1954f8d36a3..d8f086d9fa8c8 100644 --- a/docs/api/puppeteer.httpresponse.securitydetails.md +++ b/docs/api/puppeteer.httpresponse.securitydetails.md @@ -4,6 +4,8 @@ sidebar_label: HTTPResponse.securityDetails # HTTPResponse.securityDetails() method +[SecurityDetails](./puppeteer.securitydetails.md) if the response was received over the secure connection, or `null` otherwise. + #### Signature: ```typescript @@ -15,5 +17,3 @@ class HTTPResponse { **Returns:** [SecurityDetails](./puppeteer.securitydetails.md) \| null - -[SecurityDetails](./puppeteer.securitydetails.md) if the response was received over the secure connection, or `null` otherwise. diff --git a/docs/api/puppeteer.httpresponse.status.md b/docs/api/puppeteer.httpresponse.status.md index 7f22189568d06..fcb0ab1e1b625 100644 --- a/docs/api/puppeteer.httpresponse.status.md +++ b/docs/api/puppeteer.httpresponse.status.md @@ -4,6 +4,8 @@ sidebar_label: HTTPResponse.status # HTTPResponse.status() method +The status code of the response (e.g., 200 for a success). + #### Signature: ```typescript @@ -15,5 +17,3 @@ class HTTPResponse { **Returns:** number - -The status code of the response (e.g., 200 for a success). diff --git a/docs/api/puppeteer.httpresponse.statustext.md b/docs/api/puppeteer.httpresponse.statustext.md index 127b2dccbf8a9..30449231460e6 100644 --- a/docs/api/puppeteer.httpresponse.statustext.md +++ b/docs/api/puppeteer.httpresponse.statustext.md @@ -4,6 +4,8 @@ sidebar_label: HTTPResponse.statusText # HTTPResponse.statusText() method +The status text of the response (e.g. usually an "OK" for a success). + #### Signature: ```typescript @@ -15,5 +17,3 @@ class HTTPResponse { **Returns:** string - -The status text of the response (e.g. usually an "OK" for a success). diff --git a/docs/api/puppeteer.httpresponse.text.md b/docs/api/puppeteer.httpresponse.text.md index bd76b75186614..9e040a3f0d523 100644 --- a/docs/api/puppeteer.httpresponse.text.md +++ b/docs/api/puppeteer.httpresponse.text.md @@ -4,6 +4,8 @@ sidebar_label: HTTPResponse.text # HTTPResponse.text() method +Promise which resolves to a text representation of response body. + #### Signature: ```typescript @@ -15,5 +17,3 @@ class HTTPResponse { **Returns:** Promise<string> - -Promise which resolves to a text representation of response body. diff --git a/docs/api/puppeteer.httpresponse.timing.md b/docs/api/puppeteer.httpresponse.timing.md index db2e44a000998..273d14c395baa 100644 --- a/docs/api/puppeteer.httpresponse.timing.md +++ b/docs/api/puppeteer.httpresponse.timing.md @@ -4,6 +4,8 @@ sidebar_label: HTTPResponse.timing # HTTPResponse.timing() method +Timing information related to the response. + #### Signature: ```typescript @@ -15,5 +17,3 @@ class HTTPResponse { **Returns:** Protocol.Network.ResourceTiming \| null - -Timing information related to the response. diff --git a/docs/api/puppeteer.httpresponse.url.md b/docs/api/puppeteer.httpresponse.url.md index c2fe551b94a0e..01dbb6c3853de 100644 --- a/docs/api/puppeteer.httpresponse.url.md +++ b/docs/api/puppeteer.httpresponse.url.md @@ -4,6 +4,8 @@ sidebar_label: HTTPResponse.url # HTTPResponse.url() method +The URL of the response. + #### Signature: ```typescript @@ -15,5 +17,3 @@ class HTTPResponse { **Returns:** string - -The URL of the response. diff --git a/docs/api/puppeteer.interceptresolutionstate.action.md b/docs/api/puppeteer.interceptresolutionstate.action.md deleted file mode 100644 index 3de5f1b558b8b..0000000000000 --- a/docs/api/puppeteer.interceptresolutionstate.action.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: InterceptResolutionState.action ---- - -# InterceptResolutionState.action property - -#### Signature: - -```typescript -interface InterceptResolutionState { - action: InterceptResolutionAction; -} -``` diff --git a/docs/api/puppeteer.interceptresolutionstate.md b/docs/api/puppeteer.interceptresolutionstate.md index 30a59066ccc0c..0433a0e8abede 100644 --- a/docs/api/puppeteer.interceptresolutionstate.md +++ b/docs/api/puppeteer.interceptresolutionstate.md @@ -12,7 +12,7 @@ export interface InterceptResolutionState ## Properties -| Property | Modifiers | Type | Description | Default | -| ------------------------------------------------------------- | --------- | --------------------------------------------------------------------- | ------------ | ------- | -| [action](./puppeteer.interceptresolutionstate.action.md) | | [InterceptResolutionAction](./puppeteer.interceptresolutionaction.md) | | | -| [priority?](./puppeteer.interceptresolutionstate.priority.md) | | number | _(Optional)_ | | +| Property | Modifiers | Type | Description | Default | +| -------- | --------------------- | --------------------------------------------------------------------- | ----------- | ------- | +| action | | [InterceptResolutionAction](./puppeteer.interceptresolutionaction.md) | | | +| priority | optional | number | | | diff --git a/docs/api/puppeteer.interceptresolutionstate.priority.md b/docs/api/puppeteer.interceptresolutionstate.priority.md deleted file mode 100644 index ba88bb0b908a9..0000000000000 --- a/docs/api/puppeteer.interceptresolutionstate.priority.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: InterceptResolutionState.priority ---- - -# InterceptResolutionState.priority property - -#### Signature: - -```typescript -interface InterceptResolutionState { - priority?: number; -} -``` diff --git a/docs/api/puppeteer.internalnetworkconditions.md b/docs/api/puppeteer.internalnetworkconditions.md index aef1406d3dad8..fbeab505b13e6 100644 --- a/docs/api/puppeteer.internalnetworkconditions.md +++ b/docs/api/puppeteer.internalnetworkconditions.md @@ -14,6 +14,6 @@ export interface InternalNetworkConditions extends NetworkConditions ## Properties -| Property | Modifiers | Type | Description | Default | -| ----------------------------------------------------------- | --------- | ------- | ----------- | ------- | -| [offline](./puppeteer.internalnetworkconditions.offline.md) | | boolean | | | +| Property | Modifiers | Type | Description | Default | +| -------- | --------- | ------- | ----------- | ------- | +| offline | | boolean | | | diff --git a/docs/api/puppeteer.internalnetworkconditions.offline.md b/docs/api/puppeteer.internalnetworkconditions.offline.md deleted file mode 100644 index bae7ea14afc0c..0000000000000 --- a/docs/api/puppeteer.internalnetworkconditions.offline.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: InternalNetworkConditions.offline ---- - -# InternalNetworkConditions.offline property - -#### Signature: - -```typescript -interface InternalNetworkConditions { - offline: boolean; -} -``` diff --git a/docs/api/puppeteer.jscoverageentry.md b/docs/api/puppeteer.jscoverageentry.md index a9fd183886acd..de0bca1023932 100644 --- a/docs/api/puppeteer.jscoverageentry.md +++ b/docs/api/puppeteer.jscoverageentry.md @@ -16,6 +16,6 @@ export interface JSCoverageEntry extends CoverageEntry ## Properties -| Property | Modifiers | Type | Description | Default | -| ---------------------------------------------------------------------- | --------- | -------------------------------- | ------------------------------------------ | ------- | -| [rawScriptCoverage?](./puppeteer.jscoverageentry.rawscriptcoverage.md) | | Protocol.Profiler.ScriptCoverage | _(Optional)_ Raw V8 script coverage entry. | | +| Property | Modifiers | Type | Description | Default | +| ----------------- | --------------------- | -------------------------------- | ----------------------------- | ------- | +| rawScriptCoverage | optional | Protocol.Profiler.ScriptCoverage | Raw V8 script coverage entry. | | diff --git a/docs/api/puppeteer.jscoverageentry.rawscriptcoverage.md b/docs/api/puppeteer.jscoverageentry.rawscriptcoverage.md deleted file mode 100644 index b477bd5c1faf0..0000000000000 --- a/docs/api/puppeteer.jscoverageentry.rawscriptcoverage.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: JSCoverageEntry.rawScriptCoverage ---- - -# JSCoverageEntry.rawScriptCoverage property - -Raw V8 script coverage entry. - -#### Signature: - -```typescript -interface JSCoverageEntry { - rawScriptCoverage?: Protocol.Profiler.ScriptCoverage; -} -``` diff --git a/docs/api/puppeteer.jscoverageoptions.includerawscriptcoverage.md b/docs/api/puppeteer.jscoverageoptions.includerawscriptcoverage.md deleted file mode 100644 index bbe6dafb84985..0000000000000 --- a/docs/api/puppeteer.jscoverageoptions.includerawscriptcoverage.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: JSCoverageOptions.includeRawScriptCoverage ---- - -# JSCoverageOptions.includeRawScriptCoverage property - -Whether the result includes raw V8 script coverage entries. - -#### Signature: - -```typescript -interface JSCoverageOptions { - includeRawScriptCoverage?: boolean; -} -``` diff --git a/docs/api/puppeteer.jscoverageoptions.md b/docs/api/puppeteer.jscoverageoptions.md index a2b6ccbc228c8..289173066fcde 100644 --- a/docs/api/puppeteer.jscoverageoptions.md +++ b/docs/api/puppeteer.jscoverageoptions.md @@ -14,9 +14,9 @@ export interface JSCoverageOptions ## Properties -| Property | Modifiers | Type | Description | Default | -| -------------------------------------------------------------------------------------- | --------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------- | -| [includeRawScriptCoverage?](./puppeteer.jscoverageoptions.includerawscriptcoverage.md) | | boolean | _(Optional)_ Whether the result includes raw V8 script coverage entries. | | -| [reportAnonymousScripts?](./puppeteer.jscoverageoptions.reportanonymousscripts.md) | | boolean | _(Optional)_ Whether anonymous scripts generated by the page should be reported. | | -| [resetOnNavigation?](./puppeteer.jscoverageoptions.resetonnavigation.md) | | boolean | _(Optional)_ Whether to reset coverage on every navigation. | | -| [useBlockCoverage?](./puppeteer.jscoverageoptions.useblockcoverage.md) | | boolean | _(Optional)_ Whether to collect coverage information at the block level. If true, coverage will be collected at the block level (this is the default). If false, coverage will be collected at the function level. | | +| Property | Modifiers | Type | Description | Default | +| ------------------------ | --------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | +| includeRawScriptCoverage | optional | boolean | Whether the result includes raw V8 script coverage entries. | | +| reportAnonymousScripts | optional | boolean | Whether anonymous scripts generated by the page should be reported. | | +| resetOnNavigation | optional | boolean | Whether to reset coverage on every navigation. | | +| useBlockCoverage | optional | boolean | Whether to collect coverage information at the block level. If true, coverage will be collected at the block level (this is the default). If false, coverage will be collected at the function level. | | diff --git a/docs/api/puppeteer.jscoverageoptions.reportanonymousscripts.md b/docs/api/puppeteer.jscoverageoptions.reportanonymousscripts.md deleted file mode 100644 index 17f58ac79e93e..0000000000000 --- a/docs/api/puppeteer.jscoverageoptions.reportanonymousscripts.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: JSCoverageOptions.reportAnonymousScripts ---- - -# JSCoverageOptions.reportAnonymousScripts property - -Whether anonymous scripts generated by the page should be reported. - -#### Signature: - -```typescript -interface JSCoverageOptions { - reportAnonymousScripts?: boolean; -} -``` diff --git a/docs/api/puppeteer.jscoverageoptions.resetonnavigation.md b/docs/api/puppeteer.jscoverageoptions.resetonnavigation.md deleted file mode 100644 index 8e78b9680fd55..0000000000000 --- a/docs/api/puppeteer.jscoverageoptions.resetonnavigation.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: JSCoverageOptions.resetOnNavigation ---- - -# JSCoverageOptions.resetOnNavigation property - -Whether to reset coverage on every navigation. - -#### Signature: - -```typescript -interface JSCoverageOptions { - resetOnNavigation?: boolean; -} -``` diff --git a/docs/api/puppeteer.jscoverageoptions.useblockcoverage.md b/docs/api/puppeteer.jscoverageoptions.useblockcoverage.md deleted file mode 100644 index 8f04c92676afe..0000000000000 --- a/docs/api/puppeteer.jscoverageoptions.useblockcoverage.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: JSCoverageOptions.useBlockCoverage ---- - -# JSCoverageOptions.useBlockCoverage property - -Whether to collect coverage information at the block level. If true, coverage will be collected at the block level (this is the default). If false, coverage will be collected at the function level. - -#### Signature: - -```typescript -interface JSCoverageOptions { - useBlockCoverage?: boolean; -} -``` diff --git a/docs/api/puppeteer.jshandle.___jshandlesymbol_.md b/docs/api/puppeteer.jshandle.___jshandlesymbol_.md deleted file mode 100644 index bb8493a4cd50c..0000000000000 --- a/docs/api/puppeteer.jshandle.___jshandlesymbol_.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: JSHandle.[__JSHandleSymbol] ---- - -# JSHandle.\[\_\_JSHandleSymbol\] property - -Used for nominally typing [JSHandle](./puppeteer.jshandle.md). - -#### Signature: - -```typescript -class JSHandle { - [__JSHandleSymbol]?: T; -} -``` diff --git a/docs/api/puppeteer.jshandle.aselement.md b/docs/api/puppeteer.jshandle.aselement.md index 63383a636dada..c2107434c56eb 100644 --- a/docs/api/puppeteer.jshandle.aselement.md +++ b/docs/api/puppeteer.jshandle.aselement.md @@ -4,6 +4,8 @@ sidebar_label: JSHandle.asElement # JSHandle.asElement() method +Either `null` or the handle itself if the handle is an instance of [ElementHandle](./puppeteer.elementhandle.md). + #### Signature: ```typescript @@ -15,5 +17,3 @@ class JSHandle { **Returns:** [ElementHandle](./puppeteer.elementhandle.md)<Node> \| null - -Either `null` or the handle itself if the handle is an instance of [ElementHandle](./puppeteer.elementhandle.md). diff --git a/docs/api/puppeteer.jshandle.evaluate.md b/docs/api/puppeteer.jshandle.evaluate.md index b46e817165b3b..a888acd18cba9 100644 --- a/docs/api/puppeteer.jshandle.evaluate.md +++ b/docs/api/puppeteer.jshandle.evaluate.md @@ -12,7 +12,7 @@ Evaluates the given function with the current handle as its first argument. class JSHandle { evaluate< Params extends unknown[], - Func extends EvaluateFuncWith = EvaluateFuncWith + Func extends EvaluateFuncWith = EvaluateFuncWith, >( pageFunction: Func | string, ...args: Params diff --git a/docs/api/puppeteer.jshandle.evaluatehandle.md b/docs/api/puppeteer.jshandle.evaluatehandle.md index 15e03ab36f132..4c5c35f5ffb17 100644 --- a/docs/api/puppeteer.jshandle.evaluatehandle.md +++ b/docs/api/puppeteer.jshandle.evaluatehandle.md @@ -12,7 +12,7 @@ Evaluates the given function with the current handle as its first argument. class JSHandle { evaluateHandle< Params extends unknown[], - Func extends EvaluateFuncWith = EvaluateFuncWith + Func extends EvaluateFuncWith = EvaluateFuncWith, >( pageFunction: Func | string, ...args: Params diff --git a/docs/api/puppeteer.jshandle.jsonvalue.md b/docs/api/puppeteer.jshandle.jsonvalue.md index 4e54fe9fbb50c..6f33818ba2888 100644 --- a/docs/api/puppeteer.jshandle.jsonvalue.md +++ b/docs/api/puppeteer.jshandle.jsonvalue.md @@ -4,6 +4,8 @@ sidebar_label: JSHandle.jsonValue # JSHandle.jsonValue() method +A vanilla object representing the serializable portions of the referenced object. + #### Signature: ```typescript @@ -16,8 +18,6 @@ class JSHandle { Promise<T> -A vanilla object representing the serializable portions of the referenced object. - ## Exceptions Throws if the object cannot be serialized due to circularity. diff --git a/docs/api/puppeteer.jshandle.md b/docs/api/puppeteer.jshandle.md index 3cf60fe506324..f5c50954d9c0d 100644 --- a/docs/api/puppeteer.jshandle.md +++ b/docs/api/puppeteer.jshandle.md @@ -28,22 +28,22 @@ const windowHandle = await page.evaluateHandle(() => window); ## Properties -| Property | Modifiers | Type | Description | -| --------------------------------------------------------------------- | --------- | ---- | --------------------------------------------------------------------------- | -| [\[\_\_JSHandleSymbol\]?](./puppeteer.jshandle.___jshandlesymbol_.md) | | T | _(Optional)_ Used for nominally typing [JSHandle](./puppeteer.jshandle.md). | +| Property | Modifiers | Type | Description | +| -------- | --------------------- | ---- | -------------------------------------------------------------- | +| \_ | optional | T | Used for nominally typing [JSHandle](./puppeteer.jshandle.md). | ## Methods -| Method | Modifiers | Description | -| ---------------------------------------------------------------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [asElement()](./puppeteer.jshandle.aselement.md) | | | -| [dispose()](./puppeteer.jshandle.dispose.md) | | Releases the object referenced by the handle for garbage collection. | -| [evaluate(pageFunction, args)](./puppeteer.jshandle.evaluate.md) | | Evaluates the given function with the current handle as its first argument. | -| [evaluateHandle(pageFunction, args)](./puppeteer.jshandle.evaluatehandle.md) | | Evaluates the given function with the current handle as its first argument. | -| [getProperties()](./puppeteer.jshandle.getproperties.md) | | Gets a map of handles representing the properties of the current handle. | -| [getProperty(propertyName)](./puppeteer.jshandle.getproperty.md) | | Fetches a single property from the referenced object. | -| [getProperty(propertyName)](./puppeteer.jshandle.getproperty_1.md) | | | -| [getProperty(propertyName)](./puppeteer.jshandle.getproperty_2.md) | | | -| [jsonValue()](./puppeteer.jshandle.jsonvalue.md) | | | -| [remoteObject()](./puppeteer.jshandle.remoteobject.md) | | Provides access to the \[Protocol.Runtime.RemoteObject\](https://chromedevtools.github.io/devtools-protocol/tot/Runtime/\#type-RemoteObject) backing this handle. | -| [toString()](./puppeteer.jshandle.tostring.md) | | Returns a string representation of the JSHandle. | +| Method | Modifiers | Description | +| ---------------------------------------------------------------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [asElement()](./puppeteer.jshandle.aselement.md) | | Either null or the handle itself if the handle is an instance of [ElementHandle](./puppeteer.elementhandle.md). | +| [dispose()](./puppeteer.jshandle.dispose.md) | | Releases the object referenced by the handle for garbage collection. | +| [evaluate(pageFunction, args)](./puppeteer.jshandle.evaluate.md) | | Evaluates the given function with the current handle as its first argument. | +| [evaluateHandle(pageFunction, args)](./puppeteer.jshandle.evaluatehandle.md) | | Evaluates the given function with the current handle as its first argument. | +| [getProperties()](./puppeteer.jshandle.getproperties.md) | | Gets a map of handles representing the properties of the current handle. | +| [getProperty(propertyName)](./puppeteer.jshandle.getproperty.md) | | Fetches a single property from the referenced object. | +| [getProperty(propertyName)](./puppeteer.jshandle.getproperty_1.md) | | | +| [getProperty(propertyName)](./puppeteer.jshandle.getproperty_2.md) | | | +| [jsonValue()](./puppeteer.jshandle.jsonvalue.md) | | A vanilla object representing the serializable portions of the referenced object. | +| [remoteObject()](./puppeteer.jshandle.remoteobject.md) | | Provides access to the [Protocol.Runtime.RemoteObject](https://chromedevtools.github.io/devtools-protocol/tot/Runtime/#type-RemoteObject) backing this handle. | +| [toString()](./puppeteer.jshandle.tostring.md) | | Returns a string representation of the JSHandle. | diff --git a/docs/api/puppeteer.jshandle.remoteobject.md b/docs/api/puppeteer.jshandle.remoteobject.md index b0d735357377a..7c29daae1d6d1 100644 --- a/docs/api/puppeteer.jshandle.remoteobject.md +++ b/docs/api/puppeteer.jshandle.remoteobject.md @@ -4,7 +4,7 @@ sidebar_label: JSHandle.remoteObject # JSHandle.remoteObject() method -Provides access to the \[Protocol.Runtime.RemoteObject\](https://chromedevtools.github.io/devtools-protocol/tot/Runtime/\#type-RemoteObject) backing this handle. +Provides access to the [Protocol.Runtime.RemoteObject](https://chromedevtools.github.io/devtools-protocol/tot/Runtime/#type-RemoteObject) backing this handle. #### Signature: diff --git a/docs/api/puppeteer.keyboard.down.md b/docs/api/puppeteer.keyboard.down.md index 3f7c6cfe6dd4e..cd972ca243879 100644 --- a/docs/api/puppeteer.keyboard.down.md +++ b/docs/api/puppeteer.keyboard.down.md @@ -10,22 +10,16 @@ Dispatches a `keydown` event. ```typescript class Keyboard { - down( - key: KeyInput, - options?: { - text?: string; - commands?: string[]; - } - ): Promise; + down(key: KeyInput, options?: Readonly): Promise; } ``` ## Parameters -| Parameter | Type | Description | -| --------- | ----------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| key | [KeyInput](./puppeteer.keyinput.md) | Name of key to press, such as ArrowLeft. See [KeyInput](./puppeteer.keyinput.md) for a list of all key names. | -| options | { text?: string; commands?: string\[\]; } | _(Optional)_ An object of options. Accepts text which, if specified, generates an input event with this text. Accepts commands which, if specified, is the commands of keyboard shortcuts, see [Chromium Source Code](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/editing/commands/editor_command_names.h) for valid command names. | +| Parameter | Type | Description | +| --------- | --------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| key | [KeyInput](./puppeteer.keyinput.md) | Name of key to press, such as ArrowLeft. See [KeyInput](./puppeteer.keyinput.md) for a list of all key names. | +| options | Readonly<[KeyDownOptions](./puppeteer.keydownoptions.md)> | _(Optional)_ An object of options. Accepts text which, if specified, generates an input event with this text. Accepts commands which, if specified, is the commands of keyboard shortcuts, see [Chromium Source Code](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/editing/commands/editor_command_names.h) for valid command names. | **Returns:** diff --git a/docs/api/puppeteer.keyboard.press.md b/docs/api/puppeteer.keyboard.press.md index ff585937c3d28..8edb6342da980 100644 --- a/docs/api/puppeteer.keyboard.press.md +++ b/docs/api/puppeteer.keyboard.press.md @@ -10,23 +10,16 @@ Shortcut for [Keyboard.down()](./puppeteer.keyboard.down.md) and [Keyboard.up()] ```typescript class Keyboard { - press( - key: KeyInput, - options?: { - delay?: number; - text?: string; - commands?: string[]; - } - ): Promise; + press(key: KeyInput, options?: Readonly): Promise; } ``` ## Parameters -| Parameter | Type | Description | -| --------- | --------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| key | [KeyInput](./puppeteer.keyinput.md) | Name of key to press, such as ArrowLeft. See [KeyInput](./puppeteer.keyinput.md) for a list of all key names. | -| options | { delay?: number; text?: string; commands?: string\[\]; } | _(Optional)_ An object of options. Accepts text which, if specified, generates an input event with this text. Accepts delay which, if specified, is the time to wait between keydown and keyup in milliseconds. Defaults to 0. Accepts commands which, if specified, is the commands of keyboard shortcuts, see [Chromium Source Code](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/editing/commands/editor_command_names.h) for valid command names. | +| Parameter | Type | Description | +| --------- | ----------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| key | [KeyInput](./puppeteer.keyinput.md) | Name of key to press, such as ArrowLeft. See [KeyInput](./puppeteer.keyinput.md) for a list of all key names. | +| options | Readonly<[KeyPressOptions](./puppeteer.keypressoptions.md)> | _(Optional)_ An object of options. Accepts text which, if specified, generates an input event with this text. Accepts delay which, if specified, is the time to wait between keydown and keyup in milliseconds. Defaults to 0. Accepts commands which, if specified, is the commands of keyboard shortcuts, see [Chromium Source Code](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/editing/commands/editor_command_names.h) for valid command names. | **Returns:** diff --git a/docs/api/puppeteer.keyboard.type.md b/docs/api/puppeteer.keyboard.type.md index 21c2f0a6c9e38..b9a09d149ef47 100644 --- a/docs/api/puppeteer.keyboard.type.md +++ b/docs/api/puppeteer.keyboard.type.md @@ -10,21 +10,16 @@ Sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in t ```typescript class Keyboard { - type( - text: string, - options?: { - delay?: number; - } - ): Promise; + type(text: string, options?: Readonly): Promise; } ``` ## Parameters -| Parameter | Type | Description | -| --------- | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| text | string | A text to type into a focused element. | -| options | { delay?: number; } | _(Optional)_ An object of options. Accepts delay which, if specified, is the time to wait between keydown and keyup in milliseconds. Defaults to 0. | +| Parameter | Type | Description | +| --------- | ------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| text | string | A text to type into a focused element. | +| options | Readonly<[KeyboardTypeOptions](./puppeteer.keyboardtypeoptions.md)> | _(Optional)_ An object of options. Accepts delay which, if specified, is the time to wait between keydown and keyup in milliseconds. Defaults to 0. | **Returns:** diff --git a/docs/api/puppeteer.keyboardtypeoptions.md b/docs/api/puppeteer.keyboardtypeoptions.md new file mode 100644 index 0000000000000..e1dda7891643d --- /dev/null +++ b/docs/api/puppeteer.keyboardtypeoptions.md @@ -0,0 +1,17 @@ +--- +sidebar_label: KeyboardTypeOptions +--- + +# KeyboardTypeOptions interface + +#### Signature: + +```typescript +export interface KeyboardTypeOptions +``` + +## Properties + +| Property | Modifiers | Type | Description | Default | +| -------- | --------------------- | ------ | ----------- | ------- | +| delay | optional | number | | | diff --git a/docs/api/puppeteer.keydownoptions.md b/docs/api/puppeteer.keydownoptions.md new file mode 100644 index 0000000000000..d931426da844e --- /dev/null +++ b/docs/api/puppeteer.keydownoptions.md @@ -0,0 +1,18 @@ +--- +sidebar_label: KeyDownOptions +--- + +# KeyDownOptions interface + +#### Signature: + +```typescript +export interface KeyDownOptions +``` + +## Properties + +| Property | Modifiers | Type | Description | Default | +| -------- | --------------------- | ---------- | ----------- | ------- | +| commands | optional | string\[\] | | | +| text | optional | string | | | diff --git a/docs/api/puppeteer.keypressoptions.md b/docs/api/puppeteer.keypressoptions.md new file mode 100644 index 0000000000000..72a43e4596e93 --- /dev/null +++ b/docs/api/puppeteer.keypressoptions.md @@ -0,0 +1,13 @@ +--- +sidebar_label: KeyPressOptions +--- + +# KeyPressOptions type + +#### Signature: + +```typescript +export type KeyPressOptions = KeyDownOptions & KeyboardTypeOptions; +``` + +**References:** [KeyDownOptions](./puppeteer.keydownoptions.md), [KeyboardTypeOptions](./puppeteer.keyboardtypeoptions.md) diff --git a/docs/api/puppeteer.launchoptions.channel.md b/docs/api/puppeteer.launchoptions.channel.md deleted file mode 100644 index 53f31135d2a57..0000000000000 --- a/docs/api/puppeteer.launchoptions.channel.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: LaunchOptions.channel ---- - -# LaunchOptions.channel property - -Chrome Release Channel - -#### Signature: - -```typescript -interface LaunchOptions { - channel?: ChromeReleaseChannel; -} -``` diff --git a/docs/api/puppeteer.launchoptions.dumpio.md b/docs/api/puppeteer.launchoptions.dumpio.md deleted file mode 100644 index ccb5b351e6dcf..0000000000000 --- a/docs/api/puppeteer.launchoptions.dumpio.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: LaunchOptions.dumpio ---- - -# LaunchOptions.dumpio property - -If true, pipes the browser process stdout and stderr to `process.stdout` and `process.stderr`. - -#### Signature: - -```typescript -interface LaunchOptions { - dumpio?: boolean; -} -``` - -#### Default value: - -false diff --git a/docs/api/puppeteer.launchoptions.env.md b/docs/api/puppeteer.launchoptions.env.md deleted file mode 100644 index 0b174166269e2..0000000000000 --- a/docs/api/puppeteer.launchoptions.env.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: LaunchOptions.env ---- - -# LaunchOptions.env property - -Specify environment variables that will be visible to the browser. - -#### Signature: - -```typescript -interface LaunchOptions { - env?: Record; -} -``` - -#### Default value: - -The contents of `process.env`. diff --git a/docs/api/puppeteer.launchoptions.executablepath.md b/docs/api/puppeteer.launchoptions.executablepath.md deleted file mode 100644 index 3b696d42ea8c1..0000000000000 --- a/docs/api/puppeteer.launchoptions.executablepath.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: LaunchOptions.executablePath ---- - -# LaunchOptions.executablePath property - -Path to a browser executable to use instead of the bundled Chromium. Note that Puppeteer is only guaranteed to work with the bundled Chromium, so use this setting at your own risk. - -#### Signature: - -```typescript -interface LaunchOptions { - executablePath?: string; -} -``` diff --git a/docs/api/puppeteer.launchoptions.extraprefsfirefox.md b/docs/api/puppeteer.launchoptions.extraprefsfirefox.md deleted file mode 100644 index e7fb108d7ddb3..0000000000000 --- a/docs/api/puppeteer.launchoptions.extraprefsfirefox.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: LaunchOptions.extraPrefsFirefox ---- - -# LaunchOptions.extraPrefsFirefox property - -[Additional preferences](https://searchfox.org/mozilla-release/source/modules/libpref/init/all.js) that can be passed when launching with Firefox. - -#### Signature: - -```typescript -interface LaunchOptions { - extraPrefsFirefox?: Record; -} -``` diff --git a/docs/api/puppeteer.launchoptions.handlesighup.md b/docs/api/puppeteer.launchoptions.handlesighup.md deleted file mode 100644 index c4d4a389da4a1..0000000000000 --- a/docs/api/puppeteer.launchoptions.handlesighup.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: LaunchOptions.handleSIGHUP ---- - -# LaunchOptions.handleSIGHUP property - -Close the browser process on `SIGHUP`. - -#### Signature: - -```typescript -interface LaunchOptions { - handleSIGHUP?: boolean; -} -``` - -#### Default value: - -`true` diff --git a/docs/api/puppeteer.launchoptions.handlesigint.md b/docs/api/puppeteer.launchoptions.handlesigint.md deleted file mode 100644 index 2d6edd4653e1e..0000000000000 --- a/docs/api/puppeteer.launchoptions.handlesigint.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: LaunchOptions.handleSIGINT ---- - -# LaunchOptions.handleSIGINT property - -Close the browser process on `Ctrl+C`. - -#### Signature: - -```typescript -interface LaunchOptions { - handleSIGINT?: boolean; -} -``` - -#### Default value: - -`true` diff --git a/docs/api/puppeteer.launchoptions.handlesigterm.md b/docs/api/puppeteer.launchoptions.handlesigterm.md deleted file mode 100644 index f9ff889dbc093..0000000000000 --- a/docs/api/puppeteer.launchoptions.handlesigterm.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: LaunchOptions.handleSIGTERM ---- - -# LaunchOptions.handleSIGTERM property - -Close the browser process on `SIGTERM`. - -#### Signature: - -```typescript -interface LaunchOptions { - handleSIGTERM?: boolean; -} -``` - -#### Default value: - -`true` diff --git a/docs/api/puppeteer.launchoptions.ignoredefaultargs.md b/docs/api/puppeteer.launchoptions.ignoredefaultargs.md deleted file mode 100644 index f759a097ff203..0000000000000 --- a/docs/api/puppeteer.launchoptions.ignoredefaultargs.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: LaunchOptions.ignoreDefaultArgs ---- - -# LaunchOptions.ignoreDefaultArgs property - -If `true`, do not use `puppeteer.defaultArgs()` when creating a browser. If an array is provided, these args will be filtered out. Use this with care - you probably want the default arguments Puppeteer uses. - -#### Signature: - -```typescript -interface LaunchOptions { - ignoreDefaultArgs?: boolean | string[]; -} -``` - -#### Default value: - -false diff --git a/docs/api/puppeteer.launchoptions.md b/docs/api/puppeteer.launchoptions.md index ea86814cbcc68..e6b28d3502863 100644 --- a/docs/api/puppeteer.launchoptions.md +++ b/docs/api/puppeteer.launchoptions.md @@ -14,18 +14,18 @@ export interface LaunchOptions ## Properties -| Property | Modifiers | Type | Description | Default | -| ---------------------------------------------------------------------- | --------- | ----------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------- | -| [channel?](./puppeteer.launchoptions.channel.md) | | [ChromeReleaseChannel](./puppeteer.chromereleasechannel.md) | _(Optional)_ Chrome Release Channel | | -| [dumpio?](./puppeteer.launchoptions.dumpio.md) | | boolean | _(Optional)_ If true, pipes the browser process stdout and stderr to process.stdout and process.stderr. | false | -| [env?](./puppeteer.launchoptions.env.md) | | Record<string, string \| undefined> | _(Optional)_ Specify environment variables that will be visible to the browser. | The contents of process.env. | -| [executablePath?](./puppeteer.launchoptions.executablepath.md) | | string | _(Optional)_ Path to a browser executable to use instead of the bundled Chromium. Note that Puppeteer is only guaranteed to work with the bundled Chromium, so use this setting at your own risk. | | -| [extraPrefsFirefox?](./puppeteer.launchoptions.extraprefsfirefox.md) | | Record<string, unknown> | _(Optional)_ [Additional preferences](https://searchfox.org/mozilla-release/source/modules/libpref/init/all.js) that can be passed when launching with Firefox. | | -| [handleSIGHUP?](./puppeteer.launchoptions.handlesighup.md) | | boolean | _(Optional)_ Close the browser process on SIGHUP. | true | -| [handleSIGINT?](./puppeteer.launchoptions.handlesigint.md) | | boolean | _(Optional)_ Close the browser process on Ctrl+C. | true | -| [handleSIGTERM?](./puppeteer.launchoptions.handlesigterm.md) | | boolean | _(Optional)_ Close the browser process on SIGTERM. | true | -| [ignoreDefaultArgs?](./puppeteer.launchoptions.ignoredefaultargs.md) | | boolean \| string\[\] | _(Optional)_ If true, do not use puppeteer.defaultArgs() when creating a browser. If an array is provided, these args will be filtered out. Use this with care - you probably want the default arguments Puppeteer uses. | false | -| [pipe?](./puppeteer.launchoptions.pipe.md) | | boolean | _(Optional)_ Connect to a browser over a pipe instead of a WebSocket. | false | -| [product?](./puppeteer.launchoptions.product.md) | | [Product](./puppeteer.product.md) | _(Optional)_ Which browser to launch. | chrome | -| [timeout?](./puppeteer.launchoptions.timeout.md) | | number | _(Optional)_ Maximum time in milliseconds to wait for the browser to start. Pass 0 to disable the timeout. | 30000 (30 seconds). | -| [waitForInitialPage?](./puppeteer.launchoptions.waitforinitialpage.md) | | boolean | _(Optional)_ Whether to wait for the initial page to be ready. Useful when a user explicitly disables that (e.g. --no-startup-window for Chrome). | true | +| Property | Modifiers | Type | Description | Default | +| ------------------ | --------------------- | ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------- | +| channel | optional | [ChromeReleaseChannel](./puppeteer.chromereleasechannel.md) | Chrome Release Channel | | +| dumpio | optional | boolean | If true, pipes the browser process stdout and stderr to process.stdout and process.stderr. | false | +| env | optional | Record<string, string \| undefined> | Specify environment variables that will be visible to the browser. | The contents of process.env. | +| executablePath | optional | string | Path to a browser executable to use instead of the bundled Chromium. Note that Puppeteer is only guaranteed to work with the bundled Chromium, so use this setting at your own risk. | | +| extraPrefsFirefox | optional | Record<string, unknown> | [Additional preferences](https://searchfox.org/mozilla-release/source/modules/libpref/init/all.js) that can be passed when launching with Firefox. | | +| handleSIGHUP | optional | boolean | Close the browser process on SIGHUP. | true | +| handleSIGINT | optional | boolean | Close the browser process on Ctrl+C. | true | +| handleSIGTERM | optional | boolean | Close the browser process on SIGTERM. | true | +| ignoreDefaultArgs | optional | boolean \| string\[\] | If true, do not use puppeteer.defaultArgs() when creating a browser. If an array is provided, these args will be filtered out. Use this with care - you probably want the default arguments Puppeteer uses. | false | +| pipe | optional | boolean | Connect to a browser over a pipe instead of a WebSocket. | false | +| product | optional | [Product](./puppeteer.product.md) | Which browser to launch. | chrome | +| timeout | optional | number | Maximum time in milliseconds to wait for the browser to start. Pass 0 to disable the timeout. | 30_000 (30 seconds). | +| waitForInitialPage | optional | boolean | Whether to wait for the initial page to be ready. Useful when a user explicitly disables that (e.g. --no-startup-window for Chrome). | true | diff --git a/docs/api/puppeteer.launchoptions.pipe.md b/docs/api/puppeteer.launchoptions.pipe.md deleted file mode 100644 index fd78c5e6b712d..0000000000000 --- a/docs/api/puppeteer.launchoptions.pipe.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: LaunchOptions.pipe ---- - -# LaunchOptions.pipe property - -Connect to a browser over a pipe instead of a WebSocket. - -#### Signature: - -```typescript -interface LaunchOptions { - pipe?: boolean; -} -``` - -#### Default value: - -false diff --git a/docs/api/puppeteer.launchoptions.product.md b/docs/api/puppeteer.launchoptions.product.md deleted file mode 100644 index 13c262a33797a..0000000000000 --- a/docs/api/puppeteer.launchoptions.product.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: LaunchOptions.product ---- - -# LaunchOptions.product property - -Which browser to launch. - -#### Signature: - -```typescript -interface LaunchOptions { - product?: Product; -} -``` - -#### Default value: - -`chrome` diff --git a/docs/api/puppeteer.launchoptions.timeout.md b/docs/api/puppeteer.launchoptions.timeout.md deleted file mode 100644 index cba2af5fd7a91..0000000000000 --- a/docs/api/puppeteer.launchoptions.timeout.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: LaunchOptions.timeout ---- - -# LaunchOptions.timeout property - -Maximum time in milliseconds to wait for the browser to start. Pass `0` to disable the timeout. - -#### Signature: - -```typescript -interface LaunchOptions { - timeout?: number; -} -``` - -#### Default value: - -30000 (30 seconds). diff --git a/docs/api/puppeteer.launchoptions.waitforinitialpage.md b/docs/api/puppeteer.launchoptions.waitforinitialpage.md deleted file mode 100644 index ec97fb39644b3..0000000000000 --- a/docs/api/puppeteer.launchoptions.waitforinitialpage.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: LaunchOptions.waitForInitialPage ---- - -# LaunchOptions.waitForInitialPage property - -Whether to wait for the initial page to be ready. Useful when a user explicitly disables that (e.g. `--no-startup-window` for Chrome). - -#### Signature: - -```typescript -interface LaunchOptions { - waitForInitialPage?: boolean; -} -``` - -#### Default value: - -true diff --git a/docs/api/puppeteer.locator.click.md b/docs/api/puppeteer.locator.click.md new file mode 100644 index 0000000000000..0b0cce00774fc --- /dev/null +++ b/docs/api/puppeteer.locator.click.md @@ -0,0 +1,27 @@ +--- +sidebar_label: Locator.click +--- + +# Locator.click() method + +#### Signature: + +```typescript +class Locator { + abstract click( + this: Locator, + options?: Readonly + ): Promise; +} +``` + +## Parameters + +| Parameter | Type | Description | +| --------- | ------------------------------------------------------------------------- | ------------ | +| this | [Locator](./puppeteer.locator.md)<ElementType> | | +| options | Readonly<[LocatorClickOptions](./puppeteer.locatorclickoptions.md)> | _(Optional)_ | + +**Returns:** + +Promise<void> diff --git a/docs/api/puppeteer.locator.fill.md b/docs/api/puppeteer.locator.fill.md new file mode 100644 index 0000000000000..3f622bbd6849b --- /dev/null +++ b/docs/api/puppeteer.locator.fill.md @@ -0,0 +1,31 @@ +--- +sidebar_label: Locator.fill +--- + +# Locator.fill() method + +Fills out the input identified by the locator using the provided value. The type of the input is determined at runtime and the appropriate fill-out method is chosen based on the type. contenteditable, selector, inputs are supported. + +#### Signature: + +```typescript +class Locator { + abstract fill( + this: Locator, + value: string, + options?: Readonly + ): Promise; +} +``` + +## Parameters + +| Parameter | Type | Description | +| --------- | ------------------------------------------------------------- | ------------ | +| this | [Locator](./puppeteer.locator.md)<ElementType> | | +| value | string | | +| options | Readonly<[ActionOptions](./puppeteer.actionoptions.md)> | _(Optional)_ | + +**Returns:** + +Promise<void> diff --git a/docs/api/puppeteer.locator.hover.md b/docs/api/puppeteer.locator.hover.md new file mode 100644 index 0000000000000..b1ece20715c96 --- /dev/null +++ b/docs/api/puppeteer.locator.hover.md @@ -0,0 +1,27 @@ +--- +sidebar_label: Locator.hover +--- + +# Locator.hover() method + +#### Signature: + +```typescript +class Locator { + abstract hover( + this: Locator, + options?: Readonly + ): Promise; +} +``` + +## Parameters + +| Parameter | Type | Description | +| --------- | ------------------------------------------------------------- | ------------ | +| this | [Locator](./puppeteer.locator.md)<ElementType> | | +| options | Readonly<[ActionOptions](./puppeteer.actionoptions.md)> | _(Optional)_ | + +**Returns:** + +Promise<void> diff --git a/docs/api/puppeteer.locator.md b/docs/api/puppeteer.locator.md new file mode 100644 index 0000000000000..9adeefa5bdf31 --- /dev/null +++ b/docs/api/puppeteer.locator.md @@ -0,0 +1,39 @@ +--- +sidebar_label: Locator +--- + +# Locator class + +Locators describe a strategy of locating elements and performing an action on them. If the action fails because the element is not ready for the action, the whole operation is retried. Various preconditions for a successful action are checked automatically. + +#### Signature: + +```typescript +export declare abstract class Locator extends EventEmitter +``` + +**Extends:** [EventEmitter](./puppeteer.eventemitter.md) + +## Properties + +| Property | Modifiers | Type | Description | +| -------- | --------------------- | ---- | ------------------------------------------------------------ | +| \_ | optional | T | Used for nominally typing [Locator](./puppeteer.locator.md). | + +## Methods + +| Method | Modifiers | Description | +| ------------------------------------------------------------------------------------------------ | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [click(this, options)](./puppeteer.locator.click.md) | | | +| [fill(this, value, options)](./puppeteer.locator.fill.md) | | Fills out the input identified by the locator using the provided value. The type of the input is determined at runtime and the appropriate fill-out method is chosen based on the type. contenteditable, selector, inputs are supported. | +| [hover(this, options)](./puppeteer.locator.hover.md) | | | +| [off(eventName, handler)](./puppeteer.locator.off.md) | | | +| [on(eventName, handler)](./puppeteer.locator.on.md) | | | +| [once(eventName, handler)](./puppeteer.locator.once.md) | | | +| [race(locators)](./puppeteer.locator.race.md) | static | Creates a race between multiple locators but ensures that only a single one acts. | +| [scroll(this, options)](./puppeteer.locator.scroll.md) | | | +| [setEnsureElementIsInTheViewport(value)](./puppeteer.locator.setensureelementisintheviewport.md) | | | +| [setTimeout(timeout)](./puppeteer.locator.settimeout.md) | | | +| [setVisibility(visibility)](./puppeteer.locator.setvisibility.md) | | | +| [setWaitForEnabled(value)](./puppeteer.locator.setwaitforenabled.md) | | | +| [setWaitForStableBoundingBox(value)](./puppeteer.locator.setwaitforstableboundingbox.md) | | | diff --git a/docs/api/puppeteer.locator.off.md b/docs/api/puppeteer.locator.off.md new file mode 100644 index 0000000000000..94d8ff142e695 --- /dev/null +++ b/docs/api/puppeteer.locator.off.md @@ -0,0 +1,27 @@ +--- +sidebar_label: Locator.off +--- + +# Locator.off() method + +#### Signature: + +```typescript +class Locator { + off( + eventName: K, + handler: (event: LocatorEventObject[K]) => void + ): this; +} +``` + +## Parameters + +| Parameter | Type | Description | +| --------- | -------------------------------------------------------------------------------- | ----------- | +| eventName | K | | +| handler | (event: [LocatorEventObject](./puppeteer.locatoreventobject.md)\[K\]) => void | | + +**Returns:** + +this diff --git a/docs/api/puppeteer.locator.on.md b/docs/api/puppeteer.locator.on.md new file mode 100644 index 0000000000000..487e21412cb52 --- /dev/null +++ b/docs/api/puppeteer.locator.on.md @@ -0,0 +1,27 @@ +--- +sidebar_label: Locator.on +--- + +# Locator.on() method + +#### Signature: + +```typescript +class Locator { + on( + eventName: K, + handler: (event: LocatorEventObject[K]) => void + ): this; +} +``` + +## Parameters + +| Parameter | Type | Description | +| --------- | -------------------------------------------------------------------------------- | ----------- | +| eventName | K | | +| handler | (event: [LocatorEventObject](./puppeteer.locatoreventobject.md)\[K\]) => void | | + +**Returns:** + +this diff --git a/docs/api/puppeteer.locator.once.md b/docs/api/puppeteer.locator.once.md new file mode 100644 index 0000000000000..54037d294c210 --- /dev/null +++ b/docs/api/puppeteer.locator.once.md @@ -0,0 +1,27 @@ +--- +sidebar_label: Locator.once +--- + +# Locator.once() method + +#### Signature: + +```typescript +class Locator { + once( + eventName: K, + handler: (event: LocatorEventObject[K]) => void + ): this; +} +``` + +## Parameters + +| Parameter | Type | Description | +| --------- | -------------------------------------------------------------------------------- | ----------- | +| eventName | K | | +| handler | (event: [LocatorEventObject](./puppeteer.locatoreventobject.md)\[K\]) => void | | + +**Returns:** + +this diff --git a/docs/api/puppeteer.locator.race.md b/docs/api/puppeteer.locator.race.md new file mode 100644 index 0000000000000..642df259b9cf2 --- /dev/null +++ b/docs/api/puppeteer.locator.race.md @@ -0,0 +1,27 @@ +--- +sidebar_label: Locator.race +--- + +# Locator.race() method + +Creates a race between multiple locators but ensures that only a single one acts. + +#### Signature: + +```typescript +class Locator { + static race>>( + locators: Locators + ): Locator>; +} +``` + +## Parameters + +| Parameter | Type | Description | +| --------- | -------- | ----------- | +| locators | Locators | | + +**Returns:** + +[Locator](./puppeteer.locator.md)<[UnionLocatorOf](./puppeteer.unionlocatorof.md)<Locators>> diff --git a/docs/api/puppeteer.locator.scroll.md b/docs/api/puppeteer.locator.scroll.md new file mode 100644 index 0000000000000..ca58be382cfe6 --- /dev/null +++ b/docs/api/puppeteer.locator.scroll.md @@ -0,0 +1,27 @@ +--- +sidebar_label: Locator.scroll +--- + +# Locator.scroll() method + +#### Signature: + +```typescript +class Locator { + abstract scroll( + this: Locator, + options?: Readonly + ): Promise; +} +``` + +## Parameters + +| Parameter | Type | Description | +| --------- | --------------------------------------------------------------------------- | ------------ | +| this | [Locator](./puppeteer.locator.md)<ElementType> | | +| options | Readonly<[LocatorScrollOptions](./puppeteer.locatorscrolloptions.md)> | _(Optional)_ | + +**Returns:** + +Promise<void> diff --git a/docs/api/puppeteer.locator.setensureelementisintheviewport.md b/docs/api/puppeteer.locator.setensureelementisintheviewport.md new file mode 100644 index 0000000000000..37de38bdcb507 --- /dev/null +++ b/docs/api/puppeteer.locator.setensureelementisintheviewport.md @@ -0,0 +1,23 @@ +--- +sidebar_label: Locator.setEnsureElementIsInTheViewport +--- + +# Locator.setEnsureElementIsInTheViewport() method + +#### Signature: + +```typescript +class Locator { + abstract setEnsureElementIsInTheViewport(value: boolean): this; +} +``` + +## Parameters + +| Parameter | Type | Description | +| --------- | ------- | ----------- | +| value | boolean | | + +**Returns:** + +this diff --git a/docs/api/puppeteer.locator.settimeout.md b/docs/api/puppeteer.locator.settimeout.md new file mode 100644 index 0000000000000..da7508c93dfd7 --- /dev/null +++ b/docs/api/puppeteer.locator.settimeout.md @@ -0,0 +1,23 @@ +--- +sidebar_label: Locator.setTimeout +--- + +# Locator.setTimeout() method + +#### Signature: + +```typescript +class Locator { + abstract setTimeout(timeout: number): this; +} +``` + +## Parameters + +| Parameter | Type | Description | +| --------- | ------ | ----------- | +| timeout | number | | + +**Returns:** + +this diff --git a/docs/api/puppeteer.locator.setvisibility.md b/docs/api/puppeteer.locator.setvisibility.md new file mode 100644 index 0000000000000..1cab9ec8a2882 --- /dev/null +++ b/docs/api/puppeteer.locator.setvisibility.md @@ -0,0 +1,23 @@ +--- +sidebar_label: Locator.setVisibility +--- + +# Locator.setVisibility() method + +#### Signature: + +```typescript +class Locator { + abstract setVisibility(visibility: VisibilityOption): this; +} +``` + +## Parameters + +| Parameter | Type | Description | +| ---------- | --------------------------------------------------- | ----------- | +| visibility | [VisibilityOption](./puppeteer.visibilityoption.md) | | + +**Returns:** + +this diff --git a/docs/api/puppeteer.locator.setwaitforenabled.md b/docs/api/puppeteer.locator.setwaitforenabled.md new file mode 100644 index 0000000000000..3b097f4023cea --- /dev/null +++ b/docs/api/puppeteer.locator.setwaitforenabled.md @@ -0,0 +1,23 @@ +--- +sidebar_label: Locator.setWaitForEnabled +--- + +# Locator.setWaitForEnabled() method + +#### Signature: + +```typescript +class Locator { + abstract setWaitForEnabled(value: boolean): this; +} +``` + +## Parameters + +| Parameter | Type | Description | +| --------- | ------- | ----------- | +| value | boolean | | + +**Returns:** + +this diff --git a/docs/api/puppeteer.locator.setwaitforstableboundingbox.md b/docs/api/puppeteer.locator.setwaitforstableboundingbox.md new file mode 100644 index 0000000000000..f76323a179923 --- /dev/null +++ b/docs/api/puppeteer.locator.setwaitforstableboundingbox.md @@ -0,0 +1,23 @@ +--- +sidebar_label: Locator.setWaitForStableBoundingBox +--- + +# Locator.setWaitForStableBoundingBox() method + +#### Signature: + +```typescript +class Locator { + abstract setWaitForStableBoundingBox(value: boolean): this; +} +``` + +## Parameters + +| Parameter | Type | Description | +| --------- | ------- | ----------- | +| value | boolean | | + +**Returns:** + +this diff --git a/docs/api/puppeteer.locatorclickoptions.md b/docs/api/puppeteer.locatorclickoptions.md new file mode 100644 index 0000000000000..99924331b68a1 --- /dev/null +++ b/docs/api/puppeteer.locatorclickoptions.md @@ -0,0 +1,13 @@ +--- +sidebar_label: LocatorClickOptions +--- + +# LocatorClickOptions type + +#### Signature: + +```typescript +export type LocatorClickOptions = ClickOptions & ActionOptions; +``` + +**References:** [ClickOptions](./puppeteer.clickoptions.md), [ActionOptions](./puppeteer.actionoptions.md) diff --git a/docs/api/puppeteer.locatoremittedevents.md b/docs/api/puppeteer.locatoremittedevents.md new file mode 100644 index 0000000000000..0d45cca2615b8 --- /dev/null +++ b/docs/api/puppeteer.locatoremittedevents.md @@ -0,0 +1,19 @@ +--- +sidebar_label: LocatorEmittedEvents +--- + +# LocatorEmittedEvents enum + +All the events that a locator instance may emit. + +#### Signature: + +```typescript +export declare enum LocatorEmittedEvents +``` + +## Enumeration Members + +| Member | Value | Description | +| ------ | ------------------------------- | ----------------------------------------------------------------------------------- | +| Action | "action" | Emitted every time before the locator performs an action on the located element(s). | diff --git a/docs/api/puppeteer.locatoreventobject.md b/docs/api/puppeteer.locatoreventobject.md new file mode 100644 index 0000000000000..8b70ec2a8b94d --- /dev/null +++ b/docs/api/puppeteer.locatoreventobject.md @@ -0,0 +1,17 @@ +--- +sidebar_label: LocatorEventObject +--- + +# LocatorEventObject interface + +#### Signature: + +```typescript +export interface LocatorEventObject +``` + +## Properties + +| Property | Modifiers | Type | Description | Default | +| -------- | --------- | ----- | ----------- | ------- | +| action | | never | | | diff --git a/docs/api/puppeteer.locatoroptions.md b/docs/api/puppeteer.locatoroptions.md new file mode 100644 index 0000000000000..8af6157226fe2 --- /dev/null +++ b/docs/api/puppeteer.locatoroptions.md @@ -0,0 +1,21 @@ +--- +sidebar_label: LocatorOptions +--- + +# LocatorOptions interface + +#### Signature: + +```typescript +export interface LocatorOptions +``` + +## Properties + +| Property | Modifiers | Type | Description | Default | +| ---------------------------- | --------- | --------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- | +| ensureElementIsInTheViewport | | boolean | Whether to scroll the element into viewport if not in the viewprot already. | true | +| timeout | | number |

Total timeout for the entire locator operation.

Pass 0 to disable timeout.

| Page.getDefaultTimeout() | +| visibility | | [VisibilityOption](./puppeteer.visibilityoption.md) | Whether to wait for the element to be visible or hidden. null to disable visibility checks. | | +| waitForEnabled | | boolean | Whether to wait for input elements to become enabled before the action. Applicable to click and fill actions. | true | +| waitForStableBoundingBox | | boolean | Whether to wait for the element's bounding box to be same between two animation frames. | true | diff --git a/docs/api/puppeteer.locatorscrolloptions.md b/docs/api/puppeteer.locatorscrolloptions.md new file mode 100644 index 0000000000000..a9a58ac05990a --- /dev/null +++ b/docs/api/puppeteer.locatorscrolloptions.md @@ -0,0 +1,20 @@ +--- +sidebar_label: LocatorScrollOptions +--- + +# LocatorScrollOptions interface + +#### Signature: + +```typescript +export interface LocatorScrollOptions extends ActionOptions +``` + +**Extends:** [ActionOptions](./puppeteer.actionoptions.md) + +## Properties + +| Property | Modifiers | Type | Description | Default | +| ---------- | --------------------- | ------ | ----------- | ------- | +| scrollLeft | optional | number | | | +| scrollTop | optional | number | | | diff --git a/docs/api/puppeteer.mediafeature.md b/docs/api/puppeteer.mediafeature.md index b1cba09f06dcf..15ef168add8d5 100644 --- a/docs/api/puppeteer.mediafeature.md +++ b/docs/api/puppeteer.mediafeature.md @@ -12,7 +12,7 @@ export interface MediaFeature ## Properties -| Property | Modifiers | Type | Description | Default | -| ------------------------------------------ | --------- | ------ | ----------- | ------- | -| [name](./puppeteer.mediafeature.name.md) | | string | | | -| [value](./puppeteer.mediafeature.value.md) | | string | | | +| Property | Modifiers | Type | Description | Default | +| -------- | --------- | ------ | ----------- | ------- | +| name | | string | | | +| value | | string | | | diff --git a/docs/api/puppeteer.mediafeature.name.md b/docs/api/puppeteer.mediafeature.name.md deleted file mode 100644 index 48ab38a258bfb..0000000000000 --- a/docs/api/puppeteer.mediafeature.name.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: MediaFeature.name ---- - -# MediaFeature.name property - -#### Signature: - -```typescript -interface MediaFeature { - name: string; -} -``` diff --git a/docs/api/puppeteer.mediafeature.value.md b/docs/api/puppeteer.mediafeature.value.md deleted file mode 100644 index 09c2c701140af..0000000000000 --- a/docs/api/puppeteer.mediafeature.value.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: MediaFeature.value ---- - -# MediaFeature.value property - -#### Signature: - -```typescript -interface MediaFeature { - value: string; -} -``` diff --git a/docs/api/puppeteer.metrics.documents.md b/docs/api/puppeteer.metrics.documents.md deleted file mode 100644 index 3686926642adb..0000000000000 --- a/docs/api/puppeteer.metrics.documents.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: Metrics.Documents ---- - -# Metrics.Documents property - -#### Signature: - -```typescript -interface Metrics { - Documents?: number; -} -``` diff --git a/docs/api/puppeteer.metrics.frames.md b/docs/api/puppeteer.metrics.frames.md deleted file mode 100644 index fc5a0559cb00e..0000000000000 --- a/docs/api/puppeteer.metrics.frames.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: Metrics.Frames ---- - -# Metrics.Frames property - -#### Signature: - -```typescript -interface Metrics { - Frames?: number; -} -``` diff --git a/docs/api/puppeteer.metrics.jseventlisteners.md b/docs/api/puppeteer.metrics.jseventlisteners.md deleted file mode 100644 index a8aba55ad969a..0000000000000 --- a/docs/api/puppeteer.metrics.jseventlisteners.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: Metrics.JSEventListeners ---- - -# Metrics.JSEventListeners property - -#### Signature: - -```typescript -interface Metrics { - JSEventListeners?: number; -} -``` diff --git a/docs/api/puppeteer.metrics.jsheaptotalsize.md b/docs/api/puppeteer.metrics.jsheaptotalsize.md deleted file mode 100644 index 9811c2c1853ff..0000000000000 --- a/docs/api/puppeteer.metrics.jsheaptotalsize.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: Metrics.JSHeapTotalSize ---- - -# Metrics.JSHeapTotalSize property - -#### Signature: - -```typescript -interface Metrics { - JSHeapTotalSize?: number; -} -``` diff --git a/docs/api/puppeteer.metrics.jsheapusedsize.md b/docs/api/puppeteer.metrics.jsheapusedsize.md deleted file mode 100644 index d381db7101c09..0000000000000 --- a/docs/api/puppeteer.metrics.jsheapusedsize.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: Metrics.JSHeapUsedSize ---- - -# Metrics.JSHeapUsedSize property - -#### Signature: - -```typescript -interface Metrics { - JSHeapUsedSize?: number; -} -``` diff --git a/docs/api/puppeteer.metrics.layoutcount.md b/docs/api/puppeteer.metrics.layoutcount.md deleted file mode 100644 index 3330939a23a1b..0000000000000 --- a/docs/api/puppeteer.metrics.layoutcount.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: Metrics.LayoutCount ---- - -# Metrics.LayoutCount property - -#### Signature: - -```typescript -interface Metrics { - LayoutCount?: number; -} -``` diff --git a/docs/api/puppeteer.metrics.layoutduration.md b/docs/api/puppeteer.metrics.layoutduration.md deleted file mode 100644 index 3833f372b7b31..0000000000000 --- a/docs/api/puppeteer.metrics.layoutduration.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: Metrics.LayoutDuration ---- - -# Metrics.LayoutDuration property - -#### Signature: - -```typescript -interface Metrics { - LayoutDuration?: number; -} -``` diff --git a/docs/api/puppeteer.metrics.md b/docs/api/puppeteer.metrics.md index d61639efec4a6..2c7fc61b236e9 100644 --- a/docs/api/puppeteer.metrics.md +++ b/docs/api/puppeteer.metrics.md @@ -12,18 +12,18 @@ export interface Metrics ## Properties -| Property | Modifiers | Type | Description | Default | -| ------------------------------------------------------------------ | --------- | ------ | ------------ | ------- | -| [Documents?](./puppeteer.metrics.documents.md) | | number | _(Optional)_ | | -| [Frames?](./puppeteer.metrics.frames.md) | | number | _(Optional)_ | | -| [JSEventListeners?](./puppeteer.metrics.jseventlisteners.md) | | number | _(Optional)_ | | -| [JSHeapTotalSize?](./puppeteer.metrics.jsheaptotalsize.md) | | number | _(Optional)_ | | -| [JSHeapUsedSize?](./puppeteer.metrics.jsheapusedsize.md) | | number | _(Optional)_ | | -| [LayoutCount?](./puppeteer.metrics.layoutcount.md) | | number | _(Optional)_ | | -| [LayoutDuration?](./puppeteer.metrics.layoutduration.md) | | number | _(Optional)_ | | -| [Nodes?](./puppeteer.metrics.nodes.md) | | number | _(Optional)_ | | -| [RecalcStyleCount?](./puppeteer.metrics.recalcstylecount.md) | | number | _(Optional)_ | | -| [RecalcStyleDuration?](./puppeteer.metrics.recalcstyleduration.md) | | number | _(Optional)_ | | -| [ScriptDuration?](./puppeteer.metrics.scriptduration.md) | | number | _(Optional)_ | | -| [TaskDuration?](./puppeteer.metrics.taskduration.md) | | number | _(Optional)_ | | -| [Timestamp?](./puppeteer.metrics.timestamp.md) | | number | _(Optional)_ | | +| Property | Modifiers | Type | Description | Default | +| ------------------- | --------------------- | ------ | ----------- | ------- | +| Documents | optional | number | | | +| Frames | optional | number | | | +| JSEventListeners | optional | number | | | +| JSHeapTotalSize | optional | number | | | +| JSHeapUsedSize | optional | number | | | +| LayoutCount | optional | number | | | +| LayoutDuration | optional | number | | | +| Nodes | optional | number | | | +| RecalcStyleCount | optional | number | | | +| RecalcStyleDuration | optional | number | | | +| ScriptDuration | optional | number | | | +| TaskDuration | optional | number | | | +| Timestamp | optional | number | | | diff --git a/docs/api/puppeteer.metrics.nodes.md b/docs/api/puppeteer.metrics.nodes.md deleted file mode 100644 index f6d7a2eef34ba..0000000000000 --- a/docs/api/puppeteer.metrics.nodes.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: Metrics.Nodes ---- - -# Metrics.Nodes property - -#### Signature: - -```typescript -interface Metrics { - Nodes?: number; -} -``` diff --git a/docs/api/puppeteer.metrics.recalcstylecount.md b/docs/api/puppeteer.metrics.recalcstylecount.md deleted file mode 100644 index 4c60682fa422a..0000000000000 --- a/docs/api/puppeteer.metrics.recalcstylecount.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: Metrics.RecalcStyleCount ---- - -# Metrics.RecalcStyleCount property - -#### Signature: - -```typescript -interface Metrics { - RecalcStyleCount?: number; -} -``` diff --git a/docs/api/puppeteer.metrics.recalcstyleduration.md b/docs/api/puppeteer.metrics.recalcstyleduration.md deleted file mode 100644 index edf19bf2da618..0000000000000 --- a/docs/api/puppeteer.metrics.recalcstyleduration.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: Metrics.RecalcStyleDuration ---- - -# Metrics.RecalcStyleDuration property - -#### Signature: - -```typescript -interface Metrics { - RecalcStyleDuration?: number; -} -``` diff --git a/docs/api/puppeteer.metrics.scriptduration.md b/docs/api/puppeteer.metrics.scriptduration.md deleted file mode 100644 index 2966f773a86ac..0000000000000 --- a/docs/api/puppeteer.metrics.scriptduration.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: Metrics.ScriptDuration ---- - -# Metrics.ScriptDuration property - -#### Signature: - -```typescript -interface Metrics { - ScriptDuration?: number; -} -``` diff --git a/docs/api/puppeteer.metrics.taskduration.md b/docs/api/puppeteer.metrics.taskduration.md deleted file mode 100644 index 4ef77e22225ec..0000000000000 --- a/docs/api/puppeteer.metrics.taskduration.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: Metrics.TaskDuration ---- - -# Metrics.TaskDuration property - -#### Signature: - -```typescript -interface Metrics { - TaskDuration?: number; -} -``` diff --git a/docs/api/puppeteer.metrics.timestamp.md b/docs/api/puppeteer.metrics.timestamp.md deleted file mode 100644 index ba7b0070ad359..0000000000000 --- a/docs/api/puppeteer.metrics.timestamp.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: Metrics.Timestamp ---- - -# Metrics.Timestamp property - -#### Signature: - -```typescript -interface Metrics { - Timestamp?: number; -} -``` diff --git a/docs/api/puppeteer.mouse.click.md b/docs/api/puppeteer.mouse.click.md index c64923bc4de68..f0273bad75fa4 100644 --- a/docs/api/puppeteer.mouse.click.md +++ b/docs/api/puppeteer.mouse.click.md @@ -13,20 +13,18 @@ class Mouse { click( x: number, y: number, - options?: MouseOptions & { - delay?: number; - } + options?: Readonly ): Promise; } ``` ## Parameters -| Parameter | Type | Description | -| --------- | --------------------------------------------------------------------- | ------------------------------------------------ | -| x | number | Horizontal position of the mouse. | -| y | number | Vertical position of the mouse. | -| options | [MouseOptions](./puppeteer.mouseoptions.md) & { delay?: number; } | _(Optional)_ Optional MouseOptions. | +| Parameter | Type | Description | +| --------- | --------------------------------------------------------------------- | ------------------------------------------- | +| x | number | Horizontal position of the mouse. | +| y | number | Vertical position of the mouse. | +| options | Readonly<[MouseClickOptions](./puppeteer.mouseclickoptions.md)> | _(Optional)_ Options to configure behavior. | **Returns:** diff --git a/docs/api/puppeteer.mouse.down.md b/docs/api/puppeteer.mouse.down.md index 7274efe4ed321..bf3c6f5f0cf84 100644 --- a/docs/api/puppeteer.mouse.down.md +++ b/docs/api/puppeteer.mouse.down.md @@ -4,21 +4,21 @@ sidebar_label: Mouse.down # Mouse.down() method -Dispatches a `mousedown` event. +Presses the mouse. #### Signature: ```typescript class Mouse { - down(options?: MouseOptions): Promise; + down(options?: Readonly): Promise; } ``` ## Parameters -| Parameter | Type | Description | -| --------- | ------------------------------------------- | ------------------------------------------------ | -| options | [MouseOptions](./puppeteer.mouseoptions.md) | _(Optional)_ Optional MouseOptions. | +| Parameter | Type | Description | +| --------- | ----------------------------------------------------------- | ------------------------------------------- | +| options | Readonly<[MouseOptions](./puppeteer.mouseoptions.md)> | _(Optional)_ Options to configure behavior. | **Returns:** diff --git a/docs/api/puppeteer.mouse.md b/docs/api/puppeteer.mouse.md index 68de341f07f56..9f5710eb5e0d1 100644 --- a/docs/api/puppeteer.mouse.md +++ b/docs/api/puppeteer.mouse.md @@ -80,12 +80,13 @@ await browser | Method | Modifiers | Description | | ----------------------------------------------------------------------- | --------- | ---------------------------------------------------------------------------------------- | | [click(x, y, options)](./puppeteer.mouse.click.md) | | Shortcut for mouse.move, mouse.down and mouse.up. | -| [down(options)](./puppeteer.mouse.down.md) | | Dispatches a mousedown event. | +| [down(options)](./puppeteer.mouse.down.md) | | Presses the mouse. | | [drag(start, target)](./puppeteer.mouse.drag.md) | | Dispatches a drag event. | | [dragAndDrop(start, target, options)](./puppeteer.mouse.draganddrop.md) | | Performs a drag, dragenter, dragover, and drop in sequence. | | [dragEnter(target, data)](./puppeteer.mouse.dragenter.md) | | Dispatches a dragenter event. | | [dragOver(target, data)](./puppeteer.mouse.dragover.md) | | Dispatches a dragover event. | | [drop(target, data)](./puppeteer.mouse.drop.md) | | Performs a dragenter, dragover, and drop in sequence. | -| [move(x, y, options)](./puppeteer.mouse.move.md) | | Dispatches a mousemove event. | -| [up(options)](./puppeteer.mouse.up.md) | | Dispatches a mouseup event. | +| [move(x, y, options)](./puppeteer.mouse.move.md) | | Moves the mouse to the given coordinate. | +| [reset()](./puppeteer.mouse.reset.md) | | Resets the mouse to the default state: No buttons pressed; position at (0,0). | +| [up(options)](./puppeteer.mouse.up.md) | | Releases the mouse. | | [wheel(options)](./puppeteer.mouse.wheel.md) | | Dispatches a mousewheel event. | diff --git a/docs/api/puppeteer.mouse.move.md b/docs/api/puppeteer.mouse.move.md index 1fe74e816ba8c..fca91421c654c 100644 --- a/docs/api/puppeteer.mouse.move.md +++ b/docs/api/puppeteer.mouse.move.md @@ -4,7 +4,7 @@ sidebar_label: Mouse.move # Mouse.move() method -Dispatches a `mousemove` event. +Moves the mouse to the given coordinate. #### Signature: @@ -13,20 +13,18 @@ class Mouse { move( x: number, y: number, - options?: { - steps?: number; - } + options?: Readonly ): Promise; } ``` ## Parameters -| Parameter | Type | Description | -| --------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| x | number | Horizontal position of the mouse. | -| y | number | Vertical position of the mouse. | -| options | { steps?: number; } | _(Optional)_ Optional object. If specified, the steps property sends intermediate mousemove events when set to 1 (default). | +| Parameter | Type | Description | +| --------- | ------------------------------------------------------------------- | ------------------------------------------- | +| x | number | Horizontal position of the mouse. | +| y | number | Vertical position of the mouse. | +| options | Readonly<[MouseMoveOptions](./puppeteer.mousemoveoptions.md)> | _(Optional)_ Options to configure behavior. | **Returns:** diff --git a/docs/api/puppeteer.mouse.reset.md b/docs/api/puppeteer.mouse.reset.md new file mode 100644 index 0000000000000..703475356042f --- /dev/null +++ b/docs/api/puppeteer.mouse.reset.md @@ -0,0 +1,19 @@ +--- +sidebar_label: Mouse.reset +--- + +# Mouse.reset() method + +Resets the mouse to the default state: No buttons pressed; position at (0,0). + +#### Signature: + +```typescript +class Mouse { + reset(): Promise; +} +``` + +**Returns:** + +Promise<void> diff --git a/docs/api/puppeteer.mouse.up.md b/docs/api/puppeteer.mouse.up.md index abe71eda9dc1f..8effca273703b 100644 --- a/docs/api/puppeteer.mouse.up.md +++ b/docs/api/puppeteer.mouse.up.md @@ -4,21 +4,21 @@ sidebar_label: Mouse.up # Mouse.up() method -Dispatches a `mouseup` event. +Releases the mouse. #### Signature: ```typescript class Mouse { - up(options?: MouseOptions): Promise; + up(options?: Readonly): Promise; } ``` ## Parameters -| Parameter | Type | Description | -| --------- | ------------------------------------------- | ------------------------------------------------ | -| options | [MouseOptions](./puppeteer.mouseoptions.md) | _(Optional)_ Optional MouseOptions. | +| Parameter | Type | Description | +| --------- | ----------------------------------------------------------- | ------------------------------------------- | +| options | Readonly<[MouseOptions](./puppeteer.mouseoptions.md)> | _(Optional)_ Options to configure behavior. | **Returns:** diff --git a/docs/api/puppeteer.mouse.wheel.md b/docs/api/puppeteer.mouse.wheel.md index c7c21d599ccbf..e502fdf4b3b24 100644 --- a/docs/api/puppeteer.mouse.wheel.md +++ b/docs/api/puppeteer.mouse.wheel.md @@ -10,15 +10,15 @@ Dispatches a `mousewheel` event. ```typescript class Mouse { - wheel(options?: MouseWheelOptions): Promise; + wheel(options?: Readonly): Promise; } ``` ## Parameters -| Parameter | Type | Description | -| --------- | ----------------------------------------------------- | ------------------------------------------------------ | -| options | [MouseWheelOptions](./puppeteer.mousewheeloptions.md) | _(Optional)_ Optional: MouseWheelOptions. | +| Parameter | Type | Description | +| --------- | --------------------------------------------------------------------- | ------------------------------------------------------ | +| options | Readonly<[MouseWheelOptions](./puppeteer.mousewheeloptions.md)> | _(Optional)_ Optional: MouseWheelOptions. | **Returns:** diff --git a/docs/api/puppeteer.mousebutton.md b/docs/api/puppeteer.mousebutton.md index 3c53141570d0c..4ba4f6fc2faa3 100644 --- a/docs/api/puppeteer.mousebutton.md +++ b/docs/api/puppeteer.mousebutton.md @@ -2,10 +2,18 @@ sidebar_label: MouseButton --- -# MouseButton type +# MouseButton variable + +Enum of valid mouse buttons. #### Signature: ```typescript -export type MouseButton = 'left' | 'right' | 'middle' | 'back' | 'forward'; +MouseButton: Readonly<{ + Left: 'left'; + Right: 'right'; + Middle: 'middle'; + Back: 'back'; + Forward: 'forward'; +}>; ``` diff --git a/docs/api/puppeteer.mouseclickoptions.md b/docs/api/puppeteer.mouseclickoptions.md new file mode 100644 index 0000000000000..a8778c17e89b7 --- /dev/null +++ b/docs/api/puppeteer.mouseclickoptions.md @@ -0,0 +1,20 @@ +--- +sidebar_label: MouseClickOptions +--- + +# MouseClickOptions interface + +#### Signature: + +```typescript +export interface MouseClickOptions extends MouseOptions +``` + +**Extends:** [MouseOptions](./puppeteer.mouseoptions.md) + +## Properties + +| Property | Modifiers | Type | Description | Default | +| -------- | --------------------- | ------ | -------------------------------------------------------------- | -------------- | +| count | optional | number | Number of clicks to perform. | 1 | +| delay | optional | number | Time (in ms) to delay the mouse release after the mouse press. | | diff --git a/docs/api/puppeteer.mousemoveoptions.md b/docs/api/puppeteer.mousemoveoptions.md new file mode 100644 index 0000000000000..618ba72dfc6f6 --- /dev/null +++ b/docs/api/puppeteer.mousemoveoptions.md @@ -0,0 +1,17 @@ +--- +sidebar_label: MouseMoveOptions +--- + +# MouseMoveOptions interface + +#### Signature: + +```typescript +export interface MouseMoveOptions +``` + +## Properties + +| Property | Modifiers | Type | Description | Default | +| -------- | --------------------- | ------ | ------------------------------------------------------------------------------------------ | -------------- | +| steps | optional | number | Determines the number of movements to make from the current mouse position to the new one. | 1 | diff --git a/docs/api/puppeteer.mouseoptions.button.md b/docs/api/puppeteer.mouseoptions.button.md deleted file mode 100644 index 88b3eda514f2e..0000000000000 --- a/docs/api/puppeteer.mouseoptions.button.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: MouseOptions.button ---- - -# MouseOptions.button property - -#### Signature: - -```typescript -interface MouseOptions { - button?: MouseButton; -} -``` diff --git a/docs/api/puppeteer.mouseoptions.clickcount.md b/docs/api/puppeteer.mouseoptions.clickcount.md deleted file mode 100644 index c492bd9122bfc..0000000000000 --- a/docs/api/puppeteer.mouseoptions.clickcount.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: MouseOptions.clickCount ---- - -# MouseOptions.clickCount property - -#### Signature: - -```typescript -interface MouseOptions { - clickCount?: number; -} -``` diff --git a/docs/api/puppeteer.mouseoptions.md b/docs/api/puppeteer.mouseoptions.md index 89fcba6c835f4..71b4b72c1cede 100644 --- a/docs/api/puppeteer.mouseoptions.md +++ b/docs/api/puppeteer.mouseoptions.md @@ -12,7 +12,7 @@ export interface MouseOptions ## Properties -| Property | Modifiers | Type | Description | Default | -| ----------------------------------------------------- | --------- | ----------------------------------------- | ------------ | ------- | -| [button?](./puppeteer.mouseoptions.button.md) | | [MouseButton](./puppeteer.mousebutton.md) | _(Optional)_ | | -| [clickCount?](./puppeteer.mouseoptions.clickcount.md) | | number | _(Optional)_ | | +| Property | Modifiers | Type | Description | Default | +| ---------- | --------------------- | ----------------------------------------- | ---------------------------------------- | ------------------- | +| button | optional | [MouseButton](./puppeteer.mousebutton.md) | Determines which button will be pressed. | 'left' | +| clickCount | optional | number | | 1 | diff --git a/docs/api/puppeteer.mousewheeloptions.deltax.md b/docs/api/puppeteer.mousewheeloptions.deltax.md deleted file mode 100644 index 194b7f7c1f767..0000000000000 --- a/docs/api/puppeteer.mousewheeloptions.deltax.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: MouseWheelOptions.deltaX ---- - -# MouseWheelOptions.deltaX property - -#### Signature: - -```typescript -interface MouseWheelOptions { - deltaX?: number; -} -``` diff --git a/docs/api/puppeteer.mousewheeloptions.deltay.md b/docs/api/puppeteer.mousewheeloptions.deltay.md deleted file mode 100644 index 8327a81b36c9f..0000000000000 --- a/docs/api/puppeteer.mousewheeloptions.deltay.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: MouseWheelOptions.deltaY ---- - -# MouseWheelOptions.deltaY property - -#### Signature: - -```typescript -interface MouseWheelOptions { - deltaY?: number; -} -``` diff --git a/docs/api/puppeteer.mousewheeloptions.md b/docs/api/puppeteer.mousewheeloptions.md index f3efee5fb3395..026b5a882a2eb 100644 --- a/docs/api/puppeteer.mousewheeloptions.md +++ b/docs/api/puppeteer.mousewheeloptions.md @@ -12,7 +12,7 @@ export interface MouseWheelOptions ## Properties -| Property | Modifiers | Type | Description | Default | -| -------------------------------------------------- | --------- | ------ | ------------ | ------- | -| [deltaX?](./puppeteer.mousewheeloptions.deltax.md) | | number | _(Optional)_ | | -| [deltaY?](./puppeteer.mousewheeloptions.deltay.md) | | number | _(Optional)_ | | +| Property | Modifiers | Type | Description | Default | +| -------- | --------------------- | ------ | ----------- | ------- | +| deltaX | optional | number | | | +| deltaY | optional | number | | | diff --git a/docs/api/puppeteer.networkconditions.download.md b/docs/api/puppeteer.networkconditions.download.md deleted file mode 100644 index ec1c8847d5063..0000000000000 --- a/docs/api/puppeteer.networkconditions.download.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: NetworkConditions.download ---- - -# NetworkConditions.download property - -#### Signature: - -```typescript -interface NetworkConditions { - download: number; -} -``` diff --git a/docs/api/puppeteer.networkconditions.latency.md b/docs/api/puppeteer.networkconditions.latency.md deleted file mode 100644 index e581c9fe17f05..0000000000000 --- a/docs/api/puppeteer.networkconditions.latency.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: NetworkConditions.latency ---- - -# NetworkConditions.latency property - -#### Signature: - -```typescript -interface NetworkConditions { - latency: number; -} -``` diff --git a/docs/api/puppeteer.networkconditions.upload.md b/docs/api/puppeteer.networkconditions.upload.md deleted file mode 100644 index a030b3d19596c..0000000000000 --- a/docs/api/puppeteer.networkconditions.upload.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: NetworkConditions.upload ---- - -# NetworkConditions.upload property - -#### Signature: - -```typescript -interface NetworkConditions { - upload: number; -} -``` diff --git a/docs/api/puppeteer.newdocumentscriptevaluation.md b/docs/api/puppeteer.newdocumentscriptevaluation.md new file mode 100644 index 0000000000000..7e29978b089a6 --- /dev/null +++ b/docs/api/puppeteer.newdocumentscriptevaluation.md @@ -0,0 +1,17 @@ +--- +sidebar_label: NewDocumentScriptEvaluation +--- + +# NewDocumentScriptEvaluation interface + +#### Signature: + +```typescript +export interface NewDocumentScriptEvaluation +``` + +## Properties + +| Property | Modifiers | Type | Description | Default | +| ---------- | --------- | ------ | ----------- | ------- | +| identifier | | string | | | diff --git a/docs/api/puppeteer.offset.md b/docs/api/puppeteer.offset.md index 385685f0bd992..5ddaffa5b9929 100644 --- a/docs/api/puppeteer.offset.md +++ b/docs/api/puppeteer.offset.md @@ -12,7 +12,7 @@ export interface Offset ## Properties -| Property | Modifiers | Type | Description | Default | -| ---------------------------- | --------- | ------ | ----------------------------------------------------------------------------------- | ------- | -| [x](./puppeteer.offset.x.md) | | number | x-offset for the clickable point relative to the top-left corner of the border box. | | -| [y](./puppeteer.offset.y.md) | | number | y-offset for the clickable point relative to the top-left corner of the border box. | | +| Property | Modifiers | Type | Description | Default | +| -------- | --------- | ------ | ----------------------------------------------------------------------------------- | ------- | +| x | | number | x-offset for the clickable point relative to the top-left corner of the border box. | | +| y | | number | y-offset for the clickable point relative to the top-left corner of the border box. | | diff --git a/docs/api/puppeteer.offset.x.md b/docs/api/puppeteer.offset.x.md deleted file mode 100644 index 2de895a1b52e4..0000000000000 --- a/docs/api/puppeteer.offset.x.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: Offset.x ---- - -# Offset.x property - -x-offset for the clickable point relative to the top-left corner of the border box. - -#### Signature: - -```typescript -interface Offset { - x: number; -} -``` diff --git a/docs/api/puppeteer.offset.y.md b/docs/api/puppeteer.offset.y.md deleted file mode 100644 index 2bcb2cf4a232b..0000000000000 --- a/docs/api/puppeteer.offset.y.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: Offset.y ---- - -# Offset.y property - -y-offset for the clickable point relative to the top-left corner of the border box. - -#### Signature: - -```typescript -interface Offset { - y: number; -} -``` diff --git a/docs/api/puppeteer.page.__eval.md b/docs/api/puppeteer.page.__eval.md index 3f7b5d0ab96ed..2b77ab74f869c 100644 --- a/docs/api/puppeteer.page.__eval.md +++ b/docs/api/puppeteer.page.__eval.md @@ -16,7 +16,7 @@ class Page { Func extends EvaluateFuncWith< Array>, Params - > = EvaluateFuncWith>, Params> + > = EvaluateFuncWith>, Params>, >( selector: Selector, pageFunction: Func | string, diff --git a/docs/api/puppeteer.page._eval.md b/docs/api/puppeteer.page._eval.md index 7b167131f3218..8ee65dc1396a9 100644 --- a/docs/api/puppeteer.page._eval.md +++ b/docs/api/puppeteer.page._eval.md @@ -16,7 +16,7 @@ class Page { Func extends EvaluateFuncWith, Params> = EvaluateFuncWith< NodeFor, Params - > + >, >( selector: Selector, pageFunction: Func | string, diff --git a/docs/api/puppeteer.page.accessibility.md b/docs/api/puppeteer.page.accessibility.md deleted file mode 100644 index 27f8b8ac8bb44..0000000000000 --- a/docs/api/puppeteer.page.accessibility.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: Page.accessibility ---- - -# Page.accessibility property - -#### Signature: - -```typescript -class Page { - get accessibility(): Accessibility; -} -``` diff --git a/docs/api/puppeteer.page.addstyletag_2.md b/docs/api/puppeteer.page.addstyletag_2.md deleted file mode 100644 index 031fccd96d8c8..0000000000000 --- a/docs/api/puppeteer.page.addstyletag_2.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -sidebar_label: Page.addStyleTag_2 ---- - -# Page.addStyleTag() method - -#### Signature: - -```typescript -class Page { - addStyleTag( - options: FrameAddStyleTagOptions - ): Promise>; -} -``` - -## Parameters - -| Parameter | Type | Description | -| --------- | ----------------------------------------------------------------- | ----------- | -| options | [FrameAddStyleTagOptions](./puppeteer.frameaddstyletagoptions.md) | | - -**Returns:** - -Promise<[ElementHandle](./puppeteer.elementhandle.md)<HTMLStyleElement \| HTMLLinkElement>> diff --git a/docs/api/puppeteer.page.click.md b/docs/api/puppeteer.page.click.md index 4154fe3011118..ce3aceb607f95 100644 --- a/docs/api/puppeteer.page.click.md +++ b/docs/api/puppeteer.page.click.md @@ -4,29 +4,22 @@ sidebar_label: Page.click # Page.click() method -This method fetches an element with `selector`, scrolls it into view if needed, and then uses [Page.mouse](./puppeteer.page.mouse.md) to click in the center of the element. If there's no element matching `selector`, the method throws an error. +This method fetches an element with `selector`, scrolls it into view if needed, and then uses [Page.mouse](./puppeteer.page.md) to click in the center of the element. If there's no element matching `selector`, the method throws an error. #### Signature: ```typescript class Page { - click( - selector: string, - options?: { - delay?: number; - button?: MouseButton; - clickCount?: number; - } - ): Promise; + click(selector: string, options?: Readonly): Promise; } ``` ## Parameters -| Parameter | Type | Description | -| --------- | -------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | -| selector | string | A selector to search for element to click. If there are multiple elements satisfying the selector, the first will be clicked | -| options | { delay?: number; button?: [MouseButton](./puppeteer.mousebutton.md); clickCount?: number; } | _(Optional)_ Object | +| Parameter | Type | Description | +| --------- | ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | +| selector | string | A selector to search for element to click. If there are multiple elements satisfying the selector, the first will be clicked | +| options | Readonly<[ClickOptions](./puppeteer.clickoptions.md)> | _(Optional)_ Object | **Returns:** diff --git a/docs/api/puppeteer.page.content.md b/docs/api/puppeteer.page.content.md index d6077c132f73a..fe0e11cd9cbef 100644 --- a/docs/api/puppeteer.page.content.md +++ b/docs/api/puppeteer.page.content.md @@ -4,6 +4,8 @@ sidebar_label: Page.content # Page.content() method +The full HTML contents of the page, including the DOCTYPE. + #### Signature: ```typescript diff --git a/docs/api/puppeteer.page.coverage.md b/docs/api/puppeteer.page.coverage.md deleted file mode 100644 index e1ff7f3cecd2a..0000000000000 --- a/docs/api/puppeteer.page.coverage.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: Page.coverage ---- - -# Page.coverage property - -#### Signature: - -```typescript -class Page { - get coverage(): Coverage; -} -``` diff --git a/docs/api/puppeteer.page.createcdpsession.md b/docs/api/puppeteer.page.createcdpsession.md new file mode 100644 index 0000000000000..e398ddfc74809 --- /dev/null +++ b/docs/api/puppeteer.page.createcdpsession.md @@ -0,0 +1,19 @@ +--- +sidebar_label: Page.createCDPSession +--- + +# Page.createCDPSession() method + +Creates a Chrome Devtools Protocol session attached to the page. + +#### Signature: + +```typescript +class Page { + createCDPSession(): Promise; +} +``` + +**Returns:** + +Promise<[CDPSession](./puppeteer.cdpsession.md)> diff --git a/docs/api/puppeteer.page.createpdfstream.md b/docs/api/puppeteer.page.createpdfstream.md index a4a5a650c86d7..e84764bd54dd1 100644 --- a/docs/api/puppeteer.page.createpdfstream.md +++ b/docs/api/puppeteer.page.createpdfstream.md @@ -26,8 +26,6 @@ Promise<Readable> ## Remarks -NOTE: PDF generation is only supported in Chrome headless mode. - To generate a PDF with the `screen` media type, call [\`page.emulateMediaType('screen')\`](./puppeteer.page.emulatemediatype.md) before calling `page.pdf()`. By default, `page.pdf()` generates a pdf with modified colors for printing. Use the [\`-webkit-print-color-adjust\`](https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-print-color-adjust) property to force rendering of exact colors. diff --git a/docs/api/puppeteer.page.evaluate.md b/docs/api/puppeteer.page.evaluate.md index b3d6953d73c7b..3692421a0f9a7 100644 --- a/docs/api/puppeteer.page.evaluate.md +++ b/docs/api/puppeteer.page.evaluate.md @@ -6,7 +6,7 @@ sidebar_label: Page.evaluate Evaluates a function in the page's context and returns the result. -If the function passed to `page.evaluateHandle` returns a Promise, the function will wait for the promise to resolve and return its value. +If the function passed to `page.evaluate` returns a Promise, the function will wait for the promise to resolve and return its value. #### Signature: @@ -14,7 +14,7 @@ If the function passed to `page.evaluateHandle` returns a Promise, the function class Page { evaluate< Params extends unknown[], - Func extends EvaluateFunc = EvaluateFunc + Func extends EvaluateFunc = EvaluateFunc, >( pageFunction: Func | string, ...args: Params diff --git a/docs/api/puppeteer.page.evaluatehandle.md b/docs/api/puppeteer.page.evaluatehandle.md index 988a626c248f3..ac6a2633fc53c 100644 --- a/docs/api/puppeteer.page.evaluatehandle.md +++ b/docs/api/puppeteer.page.evaluatehandle.md @@ -10,7 +10,7 @@ sidebar_label: Page.evaluateHandle class Page { evaluateHandle< Params extends unknown[], - Func extends EvaluateFunc = EvaluateFunc + Func extends EvaluateFunc = EvaluateFunc, >( pageFunction: Func | string, ...args: Params diff --git a/docs/api/puppeteer.page.evaluateonnewdocument.md b/docs/api/puppeteer.page.evaluateonnewdocument.md index 770fc870a7cc1..36376fe1c64e2 100644 --- a/docs/api/puppeteer.page.evaluateonnewdocument.md +++ b/docs/api/puppeteer.page.evaluateonnewdocument.md @@ -18,8 +18,11 @@ The function is invoked after the document was created but before any of its scr class Page { evaluateOnNewDocument< Params extends unknown[], - Func extends (...args: Params) => unknown = (...args: Params) => unknown - >(pageFunction: Func | string, ...args: Params): Promise; + Func extends (...args: Params) => unknown = (...args: Params) => unknown, + >( + pageFunction: Func | string, + ...args: Params + ): Promise; } ``` @@ -32,7 +35,7 @@ class Page { **Returns:** -Promise<void> +Promise<[NewDocumentScriptEvaluation](./puppeteer.newdocumentscriptevaluation.md)> ## Example diff --git a/docs/api/puppeteer.page.frames.md b/docs/api/puppeteer.page.frames.md index b69c04c944f9c..385e465cec991 100644 --- a/docs/api/puppeteer.page.frames.md +++ b/docs/api/puppeteer.page.frames.md @@ -4,6 +4,8 @@ sidebar_label: Page.frames # Page.frames() method +An array of all frames attached to the page. + #### Signature: ```typescript @@ -15,5 +17,3 @@ class Page { **Returns:** [Frame](./puppeteer.frame.md)\[\] - -An array of all frames attached to the page. diff --git a/docs/api/puppeteer.page.getdefaulttimeout.md b/docs/api/puppeteer.page.getdefaulttimeout.md index e3820d211b152..3acaec3c0422d 100644 --- a/docs/api/puppeteer.page.getdefaulttimeout.md +++ b/docs/api/puppeteer.page.getdefaulttimeout.md @@ -4,6 +4,8 @@ sidebar_label: Page.getDefaultTimeout # Page.getDefaultTimeout() method +Maximum time in milliseconds. + #### Signature: ```typescript @@ -15,5 +17,3 @@ class Page { **Returns:** number - -Maximum time in milliseconds. diff --git a/docs/api/puppeteer.page.hover.md b/docs/api/puppeteer.page.hover.md index 24432ea81bd10..f498e4cc74c37 100644 --- a/docs/api/puppeteer.page.hover.md +++ b/docs/api/puppeteer.page.hover.md @@ -4,7 +4,7 @@ sidebar_label: Page.hover # Page.hover() method -This method fetches an element with `selector`, scrolls it into view if needed, and then uses [Page.mouse](./puppeteer.page.mouse.md) to hover over the center of the element. If there's no element matching `selector`, the method throws an error. +This method fetches an element with `selector`, scrolls it into view if needed, and then uses [Page.mouse](./puppeteer.page.md) to hover over the center of the element. If there's no element matching `selector`, the method throws an error. #### Signature: diff --git a/docs/api/puppeteer.page.isdraginterceptionenabled.md b/docs/api/puppeteer.page.isdraginterceptionenabled.md index 0cfe38078166e..ff01da1cd6f66 100644 --- a/docs/api/puppeteer.page.isdraginterceptionenabled.md +++ b/docs/api/puppeteer.page.isdraginterceptionenabled.md @@ -4,6 +4,8 @@ sidebar_label: Page.isDragInterceptionEnabled # Page.isDragInterceptionEnabled() method +`true` if drag events are being intercepted, `false` otherwise. + #### Signature: ```typescript @@ -15,5 +17,3 @@ class Page { **Returns:** boolean - -`true` if drag events are being intercepted, `false` otherwise. diff --git a/docs/api/puppeteer.page.isjavascriptenabled.md b/docs/api/puppeteer.page.isjavascriptenabled.md index 87177338dd58b..32ed419eb6b45 100644 --- a/docs/api/puppeteer.page.isjavascriptenabled.md +++ b/docs/api/puppeteer.page.isjavascriptenabled.md @@ -4,6 +4,8 @@ sidebar_label: Page.isJavaScriptEnabled # Page.isJavaScriptEnabled() method +`true` if the page has JavaScript enabled, `false` otherwise. + #### Signature: ```typescript @@ -15,5 +17,3 @@ class Page { **Returns:** boolean - -`true` if the page has JavaScript enabled, `false` otherwise. diff --git a/docs/api/puppeteer.page.isserviceworkerbypassed.md b/docs/api/puppeteer.page.isserviceworkerbypassed.md new file mode 100644 index 0000000000000..78f9d0fe6d0a4 --- /dev/null +++ b/docs/api/puppeteer.page.isserviceworkerbypassed.md @@ -0,0 +1,19 @@ +--- +sidebar_label: Page.isServiceWorkerBypassed +--- + +# Page.isServiceWorkerBypassed() method + +`true` if the service worker are being bypassed, `false` otherwise. + +#### Signature: + +```typescript +class Page { + isServiceWorkerBypassed(): boolean; +} +``` + +**Returns:** + +boolean diff --git a/docs/api/puppeteer.page.keyboard.md b/docs/api/puppeteer.page.keyboard.md deleted file mode 100644 index 963de7a663494..0000000000000 --- a/docs/api/puppeteer.page.keyboard.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: Page.keyboard ---- - -# Page.keyboard property - -#### Signature: - -```typescript -class Page { - get keyboard(): Keyboard; -} -``` diff --git a/docs/api/puppeteer.page.locator.md b/docs/api/puppeteer.page.locator.md new file mode 100644 index 0000000000000..ffb81c69fa679 --- /dev/null +++ b/docs/api/puppeteer.page.locator.md @@ -0,0 +1,31 @@ +--- +sidebar_label: Page.locator +--- + +# Page.locator() method + +Creates a locator for the provided `selector`. See [Locator](./puppeteer.locator.md) for details and supported actions. + +#### Signature: + +```typescript +class Page { + locator( + selector: Selector + ): Locator>; +} +``` + +## Parameters + +| Parameter | Type | Description | +| --------- | -------- | ----------- | +| selector | Selector | | + +**Returns:** + +[Locator](./puppeteer.locator.md)<[NodeFor](./puppeteer.nodefor.md)<Selector>> + +## Remarks + +Locators API is experimental and we will not follow semver for breaking change in the Locators API. diff --git a/docs/api/puppeteer.page.mainframe.md b/docs/api/puppeteer.page.mainframe.md index 529521d8762d4..383bbe5f63249 100644 --- a/docs/api/puppeteer.page.mainframe.md +++ b/docs/api/puppeteer.page.mainframe.md @@ -4,6 +4,8 @@ sidebar_label: Page.mainFrame # Page.mainFrame() method +The page's main frame. + #### Signature: ```typescript @@ -16,8 +18,6 @@ class Page { [Frame](./puppeteer.frame.md) -The page's main frame. - ## Remarks Page is guaranteed to have a main frame which persists during navigations. diff --git a/docs/api/puppeteer.page.md b/docs/api/puppeteer.page.md index 20fb453bd5738..29549dc88f038 100644 --- a/docs/api/puppeteer.page.md +++ b/docs/api/puppeteer.page.md @@ -4,7 +4,7 @@ sidebar_label: Page # Page class -Page provides methods to interact with a single tab or [extension background page](https://developer.chrome.com/extensions/background_pages) in Chromium. +Page provides methods to interact with a single tab or [extension background page](https://developer.chrome.com/extensions/background_pages) in the browser. :::note @@ -63,144 +63,106 @@ page.off('request', logRequest); ## Properties -| Property | Modifiers | Type | Description | -| -------------------------------------------------- | --------------------- | --------------------------------------------- | ----------- | -| [accessibility](./puppeteer.page.accessibility.md) | readonly | [Accessibility](./puppeteer.accessibility.md) | | -| [coverage](./puppeteer.page.coverage.md) | readonly | [Coverage](./puppeteer.coverage.md) | | -| [keyboard](./puppeteer.page.keyboard.md) | readonly | [Keyboard](./puppeteer.keyboard.md) | | -| [mouse](./puppeteer.page.mouse.md) | readonly | [Mouse](./puppeteer.mouse.md) | | -| [touchscreen](./puppeteer.page.touchscreen.md) | readonly | [Touchscreen](./puppeteer.touchscreen.md) | | -| [tracing](./puppeteer.page.tracing.md) | readonly | [Tracing](./puppeteer.tracing.md) | | +| Property | Modifiers | Type | Description | +| ------------- | --------------------- | --------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| accessibility | readonly | [Accessibility](./puppeteer.accessibility.md) | The Accessibility class provides methods for inspecting the browser's accessibility tree. The accessibility tree is used by assistive technology such as [screen readers](https://en.wikipedia.org/wiki/Screen_reader) or [switches](https://en.wikipedia.org/wiki/Switch_access). | +| coverage | readonly | [Coverage](./puppeteer.coverage.md) | The Coverage class provides methods to gather information about parts of JavaScript and CSS that were used by the page. | +| keyboard | readonly | [Keyboard](./puppeteer.keyboard.md) | Keyboard provides an api for managing a virtual keyboard. The high level api is [Keyboard.type()](./puppeteer.keyboard.type.md), which takes raw characters and generates proper keydown, keypress/input, and keyup events on your page. | +| mouse | readonly | [Mouse](./puppeteer.mouse.md) | The Mouse class operates in main-frame CSS pixels relative to the top-left corner of the viewport. | +| touchscreen | readonly | [Touchscreen](./puppeteer.touchscreen.md) | The Touchscreen class exposes touchscreen events. | +| tracing | readonly | [Tracing](./puppeteer.tracing.md) | The Tracing class exposes the tracing audit interface. | ## Methods -| Method | Modifiers | Description | -| ------------------------------------------------------------------------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [$(selector)](./puppeteer.page._.md) | | Runs document.querySelector within the page. If no element matches the selector, the return value resolves to null. | -| [$$(selector)](./puppeteer.page.__.md) | | The method runs document.querySelectorAll within the page. If no elements match the selector, the return value resolves to []. | -| [$$eval(selector, pageFunction, args)](./puppeteer.page.__eval.md) | | This method runs Array.from(document.querySelectorAll(selector)) within the page and passes the result as the first argument to the pageFunction. | -| [$eval(selector, pageFunction, args)](./puppeteer.page._eval.md) | | This method runs document.querySelector within the page and passes the result as the first argument to the pageFunction. | -| [$x(expression)](./puppeteer.page._x.md) | | The method evaluates the XPath expression relative to the page document as its context node. If there are no such elements, the method resolves to an empty array. | -| [addScriptTag(options)](./puppeteer.page.addscripttag.md) | | Adds a <script> tag into the page with the desired URL or content. | -| [addStyleTag(options)](./puppeteer.page.addstyletag.md) | |

Adds a <link rel="stylesheet"> tag into the page with the desired URL or a <style type="text/css"> tag with the content.

Shortcut for [page.mainFrame().addStyleTag(options)](./puppeteer.frame.addstyletag_1.md).

| -| [addStyleTag(options)](./puppeteer.page.addstyletag_1.md) | | | -| [addStyleTag(options)](./puppeteer.page.addstyletag_2.md) | | | -| [authenticate(credentials)](./puppeteer.page.authenticate.md) | | Provide credentials for HTTP authentication. | -| [bringToFront()](./puppeteer.page.bringtofront.md) | | Brings page to front (activates tab). | -| [browser()](./puppeteer.page.browser.md) | | Get the browser the page belongs to. | -| [browserContext()](./puppeteer.page.browsercontext.md) | | Get the browser context that the page belongs to. | -| [click(selector, options)](./puppeteer.page.click.md) | | This method fetches an element with selector, scrolls it into view if needed, and then uses [Page.mouse](./puppeteer.page.mouse.md) to click in the center of the element. If there's no element matching selector, the method throws an error. | -| [close(options)](./puppeteer.page.close.md) | | | -| [content()](./puppeteer.page.content.md) | | | -| [cookies(urls)](./puppeteer.page.cookies.md) | | If no URLs are specified, this method returns cookies for the current page URL. If URLs are specified, only cookies for those URLs are returned. | -| [createPDFStream(options)](./puppeteer.page.createpdfstream.md) | | Generates a PDF of the page with the print CSS media type. | -| [deleteCookie(cookies)](./puppeteer.page.deletecookie.md) | | | -| [emulate(device)](./puppeteer.page.emulate.md) | |

Emulates a given device's metrics and user agent.

To aid emulation, Puppeteer provides a list of known devices that can be via [KnownDevices](./puppeteer.knowndevices.md).

| -| [emulateCPUThrottling(factor)](./puppeteer.page.emulatecputhrottling.md) | | Enables CPU throttling to emulate slow CPUs. | -| [emulateIdleState(overrides)](./puppeteer.page.emulateidlestate.md) | | Emulates the idle state. If no arguments set, clears idle state emulation. | -| [emulateMediaFeatures(features)](./puppeteer.page.emulatemediafeatures.md) | | | -| [emulateMediaType(type)](./puppeteer.page.emulatemediatype.md) | | | -| [emulateNetworkConditions(networkConditions)](./puppeteer.page.emulatenetworkconditions.md) | |

This does not affect WebSockets and WebRTC PeerConnections (see https://crbug.com/563644). To set the page offline, you can use [Page.setOfflineMode()](./puppeteer.page.setofflinemode.md).

A list of predefined network conditions can be used by importing [PredefinedNetworkConditions](./puppeteer.predefinednetworkconditions.md).

| -| [emulateTimezone(timezoneId)](./puppeteer.page.emulatetimezone.md) | | | -| [emulateVisionDeficiency(type)](./puppeteer.page.emulatevisiondeficiency.md) | | Simulates the given vision deficiency on the page. | -| [evaluate(pageFunction, args)](./puppeteer.page.evaluate.md) | |

Evaluates a function in the page's context and returns the result.

If the function passed to page.evaluateHandle returns a Promise, the function will wait for the promise to resolve and return its value.

| -| [evaluateHandle(pageFunction, args)](./puppeteer.page.evaluatehandle.md) | | | -| [evaluateOnNewDocument(pageFunction, args)](./puppeteer.page.evaluateonnewdocument.md) | |

Adds a function which would be invoked in one of the following scenarios:

- whenever the page is navigated

- whenever the child frame is attached or navigated. In this case, the function is invoked in the context of the newly attached frame.

The function is invoked after the document was created but before any of its scripts were run. This is useful to amend the JavaScript environment, e.g. to seed Math.random.

| -| [exposeFunction(name, pptrFunction)](./puppeteer.page.exposefunction.md) | |

The method adds a function called name on the page's window object. When called, the function executes puppeteerFunction in node.js and returns a Promise which resolves to the return value of puppeteerFunction.

If the puppeteerFunction returns a Promise, it will be awaited.

:::note

Functions installed via page.exposeFunction survive navigations.

:::note

| -| [focus(selector)](./puppeteer.page.focus.md) | | This method fetches an element with selector and focuses it. If there's no element matching selector, the method throws an error. | -| [frames()](./puppeteer.page.frames.md) | | | -| [getDefaultTimeout()](./puppeteer.page.getdefaulttimeout.md) | | | -| [goBack(options)](./puppeteer.page.goback.md) | | This method navigate to the previous page in history. | -| [goForward(options)](./puppeteer.page.goforward.md) | | This method navigate to the next page in history. | -| [goto(url, options)](./puppeteer.page.goto.md) | | | -| [hover(selector)](./puppeteer.page.hover.md) | | This method fetches an element with selector, scrolls it into view if needed, and then uses [Page.mouse](./puppeteer.page.mouse.md) to hover over the center of the element. If there's no element matching selector, the method throws an error. | -| [isClosed()](./puppeteer.page.isclosed.md) | | Indicates that the page has been closed. | -| [isDragInterceptionEnabled()](./puppeteer.page.isdraginterceptionenabled.md) | | | -| [isJavaScriptEnabled()](./puppeteer.page.isjavascriptenabled.md) | | | -| [mainFrame()](./puppeteer.page.mainframe.md) | | | -| [metrics()](./puppeteer.page.metrics.md) | | | -| [off(eventName, handler)](./puppeteer.page.off.md) | | | -| [on(eventName, handler)](./puppeteer.page.on.md) | |

Listen to page events.

:::note

This method exists to define event typings and handle proper wireup of cooperative request interception. Actual event listening and dispatching is delegated to [EventEmitter](./puppeteer.eventemitter.md).

:::

| -| [once(eventName, handler)](./puppeteer.page.once.md) | | | -| [pdf(options)](./puppeteer.page.pdf.md) | | | -| [queryObjects(prototypeHandle)](./puppeteer.page.queryobjects.md) | | This method iterates the JavaScript heap and finds all objects with the given prototype. | -| [reload(options)](./puppeteer.page.reload.md) | | | -| [screenshot(options)](./puppeteer.page.screenshot.md) | | | -| [screenshot(options)](./puppeteer.page.screenshot_1.md) | | | -| [screenshot(options)](./puppeteer.page.screenshot_2.md) | | | -| [select(selector, values)](./puppeteer.page.select.md) | | Triggers a change and input event once all the provided options have been selected. If there's no <select> element matching selector, the method throws an error. | -| [setBypassCSP(enabled)](./puppeteer.page.setbypasscsp.md) | | Toggles bypassing page's Content-Security-Policy. | -| [setCacheEnabled(enabled)](./puppeteer.page.setcacheenabled.md) | | Toggles ignoring cache for each request based on the enabled state. By default, caching is enabled. | -| [setContent(html, options)](./puppeteer.page.setcontent.md) | | | -| [setCookie(cookies)](./puppeteer.page.setcookie.md) | | | -| [setDefaultNavigationTimeout(timeout)](./puppeteer.page.setdefaultnavigationtimeout.md) | |

This setting will change the default maximum navigation time for the following methods and related shortcuts:

- [page.goBack(options)](./puppeteer.page.goback.md)

- [page.goForward(options)](./puppeteer.page.goforward.md)

- [page.goto(url,options)](./puppeteer.page.goto.md)

- [page.reload(options)](./puppeteer.page.reload.md)

- [page.setContent(html,options)](./puppeteer.page.setcontent.md)

- [page.waitForNavigation(options)](./puppeteer.page.waitfornavigation.md)

| -| [setDefaultTimeout(timeout)](./puppeteer.page.setdefaulttimeout.md) | | | -| [setDragInterception(enabled)](./puppeteer.page.setdraginterception.md) | | | -| [setExtraHTTPHeaders(headers)](./puppeteer.page.setextrahttpheaders.md) | |

The extra HTTP headers will be sent with every request the page initiates.

:::tip

All HTTP header names are lowercased. (HTTP headers are case-insensitive, so this shouldn’t impact your server code.)

:::

:::note

page.setExtraHTTPHeaders does not guarantee the order of headers in the outgoing requests.

:::

| -| [setGeolocation(options)](./puppeteer.page.setgeolocation.md) | | Sets the page's geolocation. | -| [setJavaScriptEnabled(enabled)](./puppeteer.page.setjavascriptenabled.md) | | | -| [setOfflineMode(enabled)](./puppeteer.page.setofflinemode.md) | |

Sets the network connection to offline.

It does not change the parameters used in [Page.emulateNetworkConditions()](./puppeteer.page.emulatenetworkconditions.md)

| -| [setRequestInterception(value)](./puppeteer.page.setrequestinterception.md) | |

Activating request interception enables [HTTPRequest.abort()](./puppeteer.httprequest.abort.md), [HTTPRequest.continue()](./puppeteer.httprequest.continue.md) and [HTTPRequest.respond()](./puppeteer.httprequest.respond.md) methods. This provides the capability to modify network requests that are made by a page.

Once request interception is enabled, every request will stall unless it's continued, responded or aborted; or completed using the browser cache.

See the [Request interception guide](https://pptr.dev/next/guides/request-interception) for more details.

| -| [setUserAgent(userAgent, userAgentMetadata)](./puppeteer.page.setuseragent.md) | | | -| [setViewport(viewport)](./puppeteer.page.setviewport.md) | |

page.setViewport will resize the page. A lot of websites don't expect phones to change size, so you should set the viewport before navigating to the page.

In the case of multiple pages in a single browser, each page can have its own viewport size.

| -| [tap(selector)](./puppeteer.page.tap.md) | | This method fetches an element with selector, scrolls it into view if needed, and then uses [Page.touchscreen](./puppeteer.page.touchscreen.md) to tap in the center of the element. If there's no element matching selector, the method throws an error. | -| [target()](./puppeteer.page.target.md) | | | -| [title()](./puppeteer.page.title.md) | | | -| [type(selector, text, options)](./puppeteer.page.type.md) | |

Sends a keydown, keypress/input, and keyup event for each character in the text.

To press a special key, like Control or ArrowDown, use [Keyboard.press()](./puppeteer.keyboard.press.md).

| -| [url()](./puppeteer.page.url.md) | | | -| [viewport()](./puppeteer.page.viewport.md) | | | -| [waitForFileChooser(options)](./puppeteer.page.waitforfilechooser.md) | |

This method is typically coupled with an action that triggers file choosing.

:::caution

This must be called before the file chooser is launched. It will not return a currently active file chooser.

:::

| -| [waitForFrame(urlOrPredicate, options)](./puppeteer.page.waitforframe.md) | | | -| [waitForFunction(pageFunction, options, args)](./puppeteer.page.waitforfunction.md) | | Waits for a function to finish evaluating in the page's context. | -| [waitForNavigation(options)](./puppeteer.page.waitfornavigation.md) | | Waits for the page to navigate to a new URL or to reload. It is useful when you run code that will indirectly cause the page to navigate. | -| [waitForNetworkIdle(options)](./puppeteer.page.waitfornetworkidle.md) | | | -| [waitForRequest(urlOrPredicate, options)](./puppeteer.page.waitforrequest.md) | | | -| [waitForResponse(urlOrPredicate, options)](./puppeteer.page.waitforresponse.md) | | | -| [waitForSelector(selector, options)](./puppeteer.page.waitforselector.md) | |

Wait for the selector to appear in page. If at the moment of calling the method the selector already exists, the method will return immediately. If the selector doesn't appear after the timeout milliseconds of waiting, the function will throw.

This method works across navigations:

| - -```ts -import puppeteer from 'puppeteer'; -(async () => { - const browser = await puppeteer.launch(); - const page = await browser.newPage(); - let currentURL; - page - .waitForSelector('img') - .then(() => console.log('First URL with image: ' + currentURL)); - for (currentURL of [ - 'https://example.com', - 'https://google.com', - 'https://bbc.com', - ]) { - await page.goto(currentURL); - } - await browser.close(); -})(); -``` - -| -| [waitForTimeout(milliseconds)](./puppeteer.page.waitfortimeout.md) | | | -| [waitForXPath(xpath, options)](./puppeteer.page.waitforxpath.md) | |

Wait for the xpath to appear in page. If at the moment of calling the method the xpath already exists, the method will return immediately. If the xpath doesn't appear after the timeout milliseconds of waiting, the function will throw.

This method works across navigation

- -```ts -import puppeteer from 'puppeteer'; -(async () => { - const browser = await puppeteer.launch(); - const page = await browser.newPage(); - let currentURL; - page - .waitForXPath('//img') - .then(() => console.log('First URL with image: ' + currentURL)); - for (currentURL of [ - 'https://example.com', - 'https://google.com', - 'https://bbc.com', - ]) { - await page.goto(currentURL); - } - await browser.close(); -})(); -``` - -| -| [workers()](./puppeteer.page.workers.md) | | | +| Method | Modifiers | Description | +| ---------------------------------------------------------------------------------------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [$(selector)](./puppeteer.page._.md) | | Runs document.querySelector within the page. If no element matches the selector, the return value resolves to null. | +| [$$(selector)](./puppeteer.page.__.md) | | The method runs document.querySelectorAll within the page. If no elements match the selector, the return value resolves to []. | +| [$$eval(selector, pageFunction, args)](./puppeteer.page.__eval.md) | | This method runs Array.from(document.querySelectorAll(selector)) within the page and passes the result as the first argument to the pageFunction. | +| [$eval(selector, pageFunction, args)](./puppeteer.page._eval.md) | | This method runs document.querySelector within the page and passes the result as the first argument to the pageFunction. | +| [$x(expression)](./puppeteer.page._x.md) | | The method evaluates the XPath expression relative to the page document as its context node. If there are no such elements, the method resolves to an empty array. | +| [addScriptTag(options)](./puppeteer.page.addscripttag.md) | | Adds a <script> tag into the page with the desired URL or content. | +| [addStyleTag(options)](./puppeteer.page.addstyletag.md) | |

Adds a <link rel="stylesheet"> tag into the page with the desired URL or a <style type="text/css"> tag with the content.

Shortcut for [page.mainFrame().addStyleTag(options)](./puppeteer.frame.addstyletag_1.md).

| +| [addStyleTag(options)](./puppeteer.page.addstyletag_1.md) | | | +| [authenticate(credentials)](./puppeteer.page.authenticate.md) | | Provide credentials for HTTP authentication. | +| [bringToFront()](./puppeteer.page.bringtofront.md) | | Brings page to front (activates tab). | +| [browser()](./puppeteer.page.browser.md) | | Get the browser the page belongs to. | +| [browserContext()](./puppeteer.page.browsercontext.md) | | Get the browser context that the page belongs to. | +| [click(selector, options)](./puppeteer.page.click.md) | | This method fetches an element with selector, scrolls it into view if needed, and then uses [Page.mouse](./puppeteer.page.md) to click in the center of the element. If there's no element matching selector, the method throws an error. | +| [close(options)](./puppeteer.page.close.md) | | | +| [content()](./puppeteer.page.content.md) | | The full HTML contents of the page, including the DOCTYPE. | +| [cookies(urls)](./puppeteer.page.cookies.md) | | If no URLs are specified, this method returns cookies for the current page URL. If URLs are specified, only cookies for those URLs are returned. | +| [createCDPSession()](./puppeteer.page.createcdpsession.md) | | Creates a Chrome Devtools Protocol session attached to the page. | +| [createPDFStream(options)](./puppeteer.page.createpdfstream.md) | | Generates a PDF of the page with the print CSS media type. | +| [deleteCookie(cookies)](./puppeteer.page.deletecookie.md) | | | +| [emulate(device)](./puppeteer.page.emulate.md) | |

Emulates a given device's metrics and user agent.

To aid emulation, Puppeteer provides a list of known devices that can be via [KnownDevices](./puppeteer.knowndevices.md).

| +| [emulateCPUThrottling(factor)](./puppeteer.page.emulatecputhrottling.md) | | Enables CPU throttling to emulate slow CPUs. | +| [emulateIdleState(overrides)](./puppeteer.page.emulateidlestate.md) | | Emulates the idle state. If no arguments set, clears idle state emulation. | +| [emulateMediaFeatures(features)](./puppeteer.page.emulatemediafeatures.md) | | | +| [emulateMediaType(type)](./puppeteer.page.emulatemediatype.md) | | | +| [emulateNetworkConditions(networkConditions)](./puppeteer.page.emulatenetworkconditions.md) | |

This does not affect WebSockets and WebRTC PeerConnections (see https://crbug.com/563644). To set the page offline, you can use [Page.setOfflineMode()](./puppeteer.page.setofflinemode.md).

A list of predefined network conditions can be used by importing [PredefinedNetworkConditions](./puppeteer.predefinednetworkconditions.md).

| +| [emulateTimezone(timezoneId)](./puppeteer.page.emulatetimezone.md) | | | +| [emulateVisionDeficiency(type)](./puppeteer.page.emulatevisiondeficiency.md) | | Simulates the given vision deficiency on the page. | +| [evaluate(pageFunction, args)](./puppeteer.page.evaluate.md) | |

Evaluates a function in the page's context and returns the result.

If the function passed to page.evaluate returns a Promise, the function will wait for the promise to resolve and return its value.

| +| [evaluateHandle(pageFunction, args)](./puppeteer.page.evaluatehandle.md) | | | +| [evaluateOnNewDocument(pageFunction, args)](./puppeteer.page.evaluateonnewdocument.md) | |

Adds a function which would be invoked in one of the following scenarios:

- whenever the page is navigated

- whenever the child frame is attached or navigated. In this case, the function is invoked in the context of the newly attached frame.

The function is invoked after the document was created but before any of its scripts were run. This is useful to amend the JavaScript environment, e.g. to seed Math.random.

| +| [exposeFunction(name, pptrFunction)](./puppeteer.page.exposefunction.md) | |

The method adds a function called name on the page's window object. When called, the function executes puppeteerFunction in node.js and returns a Promise which resolves to the return value of puppeteerFunction.

If the puppeteerFunction returns a Promise, it will be awaited.

:::note

Functions installed via page.exposeFunction survive navigations.

:::note

| +| [focus(selector)](./puppeteer.page.focus.md) | | This method fetches an element with selector and focuses it. If there's no element matching selector, the method throws an error. | +| [frames()](./puppeteer.page.frames.md) | | An array of all frames attached to the page. | +| [getDefaultTimeout()](./puppeteer.page.getdefaulttimeout.md) | | Maximum time in milliseconds. | +| [goBack(options)](./puppeteer.page.goback.md) | | This method navigate to the previous page in history. | +| [goForward(options)](./puppeteer.page.goforward.md) | | This method navigate to the next page in history. | +| [goto(url, options)](./puppeteer.page.goto.md) | | | +| [hover(selector)](./puppeteer.page.hover.md) | | This method fetches an element with selector, scrolls it into view if needed, and then uses [Page.mouse](./puppeteer.page.md) to hover over the center of the element. If there's no element matching selector, the method throws an error. | +| [isClosed()](./puppeteer.page.isclosed.md) | | Indicates that the page has been closed. | +| [isDragInterceptionEnabled()](./puppeteer.page.isdraginterceptionenabled.md) | | true if drag events are being intercepted, false otherwise. | +| [isJavaScriptEnabled()](./puppeteer.page.isjavascriptenabled.md) | | true if the page has JavaScript enabled, false otherwise. | +| [isServiceWorkerBypassed()](./puppeteer.page.isserviceworkerbypassed.md) | | true if the service worker are being bypassed, false otherwise. | +| [locator(selector)](./puppeteer.page.locator.md) | | Creates a locator for the provided selector. See [Locator](./puppeteer.locator.md) for details and supported actions. | +| [mainFrame()](./puppeteer.page.mainframe.md) | | The page's main frame. | +| [metrics()](./puppeteer.page.metrics.md) | | Object containing metrics as key/value pairs. | +| [off(eventName, handler)](./puppeteer.page.off.md) | | | +| [on(eventName, handler)](./puppeteer.page.on.md) | |

Listen to page events.

:::note

This method exists to define event typings and handle proper wireup of cooperative request interception. Actual event listening and dispatching is delegated to [EventEmitter](./puppeteer.eventemitter.md).

:::

| +| [once(eventName, handler)](./puppeteer.page.once.md) | | | +| [pdf(options)](./puppeteer.page.pdf.md) | | Generates a PDF of the page with the print CSS media type. | +| [queryObjects(prototypeHandle)](./puppeteer.page.queryobjects.md) | | This method iterates the JavaScript heap and finds all objects with the given prototype. | +| [reload(options)](./puppeteer.page.reload.md) | | | +| [removeExposedFunction(name)](./puppeteer.page.removeexposedfunction.md) | | The method removes a previously added function via $[Page.exposeFunction()](./puppeteer.page.exposefunction.md) called name from the page's window object. | +| [removeScriptToEvaluateOnNewDocument(identifier)](./puppeteer.page.removescripttoevaluateonnewdocument.md) | | Removes script that injected into page by Page.evaluateOnNewDocument. | +| [screenshot(options)](./puppeteer.page.screenshot.md) | | Captures screenshot of the current page. | +| [screenshot(options)](./puppeteer.page.screenshot_1.md) | | | +| [screenshot(options)](./puppeteer.page.screenshot_2.md) | | | +| [select(selector, values)](./puppeteer.page.select.md) | | Triggers a change and input event once all the provided options have been selected. If there's no <select> element matching selector, the method throws an error. | +| [setBypassCSP(enabled)](./puppeteer.page.setbypasscsp.md) | | Toggles bypassing page's Content-Security-Policy. | +| [setBypassServiceWorker(bypass)](./puppeteer.page.setbypassserviceworker.md) | | Toggles ignoring of service worker for each request. | +| [setCacheEnabled(enabled)](./puppeteer.page.setcacheenabled.md) | | Toggles ignoring cache for each request based on the enabled state. By default, caching is enabled. | +| [setContent(html, options)](./puppeteer.page.setcontent.md) | | Set the content of the page. | +| [setCookie(cookies)](./puppeteer.page.setcookie.md) | | | +| [setDefaultNavigationTimeout(timeout)](./puppeteer.page.setdefaultnavigationtimeout.md) | |

This setting will change the default maximum navigation time for the following methods and related shortcuts:

- [page.goBack(options)](./puppeteer.page.goback.md)

- [page.goForward(options)](./puppeteer.page.goforward.md)

- [page.goto(url,options)](./puppeteer.page.goto.md)

- [page.reload(options)](./puppeteer.page.reload.md)

- [page.setContent(html,options)](./puppeteer.page.setcontent.md)

- [page.waitForNavigation(options)](./puppeteer.page.waitfornavigation.md)

| +| [setDefaultTimeout(timeout)](./puppeteer.page.setdefaulttimeout.md) | | | +| [setDragInterception(enabled)](./puppeteer.page.setdraginterception.md) | | | +| [setExtraHTTPHeaders(headers)](./puppeteer.page.setextrahttpheaders.md) | |

The extra HTTP headers will be sent with every request the page initiates.

:::tip

All HTTP header names are lowercased. (HTTP headers are case-insensitive, so this shouldn’t impact your server code.)

:::

:::note

page.setExtraHTTPHeaders does not guarantee the order of headers in the outgoing requests.

:::

| +| [setGeolocation(options)](./puppeteer.page.setgeolocation.md) | | Sets the page's geolocation. | +| [setJavaScriptEnabled(enabled)](./puppeteer.page.setjavascriptenabled.md) | | | +| [setOfflineMode(enabled)](./puppeteer.page.setofflinemode.md) | |

Sets the network connection to offline.

It does not change the parameters used in [Page.emulateNetworkConditions()](./puppeteer.page.emulatenetworkconditions.md)

| +| [setRequestInterception(value)](./puppeteer.page.setrequestinterception.md) | |

Activating request interception enables [HTTPRequest.abort()](./puppeteer.httprequest.abort.md), [HTTPRequest.continue()](./puppeteer.httprequest.continue.md) and [HTTPRequest.respond()](./puppeteer.httprequest.respond.md) methods. This provides the capability to modify network requests that are made by a page.

Once request interception is enabled, every request will stall unless it's continued, responded or aborted; or completed using the browser cache.

See the [Request interception guide](https://pptr.dev/next/guides/request-interception) for more details.

| +| [setUserAgent(userAgent, userAgentMetadata)](./puppeteer.page.setuseragent.md) | | | +| [setViewport(viewport)](./puppeteer.page.setviewport.md) | |

page.setViewport will resize the page. A lot of websites don't expect phones to change size, so you should set the viewport before navigating to the page.

In the case of multiple pages in a single browser, each page can have its own viewport size.

| +| [tap(selector)](./puppeteer.page.tap.md) | | This method fetches an element with selector, scrolls it into view if needed, and then uses [Page.touchscreen](./puppeteer.page.md) to tap in the center of the element. If there's no element matching selector, the method throws an error. | +| [target()](./puppeteer.page.target.md) | | A target this page was created from. | +| [title()](./puppeteer.page.title.md) | | The page's title | +| [type(selector, text, options)](./puppeteer.page.type.md) | |

Sends a keydown, keypress/input, and keyup event for each character in the text.

To press a special key, like Control or ArrowDown, use [Keyboard.press()](./puppeteer.keyboard.press.md).

| +| [url()](./puppeteer.page.url.md) | | The page's URL. | +| [viewport()](./puppeteer.page.viewport.md) | | Current page viewport settings. | +| [waitForDevicePrompt(options)](./puppeteer.page.waitfordeviceprompt.md) | |

This method is typically coupled with an action that triggers a device request from an api such as WebBluetooth.

:::caution

This must be called before the device request is made. It will not return a currently active device prompt.

:::

| +| [waitForFileChooser(options)](./puppeteer.page.waitforfilechooser.md) | |

This method is typically coupled with an action that triggers file choosing.

:::caution

This must be called before the file chooser is launched. It will not return a currently active file chooser.

:::

| +| [waitForFrame(urlOrPredicate, options)](./puppeteer.page.waitforframe.md) | | | +| [waitForFunction(pageFunction, options, args)](./puppeteer.page.waitforfunction.md) | | Waits for a function to finish evaluating in the page's context. | +| [waitForNavigation(options)](./puppeteer.page.waitfornavigation.md) | | Waits for the page to navigate to a new URL or to reload. It is useful when you run code that will indirectly cause the page to navigate. | +| [waitForNetworkIdle(options)](./puppeteer.page.waitfornetworkidle.md) | | | +| [waitForRequest(urlOrPredicate, options)](./puppeteer.page.waitforrequest.md) | | | +| [waitForResponse(urlOrPredicate, options)](./puppeteer.page.waitforresponse.md) | | | +| [waitForSelector(selector, options)](./puppeteer.page.waitforselector.md) | | Wait for the selector to appear in page. If at the moment of calling the method the selector already exists, the method will return immediately. If the selector doesn't appear after the timeout milliseconds of waiting, the function will throw. | +| [waitForTimeout(milliseconds)](./puppeteer.page.waitfortimeout.md) | | | +| [waitForXPath(xpath, options)](./puppeteer.page.waitforxpath.md) | | Wait for the xpath to appear in page. If at the moment of calling the method the xpath already exists, the method will return immediately. If the xpath doesn't appear after the timeout milliseconds of waiting, the function will throw. | +| [workers()](./puppeteer.page.workers.md) | | All of the dedicated [WebWorkers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) associated with the page. | diff --git a/docs/api/puppeteer.page.metrics.md b/docs/api/puppeteer.page.metrics.md index 14b0e82ba3d70..90c34d042188c 100644 --- a/docs/api/puppeteer.page.metrics.md +++ b/docs/api/puppeteer.page.metrics.md @@ -4,6 +4,8 @@ sidebar_label: Page.metrics # Page.metrics() method +Object containing metrics as key/value pairs. + #### Signature: ```typescript @@ -16,8 +18,6 @@ class Page { Promise<[Metrics](./puppeteer.metrics.md)> -Object containing metrics as key/value pairs. - - `Timestamp` : The timestamp when the metrics sample was taken. - `Documents` : Number of documents in the page. diff --git a/docs/api/puppeteer.page.mouse.md b/docs/api/puppeteer.page.mouse.md deleted file mode 100644 index c7648e32fe9b1..0000000000000 --- a/docs/api/puppeteer.page.mouse.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: Page.mouse ---- - -# Page.mouse property - -#### Signature: - -```typescript -class Page { - get mouse(): Mouse; -} -``` diff --git a/docs/api/puppeteer.page.off.md b/docs/api/puppeteer.page.off.md index 588f27c23b7b9..dadfa5968f5e2 100644 --- a/docs/api/puppeteer.page.off.md +++ b/docs/api/puppeteer.page.off.md @@ -11,7 +11,7 @@ class Page { off( eventName: K, handler: (event: PageEventObject[K]) => void - ): EventEmitter; + ): this; } ``` @@ -24,4 +24,4 @@ class Page { **Returns:** -[EventEmitter](./puppeteer.eventemitter.md) +this diff --git a/docs/api/puppeteer.page.on.md b/docs/api/puppeteer.page.on.md index a5d880d05d698..c2c8da12ad7d3 100644 --- a/docs/api/puppeteer.page.on.md +++ b/docs/api/puppeteer.page.on.md @@ -19,7 +19,7 @@ class Page { on( eventName: K, handler: (event: PageEventObject[K]) => void - ): EventEmitter; + ): this; } ``` @@ -32,4 +32,4 @@ class Page { **Returns:** -[EventEmitter](./puppeteer.eventemitter.md) +this diff --git a/docs/api/puppeteer.page.once.md b/docs/api/puppeteer.page.once.md index af45198df9342..3cdb2079a67a4 100644 --- a/docs/api/puppeteer.page.once.md +++ b/docs/api/puppeteer.page.once.md @@ -11,7 +11,7 @@ class Page { once( eventName: K, handler: (event: PageEventObject[K]) => void - ): EventEmitter; + ): this; } ``` @@ -24,4 +24,4 @@ class Page { **Returns:** -[EventEmitter](./puppeteer.eventemitter.md) +this diff --git a/docs/api/puppeteer.page.pdf.md b/docs/api/puppeteer.page.pdf.md index 0a7b357b271d0..e96e341e9e3fa 100644 --- a/docs/api/puppeteer.page.pdf.md +++ b/docs/api/puppeteer.page.pdf.md @@ -4,6 +4,8 @@ sidebar_label: Page.pdf # Page.pdf() method +Generates a PDF of the page with the `print` CSS media type. + #### Signature: ```typescript @@ -14,10 +16,16 @@ class Page { ## Parameters -| Parameter | Type | Description | -| --------- | --------------------------------------- | ------------ | -| options | [PDFOptions](./puppeteer.pdfoptions.md) | _(Optional)_ | +| Parameter | Type | Description | +| --------- | --------------------------------------- | -------------------------------------------- | +| options | [PDFOptions](./puppeteer.pdfoptions.md) | _(Optional)_ options for generating the PDF. | **Returns:** Promise<Buffer> + +## Remarks + +To generate a PDF with the `screen` media type, call [\`page.emulateMediaType('screen')\`](./puppeteer.page.emulatemediatype.md) before calling `page.pdf()`. + +By default, `page.pdf()` generates a pdf with modified colors for printing. Use the [\`-webkit-print-color-adjust\`](https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-print-color-adjust) property to force rendering of exact colors. diff --git a/docs/api/puppeteer.page.removeexposedfunction.md b/docs/api/puppeteer.page.removeexposedfunction.md new file mode 100644 index 0000000000000..1d55fa305ba1f --- /dev/null +++ b/docs/api/puppeteer.page.removeexposedfunction.md @@ -0,0 +1,25 @@ +--- +sidebar_label: Page.removeExposedFunction +--- + +# Page.removeExposedFunction() method + +The method removes a previously added function via $[Page.exposeFunction()](./puppeteer.page.exposefunction.md) called `name` from the page's `window` object. + +#### Signature: + +```typescript +class Page { + removeExposedFunction(name: string): Promise; +} +``` + +## Parameters + +| Parameter | Type | Description | +| --------- | ------ | ----------- | +| name | string | | + +**Returns:** + +Promise<void> diff --git a/docs/api/puppeteer.page.removescripttoevaluateonnewdocument.md b/docs/api/puppeteer.page.removescripttoevaluateonnewdocument.md new file mode 100644 index 0000000000000..ca3d45d349018 --- /dev/null +++ b/docs/api/puppeteer.page.removescripttoevaluateonnewdocument.md @@ -0,0 +1,25 @@ +--- +sidebar_label: Page.removeScriptToEvaluateOnNewDocument +--- + +# Page.removeScriptToEvaluateOnNewDocument() method + +Removes script that injected into page by Page.evaluateOnNewDocument. + +#### Signature: + +```typescript +class Page { + removeScriptToEvaluateOnNewDocument(identifier: string): Promise; +} +``` + +## Parameters + +| Parameter | Type | Description | +| ---------- | ------ | ----------------- | +| identifier | string | script identifier | + +**Returns:** + +Promise<void> diff --git a/docs/api/puppeteer.page.screenshot.md b/docs/api/puppeteer.page.screenshot.md index 7d4e1add903de..3ccd2d5cf3717 100644 --- a/docs/api/puppeteer.page.screenshot.md +++ b/docs/api/puppeteer.page.screenshot.md @@ -4,6 +4,8 @@ sidebar_label: Page.screenshot # Page.screenshot() method +Captures screenshot of the current page. + #### Signature: ```typescript @@ -34,7 +36,7 @@ Options object which might have the following properties: - `path` : The file path to save the image to. The screenshot type will be inferred from file extension. If `path` is a relative path, then it is resolved relative to [current working directory](https://nodejs.org/api/process.html#process_process_cwd). If no path is provided, the image won't be saved to the disk. -- `type` : Specify screenshot type, can be either `jpeg` or `png`. Defaults to 'png'. +- `type` : Specify screenshot type, can be `jpeg`, `png` or `webp`. Defaults to 'png'. - `quality` : The quality of the image, between 0-100. Not applicable to `png` images. @@ -49,5 +51,3 @@ Options object which might have the following properties: - `captureBeyondViewport` : When true, captures screenshot [beyond the viewport](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-captureScreenshot). When false, falls back to old behaviour, and cuts the screenshot by the viewport size. Defaults to `true`. - `fromSurface` : When true, captures screenshot [from the surface rather than the view](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-captureScreenshot). When false, works only in headful mode and ignores page viewport (but not browser window's bounds). Defaults to `true`. - -NOTE: Screenshots take at least 1/6 second on OS X. See [https://crbug.com/741689](https://crbug.com/741689) for discussion. diff --git a/docs/api/puppeteer.page.setbypassserviceworker.md b/docs/api/puppeteer.page.setbypassserviceworker.md new file mode 100644 index 0000000000000..34fbd40ce30d8 --- /dev/null +++ b/docs/api/puppeteer.page.setbypassserviceworker.md @@ -0,0 +1,25 @@ +--- +sidebar_label: Page.setBypassServiceWorker +--- + +# Page.setBypassServiceWorker() method + +Toggles ignoring of service worker for each request. + +#### Signature: + +```typescript +class Page { + setBypassServiceWorker(bypass: boolean): Promise; +} +``` + +## Parameters + +| Parameter | Type | Description | +| --------- | ------- | ------------------------------------------------------- | +| bypass | boolean | Whether to bypass service worker and load from network. | + +**Returns:** + +Promise<void> diff --git a/docs/api/puppeteer.page.setcacheenabled.md b/docs/api/puppeteer.page.setcacheenabled.md index 9b799e82a98d4..4dfebde4506bd 100644 --- a/docs/api/puppeteer.page.setcacheenabled.md +++ b/docs/api/puppeteer.page.setcacheenabled.md @@ -26,4 +26,4 @@ Promise<void> #### Default value: -true +`true` diff --git a/docs/api/puppeteer.page.setcontent.md b/docs/api/puppeteer.page.setcontent.md index 7fca64d554dc5..aacfeda921b01 100644 --- a/docs/api/puppeteer.page.setcontent.md +++ b/docs/api/puppeteer.page.setcontent.md @@ -4,6 +4,8 @@ sidebar_label: Page.setContent # Page.setContent() method +Set the content of the page. + #### Signature: ```typescript diff --git a/docs/api/puppeteer.page.tap.md b/docs/api/puppeteer.page.tap.md index bf91e7ecbb869..87fa397c7dc16 100644 --- a/docs/api/puppeteer.page.tap.md +++ b/docs/api/puppeteer.page.tap.md @@ -4,7 +4,7 @@ sidebar_label: Page.tap # Page.tap() method -This method fetches an element with `selector`, scrolls it into view if needed, and then uses [Page.touchscreen](./puppeteer.page.touchscreen.md) to tap in the center of the element. If there's no element matching `selector`, the method throws an error. +This method fetches an element with `selector`, scrolls it into view if needed, and then uses [Page.touchscreen](./puppeteer.page.md) to tap in the center of the element. If there's no element matching `selector`, the method throws an error. #### Signature: diff --git a/docs/api/puppeteer.page.target.md b/docs/api/puppeteer.page.target.md index e44ade04cdc6f..f44a26b200f47 100644 --- a/docs/api/puppeteer.page.target.md +++ b/docs/api/puppeteer.page.target.md @@ -4,6 +4,8 @@ sidebar_label: Page.target # Page.target() method +A target this page was created from. + #### Signature: ```typescript @@ -15,5 +17,3 @@ class Page { **Returns:** [Target](./puppeteer.target.md) - -A target this page was created from. diff --git a/docs/api/puppeteer.page.title.md b/docs/api/puppeteer.page.title.md index 1b58bb19c1654..170cb0ad6f6b7 100644 --- a/docs/api/puppeteer.page.title.md +++ b/docs/api/puppeteer.page.title.md @@ -4,6 +4,8 @@ sidebar_label: Page.title # Page.title() method +The page's title + #### Signature: ```typescript @@ -16,8 +18,6 @@ class Page { Promise<string> -The page's title - ## Remarks Shortcut for [page.mainFrame().title()](./puppeteer.frame.title.md). diff --git a/docs/api/puppeteer.page.touchscreen.md b/docs/api/puppeteer.page.touchscreen.md deleted file mode 100644 index 94b8430b06ed5..0000000000000 --- a/docs/api/puppeteer.page.touchscreen.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: Page.touchscreen ---- - -# Page.touchscreen property - -#### Signature: - -```typescript -class Page { - get touchscreen(): Touchscreen; -} -``` diff --git a/docs/api/puppeteer.page.tracing.md b/docs/api/puppeteer.page.tracing.md deleted file mode 100644 index b4537595ffbcf..0000000000000 --- a/docs/api/puppeteer.page.tracing.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: Page.tracing ---- - -# Page.tracing property - -#### Signature: - -```typescript -class Page { - get tracing(): Tracing; -} -``` diff --git a/docs/api/puppeteer.page.type.md b/docs/api/puppeteer.page.type.md index 23517c9937658..bf6e563bd6d43 100644 --- a/docs/api/puppeteer.page.type.md +++ b/docs/api/puppeteer.page.type.md @@ -15,20 +15,18 @@ class Page { type( selector: string, text: string, - options?: { - delay: number; - } + options?: Readonly ): Promise; } ``` ## Parameters -| Parameter | Type | Description | -| --------- | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| selector | string | A [selector](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors) of an element to type into. If there are multiple elements satisfying the selector, the first will be used. | -| text | string | A text to type into a focused element. | -| options | { delay: number; } | _(Optional)_ have property delay which is the Time to wait between key presses in milliseconds. Defaults to 0. | +| Parameter | Type | Description | +| --------- | ------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| selector | string | A [selector](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors) of an element to type into. If there are multiple elements satisfying the selector, the first will be used. | +| text | string | A text to type into a focused element. | +| options | Readonly<[KeyboardTypeOptions](./puppeteer.keyboardtypeoptions.md)> | _(Optional)_ have property delay which is the Time to wait between key presses in milliseconds. Defaults to 0. | **Returns:** diff --git a/docs/api/puppeteer.page.url.md b/docs/api/puppeteer.page.url.md index fd4f7fd868c16..3faf833096825 100644 --- a/docs/api/puppeteer.page.url.md +++ b/docs/api/puppeteer.page.url.md @@ -4,6 +4,8 @@ sidebar_label: Page.url # Page.url() method +The page's URL. + #### Signature: ```typescript diff --git a/docs/api/puppeteer.page.viewport.md b/docs/api/puppeteer.page.viewport.md index cb37bf36b07f4..1162d99a00ffd 100644 --- a/docs/api/puppeteer.page.viewport.md +++ b/docs/api/puppeteer.page.viewport.md @@ -4,6 +4,8 @@ sidebar_label: Page.viewport # Page.viewport() method +Current page viewport settings. + #### Signature: ```typescript diff --git a/docs/api/puppeteer.page.waitfordeviceprompt.md b/docs/api/puppeteer.page.waitfordeviceprompt.md new file mode 100644 index 0000000000000..a4c402ccfe714 --- /dev/null +++ b/docs/api/puppeteer.page.waitfordeviceprompt.md @@ -0,0 +1,45 @@ +--- +sidebar_label: Page.waitForDevicePrompt +--- + +# Page.waitForDevicePrompt() method + +This method is typically coupled with an action that triggers a device request from an api such as WebBluetooth. + +:::caution + +This must be called before the device request is made. It will not return a currently active device prompt. + +::: + +#### Signature: + +```typescript +class Page { + waitForDevicePrompt( + options?: WaitTimeoutOptions + ): Promise; +} +``` + +## Parameters + +| Parameter | Type | Description | +| --------- | ------------------------------------------------------- | ------------ | +| options | [WaitTimeoutOptions](./puppeteer.waittimeoutoptions.md) | _(Optional)_ | + +**Returns:** + +Promise<[DeviceRequestPrompt](./puppeteer.devicerequestprompt.md)> + +## Example + +```ts +const [devicePrompt] = Promise.all([ + page.waitForDevicePrompt(), + page.click('#connect-bluetooth'), +]); +await devicePrompt.select( + await devicePrompt.waitForDevice(({name}) => name.includes('My Device')) +); +``` diff --git a/docs/api/puppeteer.page.waitforfilechooser.md b/docs/api/puppeteer.page.waitforfilechooser.md index 57333a33874c6..ba2ee47a3d18a 100644 --- a/docs/api/puppeteer.page.waitforfilechooser.md +++ b/docs/api/puppeteer.page.waitforfilechooser.md @@ -32,7 +32,7 @@ Promise<[FileChooser](./puppeteer.filechooser.md)> ## Remarks -In non-headless Chromium, this method results in the native file picker dialog `not showing up` for the user. +In the "headful" browser, this method results in the native file picker dialog `not showing up` for the user. ## Example diff --git a/docs/api/puppeteer.page.waitforfunction.md b/docs/api/puppeteer.page.waitforfunction.md index db7d037c0badc..4ad53a6f94680 100644 --- a/docs/api/puppeteer.page.waitforfunction.md +++ b/docs/api/puppeteer.page.waitforfunction.md @@ -12,7 +12,7 @@ Waits for a function to finish evaluating in the page's context. class Page { waitForFunction< Params extends unknown[], - Func extends EvaluateFunc = EvaluateFunc + Func extends EvaluateFunc = EvaluateFunc, >( pageFunction: Func | string, options?: FrameWaitForFunctionOptions, diff --git a/docs/api/puppeteer.page.waitforselector.md b/docs/api/puppeteer.page.waitforselector.md index cbd961c673b7f..70a7432529986 100644 --- a/docs/api/puppeteer.page.waitforselector.md +++ b/docs/api/puppeteer.page.waitforselector.md @@ -6,28 +6,6 @@ sidebar_label: Page.waitForSelector Wait for the `selector` to appear in page. If at the moment of calling the method the `selector` already exists, the method will return immediately. If the `selector` doesn't appear after the `timeout` milliseconds of waiting, the function will throw. -This method works across navigations: - -```ts -import puppeteer from 'puppeteer'; -(async () => { - const browser = await puppeteer.launch(); - const page = await browser.newPage(); - let currentURL; - page - .waitForSelector('img') - .then(() => console.log('First URL with image: ' + currentURL)); - for (currentURL of [ - 'https://example.com', - 'https://google.com', - 'https://bbc.com', - ]) { - await page.goto(currentURL); - } - await browser.close(); -})(); -``` - #### Signature: ```typescript @@ -61,3 +39,27 @@ The optional Parameter in Arguments `options` are: - `hidden`: Wait for element to not be found in the DOM or to be hidden, i.e. have `display: none` or `visibility: hidden` CSS properties. Defaults to `false`. - `timeout`: maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can be changed by using the [Page.setDefaultTimeout()](./puppeteer.page.setdefaulttimeout.md) method. + +## Example + +This method works across navigations: + +```ts +import puppeteer from 'puppeteer'; +(async () => { + const browser = await puppeteer.launch(); + const page = await browser.newPage(); + let currentURL; + page + .waitForSelector('img') + .then(() => console.log('First URL with image: ' + currentURL)); + for (currentURL of [ + 'https://example.com', + 'https://google.com', + 'https://bbc.com', + ]) { + await page.goto(currentURL); + } + await browser.close(); +})(); +``` diff --git a/docs/api/puppeteer.page.waitforxpath.md b/docs/api/puppeteer.page.waitforxpath.md index 811ee6ca5be79..7f8aaa39ac392 100644 --- a/docs/api/puppeteer.page.waitforxpath.md +++ b/docs/api/puppeteer.page.waitforxpath.md @@ -6,28 +6,6 @@ sidebar_label: Page.waitForXPath Wait for the `xpath` to appear in page. If at the moment of calling the method the `xpath` already exists, the method will return immediately. If the `xpath` doesn't appear after the `timeout` milliseconds of waiting, the function will throw. -This method works across navigation - -```ts -import puppeteer from 'puppeteer'; -(async () => { - const browser = await puppeteer.launch(); - const page = await browser.newPage(); - let currentURL; - page - .waitForXPath('//img') - .then(() => console.log('First URL with image: ' + currentURL)); - for (currentURL of [ - 'https://example.com', - 'https://google.com', - 'https://bbc.com', - ]) { - await page.goto(currentURL); - } - await browser.close(); -})(); -``` - #### Signature: ```typescript @@ -61,3 +39,27 @@ The optional Argument `options` have properties: - `hidden`: A boolean wait for element to not be found in the DOM or to be hidden, i.e. have `display: none` or `visibility: hidden` CSS properties. Defaults to `false`. - `timeout`: A number which is maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can be changed by using the [Page.setDefaultTimeout()](./puppeteer.page.setdefaulttimeout.md) method. + +## Example + +This method works across navigation + +```ts +import puppeteer from 'puppeteer'; +(async () => { + const browser = await puppeteer.launch(); + const page = await browser.newPage(); + let currentURL; + page + .waitForXPath('//img') + .then(() => console.log('First URL with image: ' + currentURL)); + for (currentURL of [ + 'https://example.com', + 'https://google.com', + 'https://bbc.com', + ]) { + await page.goto(currentURL); + } + await browser.close(); +})(); +``` diff --git a/docs/api/puppeteer.page.workers.md b/docs/api/puppeteer.page.workers.md index c660032c02c37..64143902414c1 100644 --- a/docs/api/puppeteer.page.workers.md +++ b/docs/api/puppeteer.page.workers.md @@ -4,6 +4,8 @@ sidebar_label: Page.workers # Page.workers() method +All of the dedicated [WebWorkers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) associated with the page. + #### Signature: ```typescript @@ -16,8 +18,6 @@ class Page { [WebWorker](./puppeteer.webworker.md)\[\] -all of the dedicated [WebWorkers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) associated with the page. - ## Remarks This does not contain ServiceWorkers diff --git a/docs/api/puppeteer.pageeventobject.close.md b/docs/api/puppeteer.pageeventobject.close.md deleted file mode 100644 index 10885076f9462..0000000000000 --- a/docs/api/puppeteer.pageeventobject.close.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: PageEventObject.close ---- - -# PageEventObject.close property - -#### Signature: - -```typescript -interface PageEventObject { - close: never; -} -``` diff --git a/docs/api/puppeteer.pageeventobject.console.md b/docs/api/puppeteer.pageeventobject.console.md deleted file mode 100644 index 31f3acfd94af5..0000000000000 --- a/docs/api/puppeteer.pageeventobject.console.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: PageEventObject.console ---- - -# PageEventObject.console property - -#### Signature: - -```typescript -interface PageEventObject { - console: ConsoleMessage; -} -``` diff --git a/docs/api/puppeteer.pageeventobject.dialog.md b/docs/api/puppeteer.pageeventobject.dialog.md deleted file mode 100644 index de45e875e8905..0000000000000 --- a/docs/api/puppeteer.pageeventobject.dialog.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: PageEventObject.dialog ---- - -# PageEventObject.dialog property - -#### Signature: - -```typescript -interface PageEventObject { - dialog: Dialog; -} -``` diff --git a/docs/api/puppeteer.pageeventobject.domcontentloaded.md b/docs/api/puppeteer.pageeventobject.domcontentloaded.md deleted file mode 100644 index 972f997b295ca..0000000000000 --- a/docs/api/puppeteer.pageeventobject.domcontentloaded.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: PageEventObject.domcontentloaded ---- - -# PageEventObject.domcontentloaded property - -#### Signature: - -```typescript -interface PageEventObject { - domcontentloaded: never; -} -``` diff --git a/docs/api/puppeteer.pageeventobject.error.md b/docs/api/puppeteer.pageeventobject.error.md deleted file mode 100644 index 31a9b80132724..0000000000000 --- a/docs/api/puppeteer.pageeventobject.error.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: PageEventObject.error ---- - -# PageEventObject.error property - -#### Signature: - -```typescript -interface PageEventObject { - error: Error; -} -``` diff --git a/docs/api/puppeteer.pageeventobject.frameattached.md b/docs/api/puppeteer.pageeventobject.frameattached.md deleted file mode 100644 index bacc1d46b77fa..0000000000000 --- a/docs/api/puppeteer.pageeventobject.frameattached.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: PageEventObject.frameattached ---- - -# PageEventObject.frameattached property - -#### Signature: - -```typescript -interface PageEventObject { - frameattached: Frame; -} -``` diff --git a/docs/api/puppeteer.pageeventobject.framedetached.md b/docs/api/puppeteer.pageeventobject.framedetached.md deleted file mode 100644 index e2bb0c8414cea..0000000000000 --- a/docs/api/puppeteer.pageeventobject.framedetached.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: PageEventObject.framedetached ---- - -# PageEventObject.framedetached property - -#### Signature: - -```typescript -interface PageEventObject { - framedetached: Frame; -} -``` diff --git a/docs/api/puppeteer.pageeventobject.framenavigated.md b/docs/api/puppeteer.pageeventobject.framenavigated.md deleted file mode 100644 index dcad6de0ad8f0..0000000000000 --- a/docs/api/puppeteer.pageeventobject.framenavigated.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: PageEventObject.framenavigated ---- - -# PageEventObject.framenavigated property - -#### Signature: - -```typescript -interface PageEventObject { - framenavigated: Frame; -} -``` diff --git a/docs/api/puppeteer.pageeventobject.load.md b/docs/api/puppeteer.pageeventobject.load.md deleted file mode 100644 index 32b2841716f7e..0000000000000 --- a/docs/api/puppeteer.pageeventobject.load.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: PageEventObject.load ---- - -# PageEventObject.load property - -#### Signature: - -```typescript -interface PageEventObject { - load: never; -} -``` diff --git a/docs/api/puppeteer.pageeventobject.md b/docs/api/puppeteer.pageeventobject.md index b66b3527614dd..8fda1a908d3e3 100644 --- a/docs/api/puppeteer.pageeventobject.md +++ b/docs/api/puppeteer.pageeventobject.md @@ -16,24 +16,24 @@ export interface PageEventObject ## Properties -| Property | Modifiers | Type | Description | Default | -| ------------------------------------------------------------------------------- | --------- | -------------------------------------------------------------- | ----------- | ------- | -| [close](./puppeteer.pageeventobject.close.md) | | never | | | -| [console](./puppeteer.pageeventobject.console.md) | | [ConsoleMessage](./puppeteer.consolemessage.md) | | | -| [dialog](./puppeteer.pageeventobject.dialog.md) | | [Dialog](./puppeteer.dialog.md) | | | -| [domcontentloaded](./puppeteer.pageeventobject.domcontentloaded.md) | | never | | | -| [error](./puppeteer.pageeventobject.error.md) | | Error | | | -| [frameattached](./puppeteer.pageeventobject.frameattached.md) | | [Frame](./puppeteer.frame.md) | | | -| [framedetached](./puppeteer.pageeventobject.framedetached.md) | | [Frame](./puppeteer.frame.md) | | | -| [framenavigated](./puppeteer.pageeventobject.framenavigated.md) | | [Frame](./puppeteer.frame.md) | | | -| [load](./puppeteer.pageeventobject.load.md) | | never | | | -| [metrics](./puppeteer.pageeventobject.metrics.md) | | { title: string; metrics: [Metrics](./puppeteer.metrics.md); } | | | -| [pageerror](./puppeteer.pageeventobject.pageerror.md) | | Error | | | -| [popup](./puppeteer.pageeventobject.popup.md) | | [Page](./puppeteer.page.md) | | | -| [request](./puppeteer.pageeventobject.request.md) | | [HTTPRequest](./puppeteer.httprequest.md) | | | -| [requestfailed](./puppeteer.pageeventobject.requestfailed.md) | | [HTTPRequest](./puppeteer.httprequest.md) | | | -| [requestfinished](./puppeteer.pageeventobject.requestfinished.md) | | [HTTPRequest](./puppeteer.httprequest.md) | | | -| [requestservedfromcache](./puppeteer.pageeventobject.requestservedfromcache.md) | | [HTTPRequest](./puppeteer.httprequest.md) | | | -| [response](./puppeteer.pageeventobject.response.md) | | [HTTPResponse](./puppeteer.httpresponse.md) | | | -| [workercreated](./puppeteer.pageeventobject.workercreated.md) | | [WebWorker](./puppeteer.webworker.md) | | | -| [workerdestroyed](./puppeteer.pageeventobject.workerdestroyed.md) | | [WebWorker](./puppeteer.webworker.md) | | | +| Property | Modifiers | Type | Description | Default | +| ---------------------- | --------- | -------------------------------------------------------------- | ----------- | ------- | +| close | | never | | | +| console | | [ConsoleMessage](./puppeteer.consolemessage.md) | | | +| dialog | | [Dialog](./puppeteer.dialog.md) | | | +| domcontentloaded | | never | | | +| error | | Error | | | +| frameattached | | [Frame](./puppeteer.frame.md) | | | +| framedetached | | [Frame](./puppeteer.frame.md) | | | +| framenavigated | | [Frame](./puppeteer.frame.md) | | | +| load | | never | | | +| metrics | | { title: string; metrics: [Metrics](./puppeteer.metrics.md); } | | | +| pageerror | | Error | | | +| popup | | [Page](./puppeteer.page.md) | | | +| request | | [HTTPRequest](./puppeteer.httprequest.md) | | | +| requestfailed | | [HTTPRequest](./puppeteer.httprequest.md) | | | +| requestfinished | | [HTTPRequest](./puppeteer.httprequest.md) | | | +| requestservedfromcache | | [HTTPRequest](./puppeteer.httprequest.md) | | | +| response | | [HTTPResponse](./puppeteer.httpresponse.md) | | | +| workercreated | | [WebWorker](./puppeteer.webworker.md) | | | +| workerdestroyed | | [WebWorker](./puppeteer.webworker.md) | | | diff --git a/docs/api/puppeteer.pageeventobject.metrics.md b/docs/api/puppeteer.pageeventobject.metrics.md deleted file mode 100644 index d952b8003172f..0000000000000 --- a/docs/api/puppeteer.pageeventobject.metrics.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -sidebar_label: PageEventObject.metrics ---- - -# PageEventObject.metrics property - -#### Signature: - -```typescript -interface PageEventObject { - metrics: { - title: string; - metrics: Metrics; - }; -} -``` diff --git a/docs/api/puppeteer.pageeventobject.pageerror.md b/docs/api/puppeteer.pageeventobject.pageerror.md deleted file mode 100644 index eac4b50320964..0000000000000 --- a/docs/api/puppeteer.pageeventobject.pageerror.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: PageEventObject.pageerror ---- - -# PageEventObject.pageerror property - -#### Signature: - -```typescript -interface PageEventObject { - pageerror: Error; -} -``` diff --git a/docs/api/puppeteer.pageeventobject.popup.md b/docs/api/puppeteer.pageeventobject.popup.md deleted file mode 100644 index 517655e687ff0..0000000000000 --- a/docs/api/puppeteer.pageeventobject.popup.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: PageEventObject.popup ---- - -# PageEventObject.popup property - -#### Signature: - -```typescript -interface PageEventObject { - popup: Page; -} -``` diff --git a/docs/api/puppeteer.pageeventobject.request.md b/docs/api/puppeteer.pageeventobject.request.md deleted file mode 100644 index 2309c5a3120dc..0000000000000 --- a/docs/api/puppeteer.pageeventobject.request.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: PageEventObject.request ---- - -# PageEventObject.request property - -#### Signature: - -```typescript -interface PageEventObject { - request: HTTPRequest; -} -``` diff --git a/docs/api/puppeteer.pageeventobject.requestfailed.md b/docs/api/puppeteer.pageeventobject.requestfailed.md deleted file mode 100644 index b0339fce54d49..0000000000000 --- a/docs/api/puppeteer.pageeventobject.requestfailed.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: PageEventObject.requestfailed ---- - -# PageEventObject.requestfailed property - -#### Signature: - -```typescript -interface PageEventObject { - requestfailed: HTTPRequest; -} -``` diff --git a/docs/api/puppeteer.pageeventobject.requestfinished.md b/docs/api/puppeteer.pageeventobject.requestfinished.md deleted file mode 100644 index 34b35a57c0a55..0000000000000 --- a/docs/api/puppeteer.pageeventobject.requestfinished.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: PageEventObject.requestfinished ---- - -# PageEventObject.requestfinished property - -#### Signature: - -```typescript -interface PageEventObject { - requestfinished: HTTPRequest; -} -``` diff --git a/docs/api/puppeteer.pageeventobject.requestservedfromcache.md b/docs/api/puppeteer.pageeventobject.requestservedfromcache.md deleted file mode 100644 index 66fb90a0cd3f5..0000000000000 --- a/docs/api/puppeteer.pageeventobject.requestservedfromcache.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: PageEventObject.requestservedfromcache ---- - -# PageEventObject.requestservedfromcache property - -#### Signature: - -```typescript -interface PageEventObject { - requestservedfromcache: HTTPRequest; -} -``` diff --git a/docs/api/puppeteer.pageeventobject.response.md b/docs/api/puppeteer.pageeventobject.response.md deleted file mode 100644 index 8e4e2f0a3e4ec..0000000000000 --- a/docs/api/puppeteer.pageeventobject.response.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: PageEventObject.response ---- - -# PageEventObject.response property - -#### Signature: - -```typescript -interface PageEventObject { - response: HTTPResponse; -} -``` diff --git a/docs/api/puppeteer.pageeventobject.workercreated.md b/docs/api/puppeteer.pageeventobject.workercreated.md deleted file mode 100644 index c84120fce582f..0000000000000 --- a/docs/api/puppeteer.pageeventobject.workercreated.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: PageEventObject.workercreated ---- - -# PageEventObject.workercreated property - -#### Signature: - -```typescript -interface PageEventObject { - workercreated: WebWorker; -} -``` diff --git a/docs/api/puppeteer.pageeventobject.workerdestroyed.md b/docs/api/puppeteer.pageeventobject.workerdestroyed.md deleted file mode 100644 index d5946a89d85b4..0000000000000 --- a/docs/api/puppeteer.pageeventobject.workerdestroyed.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: PageEventObject.workerdestroyed ---- - -# PageEventObject.workerdestroyed property - -#### Signature: - -```typescript -interface PageEventObject { - workerdestroyed: WebWorker; -} -``` diff --git a/docs/api/puppeteer.pdfmargin.bottom.md b/docs/api/puppeteer.pdfmargin.bottom.md deleted file mode 100644 index e933d072787ec..0000000000000 --- a/docs/api/puppeteer.pdfmargin.bottom.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: PDFMargin.bottom ---- - -# PDFMargin.bottom property - -#### Signature: - -```typescript -interface PDFMargin { - bottom?: string | number; -} -``` diff --git a/docs/api/puppeteer.pdfmargin.left.md b/docs/api/puppeteer.pdfmargin.left.md deleted file mode 100644 index dba54bba9cd1a..0000000000000 --- a/docs/api/puppeteer.pdfmargin.left.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: PDFMargin.left ---- - -# PDFMargin.left property - -#### Signature: - -```typescript -interface PDFMargin { - left?: string | number; -} -``` diff --git a/docs/api/puppeteer.pdfmargin.md b/docs/api/puppeteer.pdfmargin.md index 630d942bfea3e..5cd11ee34158c 100644 --- a/docs/api/puppeteer.pdfmargin.md +++ b/docs/api/puppeteer.pdfmargin.md @@ -12,9 +12,9 @@ export interface PDFMargin ## Properties -| Property | Modifiers | Type | Description | Default | -| ------------------------------------------ | --------- | ---------------- | ------------ | ------- | -| [bottom?](./puppeteer.pdfmargin.bottom.md) | | string \| number | _(Optional)_ | | -| [left?](./puppeteer.pdfmargin.left.md) | | string \| number | _(Optional)_ | | -| [right?](./puppeteer.pdfmargin.right.md) | | string \| number | _(Optional)_ | | -| [top?](./puppeteer.pdfmargin.top.md) | | string \| number | _(Optional)_ | | +| Property | Modifiers | Type | Description | Default | +| -------- | --------------------- | ---------------- | ----------- | ------- | +| bottom | optional | string \| number | | | +| left | optional | string \| number | | | +| right | optional | string \| number | | | +| top | optional | string \| number | | | diff --git a/docs/api/puppeteer.pdfmargin.right.md b/docs/api/puppeteer.pdfmargin.right.md deleted file mode 100644 index c8da619ecaa5d..0000000000000 --- a/docs/api/puppeteer.pdfmargin.right.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: PDFMargin.right ---- - -# PDFMargin.right property - -#### Signature: - -```typescript -interface PDFMargin { - right?: string | number; -} -``` diff --git a/docs/api/puppeteer.pdfmargin.top.md b/docs/api/puppeteer.pdfmargin.top.md deleted file mode 100644 index 92d9de6f369a9..0000000000000 --- a/docs/api/puppeteer.pdfmargin.top.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: PDFMargin.top ---- - -# PDFMargin.top property - -#### Signature: - -```typescript -interface PDFMargin { - top?: string | number; -} -``` diff --git a/docs/api/puppeteer.pdfoptions.displayheaderfooter.md b/docs/api/puppeteer.pdfoptions.displayheaderfooter.md deleted file mode 100644 index 088f140977371..0000000000000 --- a/docs/api/puppeteer.pdfoptions.displayheaderfooter.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: PDFOptions.displayHeaderFooter ---- - -# PDFOptions.displayHeaderFooter property - -Whether to show the header and footer. - -#### Signature: - -```typescript -interface PDFOptions { - displayHeaderFooter?: boolean; -} -``` - -#### Default value: - -false diff --git a/docs/api/puppeteer.pdfoptions.footertemplate.md b/docs/api/puppeteer.pdfoptions.footertemplate.md deleted file mode 100644 index c48e77de00e12..0000000000000 --- a/docs/api/puppeteer.pdfoptions.footertemplate.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: PDFOptions.footerTemplate ---- - -# PDFOptions.footerTemplate property - -HTML template for the print footer. Has the same constraints and support for special classes as [PDFOptions.headerTemplate](./puppeteer.pdfoptions.headertemplate.md). - -#### Signature: - -```typescript -interface PDFOptions { - footerTemplate?: string; -} -``` diff --git a/docs/api/puppeteer.pdfoptions.format.md b/docs/api/puppeteer.pdfoptions.format.md deleted file mode 100644 index f18d33eb62ab3..0000000000000 --- a/docs/api/puppeteer.pdfoptions.format.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -sidebar_label: PDFOptions.format ---- - -# PDFOptions.format property - -#### Signature: - -```typescript -interface PDFOptions { - format?: PaperFormat; -} -``` - -#### Default value: - -`letter`. - -## Remarks - -If set, this takes priority over the `width` and `height` options. diff --git a/docs/api/puppeteer.pdfoptions.headertemplate.md b/docs/api/puppeteer.pdfoptions.headertemplate.md deleted file mode 100644 index 08f4395734cd8..0000000000000 --- a/docs/api/puppeteer.pdfoptions.headertemplate.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -sidebar_label: PDFOptions.headerTemplate ---- - -# PDFOptions.headerTemplate property - -HTML template for the print header. Should be valid HTML with the following classes used to inject values into them: - -- `date` formatted print date - -- `title` document title - -- `url` document location - -- `pageNumber` current page number - -- `totalPages` total pages in the document - -#### Signature: - -```typescript -interface PDFOptions { - headerTemplate?: string; -} -``` diff --git a/docs/api/puppeteer.pdfoptions.height.md b/docs/api/puppeteer.pdfoptions.height.md deleted file mode 100644 index f11b625d5c904..0000000000000 --- a/docs/api/puppeteer.pdfoptions.height.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: PDFOptions.height ---- - -# PDFOptions.height property - -Sets the height of paper. You can pass in a number or a string with a unit. - -#### Signature: - -```typescript -interface PDFOptions { - height?: string | number; -} -``` diff --git a/docs/api/puppeteer.pdfoptions.landscape.md b/docs/api/puppeteer.pdfoptions.landscape.md deleted file mode 100644 index 72fe9af127e02..0000000000000 --- a/docs/api/puppeteer.pdfoptions.landscape.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: PDFOptions.landscape ---- - -# PDFOptions.landscape property - -Whether to print in landscape orientation. - -#### Signature: - -```typescript -interface PDFOptions { - landscape?: boolean; -} -``` - -#### Default value: - -= false diff --git a/docs/api/puppeteer.pdfoptions.margin.md b/docs/api/puppeteer.pdfoptions.margin.md deleted file mode 100644 index 1fa8bbbb3ee7b..0000000000000 --- a/docs/api/puppeteer.pdfoptions.margin.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: PDFOptions.margin ---- - -# PDFOptions.margin property - -Set the PDF margins. - -#### Signature: - -```typescript -interface PDFOptions { - margin?: PDFMargin; -} -``` - -#### Default value: - -no margins are set. diff --git a/docs/api/puppeteer.pdfoptions.md b/docs/api/puppeteer.pdfoptions.md index cb2efb4c69aeb..e764f6142df66 100644 --- a/docs/api/puppeteer.pdfoptions.md +++ b/docs/api/puppeteer.pdfoptions.md @@ -14,20 +14,20 @@ export interface PDFOptions ## Properties -| Property | Modifiers | Type | Description | Default | -| --------------------------------------------------------------------- | --------- | ----------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- | -| [displayHeaderFooter?](./puppeteer.pdfoptions.displayheaderfooter.md) | | boolean | _(Optional)_ Whether to show the header and footer. | false | -| [footerTemplate?](./puppeteer.pdfoptions.footertemplate.md) | | string | _(Optional)_ HTML template for the print footer. Has the same constraints and support for special classes as [PDFOptions.headerTemplate](./puppeteer.pdfoptions.headertemplate.md). | | -| [format?](./puppeteer.pdfoptions.format.md) | | [PaperFormat](./puppeteer.paperformat.md) | _(Optional)_ | letter. | -| [headerTemplate?](./puppeteer.pdfoptions.headertemplate.md) | | string |

_(Optional)_ HTML template for the print header. Should be valid HTML with the following classes used to inject values into them:

- date formatted print date

- title document title

- url document location

- pageNumber current page number

- totalPages total pages in the document

| | -| [height?](./puppeteer.pdfoptions.height.md) | | string \| number | _(Optional)_ Sets the height of paper. You can pass in a number or a string with a unit. | | -| [landscape?](./puppeteer.pdfoptions.landscape.md) | | boolean | _(Optional)_ Whether to print in landscape orientation. | = false | -| [margin?](./puppeteer.pdfoptions.margin.md) | | [PDFMargin](./puppeteer.pdfmargin.md) | _(Optional)_ Set the PDF margins. | no margins are set. | -| [omitBackground?](./puppeteer.pdfoptions.omitbackground.md) | | boolean | _(Optional)_ Hides default white background and allows generating pdfs with transparency. | false | -| [pageRanges?](./puppeteer.pdfoptions.pageranges.md) | | string | _(Optional)_ Paper ranges to print, e.g. 1-5, 8, 11-13. | The empty string, which means all pages are printed. | -| [path?](./puppeteer.pdfoptions.path.md) | | string | _(Optional)_ The path to save the file to. | the empty string, which means the PDF will not be written to disk. | -| [preferCSSPageSize?](./puppeteer.pdfoptions.prefercsspagesize.md) | | boolean | _(Optional)_ Give any CSS @page size declared in the page priority over what is declared in the width or height or format option. | false, which will scale the content to fit the paper size. | -| [printBackground?](./puppeteer.pdfoptions.printbackground.md) | | boolean | _(Optional)_ Set to true to print background graphics. | false | -| [scale?](./puppeteer.pdfoptions.scale.md) | | number | _(Optional)_ Scales the rendering of the web page. Amount must be between 0.1 and 2. | 1 | -| [timeout?](./puppeteer.pdfoptions.timeout.md) | | number | _(Optional)_ Timeout in milliseconds. Pass 0 to disable timeout. | 30000 | -| [width?](./puppeteer.pdfoptions.width.md) | | string \| number | _(Optional)_ Sets the width of paper. You can pass in a number or a string with a unit. | | +| Property | Modifiers | Type | Description | Default | +| ------------------- | --------------------- | ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ | +| displayHeaderFooter | optional | boolean | Whether to show the header and footer. | false | +| footerTemplate | optional | string | HTML template for the print footer. Has the same constraints and support for special classes as [PDFOptions.headerTemplate](./puppeteer.pdfoptions.md). | | +| format | optional | [PaperFormat](./puppeteer.paperformat.md) | | letter. | +| headerTemplate | optional | string |

HTML template for the print header. Should be valid HTML with the following classes used to inject values into them:

- date formatted print date

- title document title

- url document location

- pageNumber current page number

- totalPages total pages in the document

| | +| height | optional | string \| number | Sets the height of paper. You can pass in a number or a string with a unit. | | +| landscape | optional | boolean | Whether to print in landscape orientation. | false | +| margin | optional | [PDFMargin](./puppeteer.pdfmargin.md) | Set the PDF margins. | undefined no margins are set. | +| omitBackground | optional | boolean | Hides default white background and allows generating pdfs with transparency. | false | +| pageRanges | optional | string | Paper ranges to print, e.g. 1-5, 8, 11-13. | The empty string, which means all pages are printed. | +| path | optional | string | The path to save the file to. | undefined, which means the PDF will not be written to disk. | +| preferCSSPageSize | optional | boolean | Give any CSS @page size declared in the page priority over what is declared in the width or height or format option. | false, which will scale the content to fit the paper size. | +| printBackground | optional | boolean | Set to true to print background graphics. | false | +| scale | optional | number | Scales the rendering of the web page. Amount must be between 0.1 and 2. | 1 | +| timeout | optional | number | Timeout in milliseconds. Pass 0 to disable timeout. | 30_000 | +| width | optional | string \| number | Sets the width of paper. You can pass in a number or a string with a unit. | | diff --git a/docs/api/puppeteer.pdfoptions.omitbackground.md b/docs/api/puppeteer.pdfoptions.omitbackground.md deleted file mode 100644 index bd057262d9c19..0000000000000 --- a/docs/api/puppeteer.pdfoptions.omitbackground.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: PDFOptions.omitBackground ---- - -# PDFOptions.omitBackground property - -Hides default white background and allows generating pdfs with transparency. - -#### Signature: - -```typescript -interface PDFOptions { - omitBackground?: boolean; -} -``` - -#### Default value: - -false diff --git a/docs/api/puppeteer.pdfoptions.pageranges.md b/docs/api/puppeteer.pdfoptions.pageranges.md deleted file mode 100644 index 15f86c3969f18..0000000000000 --- a/docs/api/puppeteer.pdfoptions.pageranges.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: PDFOptions.pageRanges ---- - -# PDFOptions.pageRanges property - -Paper ranges to print, e.g. `1-5, 8, 11-13`. - -#### Signature: - -```typescript -interface PDFOptions { - pageRanges?: string; -} -``` - -#### Default value: - -The empty string, which means all pages are printed. diff --git a/docs/api/puppeteer.pdfoptions.path.md b/docs/api/puppeteer.pdfoptions.path.md deleted file mode 100644 index d46ed72ad2645..0000000000000 --- a/docs/api/puppeteer.pdfoptions.path.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -sidebar_label: PDFOptions.path ---- - -# PDFOptions.path property - -The path to save the file to. - -#### Signature: - -```typescript -interface PDFOptions { - path?: string; -} -``` - -#### Default value: - -the empty string, which means the PDF will not be written to disk. - -## Remarks - -If the path is relative, it's resolved relative to the current working directory. diff --git a/docs/api/puppeteer.pdfoptions.prefercsspagesize.md b/docs/api/puppeteer.pdfoptions.prefercsspagesize.md deleted file mode 100644 index 33d24ae2481fc..0000000000000 --- a/docs/api/puppeteer.pdfoptions.prefercsspagesize.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: PDFOptions.preferCSSPageSize ---- - -# PDFOptions.preferCSSPageSize property - -Give any CSS `@page` size declared in the page priority over what is declared in the `width` or `height` or `format` option. - -#### Signature: - -```typescript -interface PDFOptions { - preferCSSPageSize?: boolean; -} -``` - -#### Default value: - -`false`, which will scale the content to fit the paper size. diff --git a/docs/api/puppeteer.pdfoptions.printbackground.md b/docs/api/puppeteer.pdfoptions.printbackground.md deleted file mode 100644 index 0e12670e6c6ac..0000000000000 --- a/docs/api/puppeteer.pdfoptions.printbackground.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: PDFOptions.printBackground ---- - -# PDFOptions.printBackground property - -Set to `true` to print background graphics. - -#### Signature: - -```typescript -interface PDFOptions { - printBackground?: boolean; -} -``` - -#### Default value: - -false diff --git a/docs/api/puppeteer.pdfoptions.scale.md b/docs/api/puppeteer.pdfoptions.scale.md deleted file mode 100644 index 282dc77e3b9ea..0000000000000 --- a/docs/api/puppeteer.pdfoptions.scale.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: PDFOptions.scale ---- - -# PDFOptions.scale property - -Scales the rendering of the web page. Amount must be between `0.1` and `2`. - -#### Signature: - -```typescript -interface PDFOptions { - scale?: number; -} -``` - -#### Default value: - -1 diff --git a/docs/api/puppeteer.pdfoptions.timeout.md b/docs/api/puppeteer.pdfoptions.timeout.md deleted file mode 100644 index 2259dd08bf0b0..0000000000000 --- a/docs/api/puppeteer.pdfoptions.timeout.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: PDFOptions.timeout ---- - -# PDFOptions.timeout property - -Timeout in milliseconds. Pass `0` to disable timeout. - -#### Signature: - -```typescript -interface PDFOptions { - timeout?: number; -} -``` - -#### Default value: - -30000 diff --git a/docs/api/puppeteer.pdfoptions.width.md b/docs/api/puppeteer.pdfoptions.width.md deleted file mode 100644 index d0b925dc4a351..0000000000000 --- a/docs/api/puppeteer.pdfoptions.width.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: PDFOptions.width ---- - -# PDFOptions.width property - -Sets the width of paper. You can pass in a number or a string with a unit. - -#### Signature: - -```typescript -interface PDFOptions { - width?: string | number; -} -``` diff --git a/docs/api/puppeteer.permission.md b/docs/api/puppeteer.permission.md index a19e11897e42f..037d587fb6c73 100644 --- a/docs/api/puppeteer.permission.md +++ b/docs/api/puppeteer.permission.md @@ -21,6 +21,7 @@ export type Permission = | 'accessibility-events' | 'clipboard-read' | 'clipboard-write' + | 'clipboard-sanitized-write' | 'payment-handler' | 'persistent-storage' | 'idle-detection' diff --git a/docs/api/puppeteer.platform.md b/docs/api/puppeteer.platform.md deleted file mode 100644 index 9d61793f2fa57..0000000000000 --- a/docs/api/puppeteer.platform.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: Platform ---- - -# Platform type - -Supported platforms. - -#### Signature: - -```typescript -export type Platform = 'linux' | 'mac' | 'mac_arm' | 'win32' | 'win64'; -``` diff --git a/docs/api/puppeteer.point.md b/docs/api/puppeteer.point.md index b89a4774a126b..55acd6b123065 100644 --- a/docs/api/puppeteer.point.md +++ b/docs/api/puppeteer.point.md @@ -12,7 +12,7 @@ export interface Point ## Properties -| Property | Modifiers | Type | Description | Default | -| --------------------------- | --------- | ------ | ----------- | ------- | -| [x](./puppeteer.point.x.md) | | number | | | -| [y](./puppeteer.point.y.md) | | number | | | +| Property | Modifiers | Type | Description | Default | +| -------- | --------- | ------ | ----------- | ------- | +| x | | number | | | +| y | | number | | | diff --git a/docs/api/puppeteer.point.x.md b/docs/api/puppeteer.point.x.md deleted file mode 100644 index 780cf6ae990f4..0000000000000 --- a/docs/api/puppeteer.point.x.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: Point.x ---- - -# Point.x property - -#### Signature: - -```typescript -interface Point { - x: number; -} -``` diff --git a/docs/api/puppeteer.point.y.md b/docs/api/puppeteer.point.y.md deleted file mode 100644 index b15376c659603..0000000000000 --- a/docs/api/puppeteer.point.y.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: Point.y ---- - -# Point.y property - -#### Signature: - -```typescript -interface Point { - y: number; -} -``` diff --git a/docs/api/puppeteer.predicate.md b/docs/api/puppeteer.predicate.md new file mode 100644 index 0000000000000..4235474825950 --- /dev/null +++ b/docs/api/puppeteer.predicate.md @@ -0,0 +1,15 @@ +--- +sidebar_label: Predicate +--- + +# Predicate type + +#### Signature: + +```typescript +export type Predicate = + | ((value: From) => value is To) + | ((value: From) => Awaitable); +``` + +**References:** [Awaitable](./puppeteer.awaitable.md) diff --git a/docs/api/puppeteer.pressoptions.delay.md b/docs/api/puppeteer.pressoptions.delay.md deleted file mode 100644 index b011be395f408..0000000000000 --- a/docs/api/puppeteer.pressoptions.delay.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: PressOptions.delay ---- - -# PressOptions.delay property - -Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0. - -#### Signature: - -```typescript -interface PressOptions { - delay?: number; -} -``` diff --git a/docs/api/puppeteer.pressoptions.md b/docs/api/puppeteer.pressoptions.md deleted file mode 100644 index bf1f703fdbf0f..0000000000000 --- a/docs/api/puppeteer.pressoptions.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -sidebar_label: PressOptions ---- - -# PressOptions interface - -#### Signature: - -```typescript -export interface PressOptions -``` - -## Properties - -| Property | Modifiers | Type | Description | Default | -| ------------------------------------------- | --------- | ------ | ------------------------------------------------------------------------------------------------------------- | ------- | -| [delay?](./puppeteer.pressoptions.delay.md) | | number | _(Optional)_ Time to wait between keydown and keyup in milliseconds. Defaults to 0. | | -| [text?](./puppeteer.pressoptions.text.md) | | string | _(Optional)_ If specified, generates an input event with this text. | | diff --git a/docs/api/puppeteer.pressoptions.text.md b/docs/api/puppeteer.pressoptions.text.md deleted file mode 100644 index 176ec2aa16c10..0000000000000 --- a/docs/api/puppeteer.pressoptions.text.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: PressOptions.text ---- - -# PressOptions.text property - -If specified, generates an input event with this text. - -#### Signature: - -```typescript -interface PressOptions { - text?: string; -} -``` diff --git a/docs/api/puppeteer.productlauncher.launch.md b/docs/api/puppeteer.productlauncher.launch.md index 1f0a9d933d93c..4d1b7d2ccb31a 100644 --- a/docs/api/puppeteer.productlauncher.launch.md +++ b/docs/api/puppeteer.productlauncher.launch.md @@ -8,15 +8,15 @@ sidebar_label: ProductLauncher.launch ```typescript class ProductLauncher { - launch(object: PuppeteerNodeLaunchOptions): Promise; + launch(options?: PuppeteerNodeLaunchOptions): Promise; } ``` ## Parameters -| Parameter | Type | Description | -| --------- | ----------------------------------------------------------------------- | ----------- | -| object | [PuppeteerNodeLaunchOptions](./puppeteer.puppeteernodelaunchoptions.md) | | +| Parameter | Type | Description | +| --------- | ----------------------------------------------------------------------- | ------------ | +| options | [PuppeteerNodeLaunchOptions](./puppeteer.puppeteernodelaunchoptions.md) | _(Optional)_ | **Returns:** diff --git a/docs/api/puppeteer.productlauncher.md b/docs/api/puppeteer.productlauncher.md index ec71edc83d1d7..f4eed461aec95 100644 --- a/docs/api/puppeteer.productlauncher.md +++ b/docs/api/puppeteer.productlauncher.md @@ -18,9 +18,9 @@ The constructor for this class is marked as internal. Third-party code should no ## Properties -| Property | Modifiers | Type | Description | -| ------------------------------------------------- | --------------------- | --------------------------------- | ----------- | -| [product](./puppeteer.productlauncher.product.md) | readonly | [Product](./puppeteer.product.md) | | +| Property | Modifiers | Type | Description | +| -------- | --------------------- | --------------------------------- | ----------- | +| product | readonly | [Product](./puppeteer.product.md) | | ## Methods @@ -28,4 +28,4 @@ The constructor for this class is marked as internal. Third-party code should no | ------------------------------------------------------------------------ | --------- | ----------- | | [defaultArgs(object)](./puppeteer.productlauncher.defaultargs.md) | | | | [executablePath(channel)](./puppeteer.productlauncher.executablepath.md) | | | -| [launch(object)](./puppeteer.productlauncher.launch.md) | | | +| [launch(options)](./puppeteer.productlauncher.launch.md) | | | diff --git a/docs/api/puppeteer.productlauncher.product.md b/docs/api/puppeteer.productlauncher.product.md deleted file mode 100644 index 6aa3e98220b39..0000000000000 --- a/docs/api/puppeteer.productlauncher.product.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: ProductLauncher.product ---- - -# ProductLauncher.product property - -#### Signature: - -```typescript -class ProductLauncher { - get product(): Product; -} -``` diff --git a/docs/api/puppeteer.protocolerror.code.md b/docs/api/puppeteer.protocolerror.code.md deleted file mode 100644 index ce3e99fa8c327..0000000000000 --- a/docs/api/puppeteer.protocolerror.code.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: ProtocolError.code ---- - -# ProtocolError.code property - -#### Signature: - -```typescript -class ProtocolError { - set code(code: number | undefined); -} -``` diff --git a/docs/api/puppeteer.protocolerror.md b/docs/api/puppeteer.protocolerror.md index fa49600a951c5..121696eca01c6 100644 --- a/docs/api/puppeteer.protocolerror.md +++ b/docs/api/puppeteer.protocolerror.md @@ -16,7 +16,7 @@ export declare class ProtocolError extends CustomError ## Properties -| Property | Modifiers | Type | Description | -| --------------------------------------------------------------- | --------------------- | ------------------- | ----------- | -| [code](./puppeteer.protocolerror.code.md) | readonly | number \| undefined | | -| [originalMessage](./puppeteer.protocolerror.originalmessage.md) | readonly | string | | +| Property | Modifiers | Type | Description | +| --------------- | --------------------- | ------------------- | ----------- | +| code | readonly | number \| undefined | | +| originalMessage | readonly | string | | diff --git a/docs/api/puppeteer.protocolerror.originalmessage.md b/docs/api/puppeteer.protocolerror.originalmessage.md deleted file mode 100644 index 012358cbb4d9e..0000000000000 --- a/docs/api/puppeteer.protocolerror.originalmessage.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: ProtocolError.originalMessage ---- - -# ProtocolError.originalMessage property - -#### Signature: - -```typescript -class ProtocolError { - set originalMessage(originalMessage: string); -} -``` diff --git a/docs/api/puppeteer.puppeteererrors.md b/docs/api/puppeteer.puppeteererrors.md index 9d60b14c6ed64..5993f942a6852 100644 --- a/docs/api/puppeteer.puppeteererrors.md +++ b/docs/api/puppeteer.puppeteererrors.md @@ -16,7 +16,7 @@ export interface PuppeteerErrors ## Properties -| Property | Modifiers | Type | Description | Default | -| ------------------------------------------------------------- | --------- | ---------------------------------------------------- | ----------- | ------- | -| [ProtocolError](./puppeteer.puppeteererrors.protocolerror.md) | | typeof [ProtocolError](./puppeteer.protocolerror.md) | | | -| [TimeoutError](./puppeteer.puppeteererrors.timeouterror.md) | | typeof [TimeoutError](./puppeteer.timeouterror.md) | | | +| Property | Modifiers | Type | Description | Default | +| ------------- | --------- | ---------------------------------------------------- | ----------- | ------- | +| ProtocolError | | typeof [ProtocolError](./puppeteer.protocolerror.md) | | | +| TimeoutError | | typeof [TimeoutError](./puppeteer.timeouterror.md) | | | diff --git a/docs/api/puppeteer.puppeteererrors.protocolerror.md b/docs/api/puppeteer.puppeteererrors.protocolerror.md deleted file mode 100644 index a1a8df71db6a3..0000000000000 --- a/docs/api/puppeteer.puppeteererrors.protocolerror.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: PuppeteerErrors.ProtocolError ---- - -# PuppeteerErrors.ProtocolError property - -#### Signature: - -```typescript -interface PuppeteerErrors { - ProtocolError: typeof ProtocolError; -} -``` diff --git a/docs/api/puppeteer.puppeteererrors.timeouterror.md b/docs/api/puppeteer.puppeteererrors.timeouterror.md deleted file mode 100644 index 7eab4b36c34cd..0000000000000 --- a/docs/api/puppeteer.puppeteererrors.timeouterror.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: PuppeteerErrors.TimeoutError ---- - -# PuppeteerErrors.TimeoutError property - -#### Signature: - -```typescript -interface PuppeteerErrors { - TimeoutError: typeof TimeoutError; -} -``` diff --git a/docs/api/puppeteer.puppeteerlaunchoptions.extraprefsfirefox.md b/docs/api/puppeteer.puppeteerlaunchoptions.extraprefsfirefox.md deleted file mode 100644 index 80a25285dc363..0000000000000 --- a/docs/api/puppeteer.puppeteerlaunchoptions.extraprefsfirefox.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: PuppeteerLaunchOptions.extraPrefsFirefox ---- - -# PuppeteerLaunchOptions.extraPrefsFirefox property - -#### Signature: - -```typescript -interface PuppeteerLaunchOptions { - extraPrefsFirefox?: Record; -} -``` diff --git a/docs/api/puppeteer.puppeteerlaunchoptions.md b/docs/api/puppeteer.puppeteerlaunchoptions.md index 715106fe327d9..2ff6a5ceeb141 100644 --- a/docs/api/puppeteer.puppeteerlaunchoptions.md +++ b/docs/api/puppeteer.puppeteerlaunchoptions.md @@ -14,7 +14,7 @@ export interface PuppeteerLaunchOptions extends LaunchOptions, BrowserLaunchArgu ## Properties -| Property | Modifiers | Type | Description | Default | -| ----------------------------------------------------------------------------- | --------- | --------------------------------- | ------------ | ------- | -| [extraPrefsFirefox?](./puppeteer.puppeteerlaunchoptions.extraprefsfirefox.md) | | Record<string, unknown> | _(Optional)_ | | -| [product?](./puppeteer.puppeteerlaunchoptions.product.md) | | [Product](./puppeteer.product.md) | _(Optional)_ | | +| Property | Modifiers | Type | Description | Default | +| ----------------- | --------------------- | --------------------------------- | ----------- | ------- | +| extraPrefsFirefox | optional | Record<string, unknown> | | | +| product | optional | [Product](./puppeteer.product.md) | | | diff --git a/docs/api/puppeteer.puppeteerlaunchoptions.product.md b/docs/api/puppeteer.puppeteerlaunchoptions.product.md deleted file mode 100644 index 9fe77cd234fa5..0000000000000 --- a/docs/api/puppeteer.puppeteerlaunchoptions.product.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: PuppeteerLaunchOptions.product ---- - -# PuppeteerLaunchOptions.product property - -#### Signature: - -```typescript -interface PuppeteerLaunchOptions { - product?: Product; -} -``` diff --git a/docs/api/puppeteer.puppeteernode.createbrowserfetcher.md b/docs/api/puppeteer.puppeteernode.createbrowserfetcher.md deleted file mode 100644 index 2a42acda8e13e..0000000000000 --- a/docs/api/puppeteer.puppeteernode.createbrowserfetcher.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -sidebar_label: PuppeteerNode.createBrowserFetcher ---- - -# PuppeteerNode.createBrowserFetcher() method - -#### Signature: - -```typescript -class PuppeteerNode { - createBrowserFetcher( - options?: Partial - ): BrowserFetcher; -} -``` - -## Parameters - -| Parameter | Type | Description | -| --------- | ---------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | -| options | Partial<[BrowserFetcherOptions](./puppeteer.browserfetcheroptions.md)> | _(Optional)_ Set of configurable options to specify the settings of the BrowserFetcher. | - -**Returns:** - -[BrowserFetcher](./puppeteer.browserfetcher.md) - -A new BrowserFetcher instance. - -## Remarks - -If you are using `puppeteer-core`, do not use this method. Just construct [BrowserFetcher](./puppeteer.browserfetcher.md) manually. diff --git a/docs/api/puppeteer.puppeteernode.defaultproduct.md b/docs/api/puppeteer.puppeteernode.defaultproduct.md deleted file mode 100644 index c991fc0025c74..0000000000000 --- a/docs/api/puppeteer.puppeteernode.defaultproduct.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: PuppeteerNode.defaultProduct ---- - -# PuppeteerNode.defaultProduct property - -#### Signature: - -```typescript -class PuppeteerNode { - get defaultProduct(): Product; -} -``` diff --git a/docs/api/puppeteer.puppeteernode.executablepath.md b/docs/api/puppeteer.puppeteernode.executablepath.md index bea7a932b34a2..afa1291a601c3 100644 --- a/docs/api/puppeteer.puppeteernode.executablepath.md +++ b/docs/api/puppeteer.puppeteernode.executablepath.md @@ -4,6 +4,8 @@ sidebar_label: PuppeteerNode.executablePath # PuppeteerNode.executablePath() method +The default executable path. + #### Signature: ```typescript @@ -21,5 +23,3 @@ class PuppeteerNode { **Returns:** string - -The default executable path. diff --git a/docs/api/puppeteer.puppeteernode.lastlaunchedproduct.md b/docs/api/puppeteer.puppeteernode.lastlaunchedproduct.md deleted file mode 100644 index 61435a755e9f4..0000000000000 --- a/docs/api/puppeteer.puppeteernode.lastlaunchedproduct.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: PuppeteerNode.lastLaunchedProduct ---- - -# PuppeteerNode.lastLaunchedProduct property - -#### Signature: - -```typescript -class PuppeteerNode { - get lastLaunchedProduct(): Product; -} -``` diff --git a/docs/api/puppeteer.puppeteernode.launch.md b/docs/api/puppeteer.puppeteernode.launch.md index a2fe2adc983d7..4b1db660e55c5 100644 --- a/docs/api/puppeteer.puppeteernode.launch.md +++ b/docs/api/puppeteer.puppeteernode.launch.md @@ -6,7 +6,7 @@ sidebar_label: PuppeteerNode.launch Launches a browser instance with given arguments and options when specified. -When using with `puppeteer-core`, [options.executablePath](./puppeteer.launchoptions.executablepath.md) or [options.channel](./puppeteer.launchoptions.channel.md) must be provided. +When using with `puppeteer-core`, [options.executablePath](./puppeteer.launchoptions.md) or [options.channel](./puppeteer.launchoptions.md) must be provided. #### Signature: @@ -28,11 +28,11 @@ Promise<[Browser](./puppeteer.browser.md)> ## Remarks -Puppeteer can also be used to control the Chrome browser, but it works best with the version of Chromium downloaded by default by Puppeteer. There is no guarantee it will work with any other version. If Google Chrome (rather than Chromium) is preferred, a [Chrome Canary](https://www.google.com/chrome/browser/canary.html) or [Dev Channel](https://www.chromium.org/getting-involved/dev-channel) build is suggested. See [this article](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [This article](https://chromium.googlesource.com/chromium/src/+/lkgr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users. +Puppeteer can also be used to control the Chrome browser, but it works best with the version of Chrome for Testing downloaded by default. There is no guarantee it will work with any other version. If Google Chrome (rather than Chrome for Testing) is preferred, a [Chrome Canary](https://www.google.com/chrome/browser/canary.html) or [Dev Channel](https://www.chromium.org/getting-involved/dev-channel) build is suggested. See [this article](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [This article](https://chromium.googlesource.com/chromium/src/+/lkgr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users. See [this doc](https://goo.gle/chrome-for-testing) for the description of Chrome for Testing. ## Example -You can use [options.ignoreDefaultArgs](./puppeteer.launchoptions.ignoredefaultargs.md) to filter out `--mute-audio` from default arguments: +You can use [options.ignoreDefaultArgs](./puppeteer.launchoptions.md) to filter out `--mute-audio` from default arguments: ```ts const browser = await puppeteer.launch({ diff --git a/docs/api/puppeteer.puppeteernode.md b/docs/api/puppeteer.puppeteernode.md index e967a6956b3a9..9d16523acb244 100644 --- a/docs/api/puppeteer.puppeteernode.md +++ b/docs/api/puppeteer.puppeteernode.md @@ -44,18 +44,18 @@ Once you have created a `page` you have access to a large API to interact with t ## Properties -| Property | Modifiers | Type | Description | -| ----------------------------------------------------------------------- | --------------------- | --------------------------------- | ----------- | -| [defaultProduct](./puppeteer.puppeteernode.defaultproduct.md) | readonly | [Product](./puppeteer.product.md) | | -| [lastLaunchedProduct](./puppeteer.puppeteernode.lastlaunchedproduct.md) | readonly | [Product](./puppeteer.product.md) | | -| [product](./puppeteer.puppeteernode.product.md) | readonly | string | | +| Property | Modifiers | Type | Description | +| ------------------- | --------------------- | --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| defaultProduct | readonly | [Product](./puppeteer.product.md) | The name of the browser that will be launched by default. For puppeteer, this is influenced by your configuration. Otherwise, it's chrome. | +| lastLaunchedProduct | readonly | [Product](./puppeteer.product.md) | The name of the browser that was last launched. | +| product | readonly | string | | ## Methods -| Method | Modifiers | Description | -| ---------------------------------------------------------------------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [connect(options)](./puppeteer.puppeteernode.connect.md) | | This method attaches Puppeteer to an existing browser instance. | -| [createBrowserFetcher(options)](./puppeteer.puppeteernode.createbrowserfetcher.md) | | | -| [defaultArgs(options)](./puppeteer.puppeteernode.defaultargs.md) | | | -| [executablePath(channel)](./puppeteer.puppeteernode.executablepath.md) | | | -| [launch(options)](./puppeteer.puppeteernode.launch.md) | |

Launches a browser instance with given arguments and options when specified.

When using with puppeteer-core, [options.executablePath](./puppeteer.launchoptions.executablepath.md) or [options.channel](./puppeteer.launchoptions.channel.md) must be provided.

| +| Method | Modifiers | Description | +| ---------------------------------------------------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [connect(options)](./puppeteer.puppeteernode.connect.md) | | This method attaches Puppeteer to an existing browser instance. | +| [defaultArgs(options)](./puppeteer.puppeteernode.defaultargs.md) | | | +| [executablePath(channel)](./puppeteer.puppeteernode.executablepath.md) | | The default executable path. | +| [launch(options)](./puppeteer.puppeteernode.launch.md) | |

Launches a browser instance with given arguments and options when specified.

When using with puppeteer-core, [options.executablePath](./puppeteer.launchoptions.md) or [options.channel](./puppeteer.launchoptions.md) must be provided.

| +| [trimCache()](./puppeteer.puppeteernode.trimcache.md) | | Removes all non-current Firefox and Chrome binaries in the cache directory identified by the provided Puppeteer configuration. The current browser version is determined by resolving PUPPETEER_REVISIONS from Puppeteer unless configuration.browserRevision is provided. | diff --git a/docs/api/puppeteer.puppeteernode.product.md b/docs/api/puppeteer.puppeteernode.product.md deleted file mode 100644 index 8218f1b8684e5..0000000000000 --- a/docs/api/puppeteer.puppeteernode.product.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -sidebar_label: PuppeteerNode.product ---- - -# PuppeteerNode.product property - -> Warning: This API is now obsolete. -> -> Do not use as this field as it does not take into account multiple browsers of different types. Use [defaultProduct](./puppeteer.puppeteernode.defaultproduct.md) or [lastLaunchedProduct](./puppeteer.puppeteernode.lastlaunchedproduct.md). - -#### Signature: - -```typescript -class PuppeteerNode { - get product(): string; -} -``` diff --git a/docs/api/puppeteer.puppeteernode.trimcache.md b/docs/api/puppeteer.puppeteernode.trimcache.md new file mode 100644 index 0000000000000..273cf5f22d822 --- /dev/null +++ b/docs/api/puppeteer.puppeteernode.trimcache.md @@ -0,0 +1,23 @@ +--- +sidebar_label: PuppeteerNode.trimCache +--- + +# PuppeteerNode.trimCache() method + +Removes all non-current Firefox and Chrome binaries in the cache directory identified by the provided Puppeteer configuration. The current browser version is determined by resolving PUPPETEER_REVISIONS from Puppeteer unless `configuration.browserRevision` is provided. + +#### Signature: + +```typescript +class PuppeteerNode { + trimCache(): Promise; +} +``` + +**Returns:** + +Promise<void> + +## Remarks + +Note that the method does not check if any other Puppeteer versions installed on the host that use the same cache directory require the non-current binaries. diff --git a/docs/api/puppeteer.remoteaddress.ip.md b/docs/api/puppeteer.remoteaddress.ip.md deleted file mode 100644 index 15bd92e207f0d..0000000000000 --- a/docs/api/puppeteer.remoteaddress.ip.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: RemoteAddress.ip ---- - -# RemoteAddress.ip property - -#### Signature: - -```typescript -interface RemoteAddress { - ip?: string; -} -``` diff --git a/docs/api/puppeteer.remoteaddress.md b/docs/api/puppeteer.remoteaddress.md index 7c03968ef1467..e5cea3af5f566 100644 --- a/docs/api/puppeteer.remoteaddress.md +++ b/docs/api/puppeteer.remoteaddress.md @@ -12,7 +12,7 @@ export interface RemoteAddress ## Properties -| Property | Modifiers | Type | Description | Default | -| ------------------------------------------ | --------- | ------ | ------------ | ------- | -| [ip?](./puppeteer.remoteaddress.ip.md) | | string | _(Optional)_ | | -| [port?](./puppeteer.remoteaddress.port.md) | | number | _(Optional)_ | | +| Property | Modifiers | Type | Description | Default | +| -------- | --------------------- | ------ | ----------- | ------- | +| ip | optional | string | | | +| port | optional | number | | | diff --git a/docs/api/puppeteer.remoteaddress.port.md b/docs/api/puppeteer.remoteaddress.port.md deleted file mode 100644 index eebf2c2232831..0000000000000 --- a/docs/api/puppeteer.remoteaddress.port.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: RemoteAddress.port ---- - -# RemoteAddress.port property - -#### Signature: - -```typescript -interface RemoteAddress { - port?: number; -} -``` diff --git a/docs/api/puppeteer.responseforrequest.body.md b/docs/api/puppeteer.responseforrequest.body.md deleted file mode 100644 index 6b04953e870cf..0000000000000 --- a/docs/api/puppeteer.responseforrequest.body.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: ResponseForRequest.body ---- - -# ResponseForRequest.body property - -#### Signature: - -```typescript -interface ResponseForRequest { - body: string | Buffer; -} -``` diff --git a/docs/api/puppeteer.responseforrequest.contenttype.md b/docs/api/puppeteer.responseforrequest.contenttype.md deleted file mode 100644 index 3caf62ca726a9..0000000000000 --- a/docs/api/puppeteer.responseforrequest.contenttype.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: ResponseForRequest.contentType ---- - -# ResponseForRequest.contentType property - -#### Signature: - -```typescript -interface ResponseForRequest { - contentType: string; -} -``` diff --git a/docs/api/puppeteer.responseforrequest.headers.md b/docs/api/puppeteer.responseforrequest.headers.md deleted file mode 100644 index c5e23442c0cfd..0000000000000 --- a/docs/api/puppeteer.responseforrequest.headers.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: ResponseForRequest.headers ---- - -# ResponseForRequest.headers property - -Optional response headers. All values are converted to strings. - -#### Signature: - -```typescript -interface ResponseForRequest { - headers: Record; -} -``` diff --git a/docs/api/puppeteer.responseforrequest.md b/docs/api/puppeteer.responseforrequest.md index d04cf833c0f45..a66d2c28dbf58 100644 --- a/docs/api/puppeteer.responseforrequest.md +++ b/docs/api/puppeteer.responseforrequest.md @@ -14,9 +14,9 @@ export interface ResponseForRequest ## Properties -| Property | Modifiers | Type | Description | Default | -| ------------------------------------------------------------ | --------- | ----------------------------- | --------------------------------------------------------------- | ------- | -| [body](./puppeteer.responseforrequest.body.md) | | string \| Buffer | | | -| [contentType](./puppeteer.responseforrequest.contenttype.md) | | string | | | -| [headers](./puppeteer.responseforrequest.headers.md) | | Record<string, unknown> | Optional response headers. All values are converted to strings. | | -| [status](./puppeteer.responseforrequest.status.md) | | number | | | +| Property | Modifiers | Type | Description | Default | +| ----------- | --------- | ----------------------------- | --------------------------------------------------------------- | ------- | +| body | | string \| Buffer | | | +| contentType | | string | | | +| headers | | Record<string, unknown> | Optional response headers. All values are converted to strings. | | +| status | | number | | | diff --git a/docs/api/puppeteer.responseforrequest.status.md b/docs/api/puppeteer.responseforrequest.status.md deleted file mode 100644 index ec1648d7c805f..0000000000000 --- a/docs/api/puppeteer.responseforrequest.status.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: ResponseForRequest.status ---- - -# ResponseForRequest.status property - -#### Signature: - -```typescript -interface ResponseForRequest { - status: number; -} -``` diff --git a/docs/api/puppeteer.screenshotclip.height.md b/docs/api/puppeteer.screenshotclip.height.md deleted file mode 100644 index b79a1eed7cdf6..0000000000000 --- a/docs/api/puppeteer.screenshotclip.height.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: ScreenshotClip.height ---- - -# ScreenshotClip.height property - -#### Signature: - -```typescript -interface ScreenshotClip { - height: number; -} -``` diff --git a/docs/api/puppeteer.screenshotclip.md b/docs/api/puppeteer.screenshotclip.md index 960a010085fd1..5ab8be38642f5 100644 --- a/docs/api/puppeteer.screenshotclip.md +++ b/docs/api/puppeteer.screenshotclip.md @@ -12,10 +12,10 @@ export interface ScreenshotClip ## Properties -| Property | Modifiers | Type | Description | Default | -| ---------------------------------------------- | --------- | ------ | ------------ | ------- | -| [height](./puppeteer.screenshotclip.height.md) | | number | | | -| [scale?](./puppeteer.screenshotclip.scale.md) | | number | _(Optional)_ | 1 | -| [width](./puppeteer.screenshotclip.width.md) | | number | | | -| [x](./puppeteer.screenshotclip.x.md) | | number | | | -| [y](./puppeteer.screenshotclip.y.md) | | number | | | +| Property | Modifiers | Type | Description | Default | +| -------- | --------------------- | ------ | ----------- | -------------- | +| height | | number | | | +| scale | optional | number | | 1 | +| width | | number | | | +| x | | number | | | +| y | | number | | | diff --git a/docs/api/puppeteer.screenshotclip.scale.md b/docs/api/puppeteer.screenshotclip.scale.md deleted file mode 100644 index 18d22006a698b..0000000000000 --- a/docs/api/puppeteer.screenshotclip.scale.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -sidebar_label: ScreenshotClip.scale ---- - -# ScreenshotClip.scale property - -#### Signature: - -```typescript -interface ScreenshotClip { - scale?: number; -} -``` - -#### Default value: - -1 diff --git a/docs/api/puppeteer.screenshotclip.width.md b/docs/api/puppeteer.screenshotclip.width.md deleted file mode 100644 index 4673bb833a328..0000000000000 --- a/docs/api/puppeteer.screenshotclip.width.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: ScreenshotClip.width ---- - -# ScreenshotClip.width property - -#### Signature: - -```typescript -interface ScreenshotClip { - width: number; -} -``` diff --git a/docs/api/puppeteer.screenshotclip.x.md b/docs/api/puppeteer.screenshotclip.x.md deleted file mode 100644 index 877ddc6215d71..0000000000000 --- a/docs/api/puppeteer.screenshotclip.x.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: ScreenshotClip.x ---- - -# ScreenshotClip.x property - -#### Signature: - -```typescript -interface ScreenshotClip { - x: number; -} -``` diff --git a/docs/api/puppeteer.screenshotclip.y.md b/docs/api/puppeteer.screenshotclip.y.md deleted file mode 100644 index fcdb9be15f943..0000000000000 --- a/docs/api/puppeteer.screenshotclip.y.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: ScreenshotClip.y ---- - -# ScreenshotClip.y property - -#### Signature: - -```typescript -interface ScreenshotClip { - y: number; -} -``` diff --git a/docs/api/puppeteer.screenshotoptions.capturebeyondviewport.md b/docs/api/puppeteer.screenshotoptions.capturebeyondviewport.md deleted file mode 100644 index a58843fa4ad7a..0000000000000 --- a/docs/api/puppeteer.screenshotoptions.capturebeyondviewport.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: ScreenshotOptions.captureBeyondViewport ---- - -# ScreenshotOptions.captureBeyondViewport property - -Capture the screenshot beyond the viewport. - -#### Signature: - -```typescript -interface ScreenshotOptions { - captureBeyondViewport?: boolean; -} -``` - -#### Default value: - -`true` diff --git a/docs/api/puppeteer.screenshotoptions.clip.md b/docs/api/puppeteer.screenshotoptions.clip.md deleted file mode 100644 index 9fe45d500413e..0000000000000 --- a/docs/api/puppeteer.screenshotoptions.clip.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: ScreenshotOptions.clip ---- - -# ScreenshotOptions.clip property - -An object which specifies the clipping region of the page. - -#### Signature: - -```typescript -interface ScreenshotOptions { - clip?: ScreenshotClip; -} -``` diff --git a/docs/api/puppeteer.screenshotoptions.encoding.md b/docs/api/puppeteer.screenshotoptions.encoding.md deleted file mode 100644 index 0d2b5ebd7ebeb..0000000000000 --- a/docs/api/puppeteer.screenshotoptions.encoding.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: ScreenshotOptions.encoding ---- - -# ScreenshotOptions.encoding property - -Encoding of the image. - -#### Signature: - -```typescript -interface ScreenshotOptions { - encoding?: 'base64' | 'binary'; -} -``` - -#### Default value: - -`binary` diff --git a/docs/api/puppeteer.screenshotoptions.fromsurface.md b/docs/api/puppeteer.screenshotoptions.fromsurface.md deleted file mode 100644 index 9cb1de8c22b7c..0000000000000 --- a/docs/api/puppeteer.screenshotoptions.fromsurface.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: ScreenshotOptions.fromSurface ---- - -# ScreenshotOptions.fromSurface property - -Capture the screenshot from the surface, rather than the view. - -#### Signature: - -```typescript -interface ScreenshotOptions { - fromSurface?: boolean; -} -``` - -#### Default value: - -`true` diff --git a/docs/api/puppeteer.screenshotoptions.fullpage.md b/docs/api/puppeteer.screenshotoptions.fullpage.md deleted file mode 100644 index 6e9646c5b1540..0000000000000 --- a/docs/api/puppeteer.screenshotoptions.fullpage.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: ScreenshotOptions.fullPage ---- - -# ScreenshotOptions.fullPage property - -When `true`, takes a screenshot of the full page. - -#### Signature: - -```typescript -interface ScreenshotOptions { - fullPage?: boolean; -} -``` - -#### Default value: - -`false` diff --git a/docs/api/puppeteer.screenshotoptions.md b/docs/api/puppeteer.screenshotoptions.md index d894fd22d8e0a..47470e8499d01 100644 --- a/docs/api/puppeteer.screenshotoptions.md +++ b/docs/api/puppeteer.screenshotoptions.md @@ -12,14 +12,15 @@ export interface ScreenshotOptions ## Properties -| Property | Modifiers | Type | Description | Default | -| -------------------------------------------------------------------------------- | --------- | ----------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------- | -| [captureBeyondViewport?](./puppeteer.screenshotoptions.capturebeyondviewport.md) | | boolean | _(Optional)_ Capture the screenshot beyond the viewport. | true | -| [clip?](./puppeteer.screenshotoptions.clip.md) | | [ScreenshotClip](./puppeteer.screenshotclip.md) | _(Optional)_ An object which specifies the clipping region of the page. | | -| [encoding?](./puppeteer.screenshotoptions.encoding.md) | | 'base64' \| 'binary' | _(Optional)_ Encoding of the image. | binary | -| [fromSurface?](./puppeteer.screenshotoptions.fromsurface.md) | | boolean | _(Optional)_ Capture the screenshot from the surface, rather than the view. | true | -| [fullPage?](./puppeteer.screenshotoptions.fullpage.md) | | boolean | _(Optional)_ When true, takes a screenshot of the full page. | false | -| [omitBackground?](./puppeteer.screenshotoptions.omitbackground.md) | | boolean | _(Optional)_ Hides default white background and allows capturing screenshots with transparency. | false | -| [path?](./puppeteer.screenshotoptions.path.md) | | string | _(Optional)_ The file path to save the image to. The screenshot type will be inferred from file extension. If path is a relative path, then it is resolved relative to current working directory. If no path is provided, the image won't be saved to the disk. | | -| [quality?](./puppeteer.screenshotoptions.quality.md) | | number | _(Optional)_ Quality of the image, between 0-100. Not applicable to png images. | | -| [type?](./puppeteer.screenshotoptions.type.md) | | 'png' \| 'jpeg' \| 'webp' | _(Optional)_ | png | +| Property | Modifiers | Type | Description | Default | +| --------------------- | --------------------- | ----------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------- | +| captureBeyondViewport | optional | boolean | Capture the screenshot beyond the viewport. | true | +| clip | optional | [ScreenshotClip](./puppeteer.screenshotclip.md) | An object which specifies the clipping region of the page. | | +| encoding | optional | 'base64' \| 'binary' | Encoding of the image. | binary | +| fromSurface | optional | boolean | Capture the screenshot from the surface, rather than the view. | true | +| fullPage | optional | boolean | When true, takes a screenshot of the full page. | false | +| omitBackground | optional | boolean | Hides default white background and allows capturing screenshots with transparency. | false | +| optimizeForSpeed | optional | boolean | | false | +| path | optional | string | The file path to save the image to. The screenshot type will be inferred from file extension. If path is a relative path, then it is resolved relative to current working directory. If no path is provided, the image won't be saved to the disk. | | +| quality | optional | number | Quality of the image, between 0-100. Not applicable to png images. | | +| type | optional | 'png' \| 'jpeg' \| 'webp' | | png | diff --git a/docs/api/puppeteer.screenshotoptions.omitbackground.md b/docs/api/puppeteer.screenshotoptions.omitbackground.md deleted file mode 100644 index 8fe21aa5267c1..0000000000000 --- a/docs/api/puppeteer.screenshotoptions.omitbackground.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: ScreenshotOptions.omitBackground ---- - -# ScreenshotOptions.omitBackground property - -Hides default white background and allows capturing screenshots with transparency. - -#### Signature: - -```typescript -interface ScreenshotOptions { - omitBackground?: boolean; -} -``` - -#### Default value: - -`false` diff --git a/docs/api/puppeteer.screenshotoptions.path.md b/docs/api/puppeteer.screenshotoptions.path.md deleted file mode 100644 index 9df8a27bf5d8b..0000000000000 --- a/docs/api/puppeteer.screenshotoptions.path.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: ScreenshotOptions.path ---- - -# ScreenshotOptions.path property - -The file path to save the image to. The screenshot type will be inferred from file extension. If path is a relative path, then it is resolved relative to current working directory. If no path is provided, the image won't be saved to the disk. - -#### Signature: - -```typescript -interface ScreenshotOptions { - path?: string; -} -``` diff --git a/docs/api/puppeteer.screenshotoptions.quality.md b/docs/api/puppeteer.screenshotoptions.quality.md deleted file mode 100644 index c6a4d7c5875b0..0000000000000 --- a/docs/api/puppeteer.screenshotoptions.quality.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: ScreenshotOptions.quality ---- - -# ScreenshotOptions.quality property - -Quality of the image, between 0-100. Not applicable to `png` images. - -#### Signature: - -```typescript -interface ScreenshotOptions { - quality?: number; -} -``` diff --git a/docs/api/puppeteer.screenshotoptions.type.md b/docs/api/puppeteer.screenshotoptions.type.md deleted file mode 100644 index da52eaa895c52..0000000000000 --- a/docs/api/puppeteer.screenshotoptions.type.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -sidebar_label: ScreenshotOptions.type ---- - -# ScreenshotOptions.type property - -#### Signature: - -```typescript -interface ScreenshotOptions { - type?: 'png' | 'jpeg' | 'webp'; -} -``` - -#### Default value: - -`png` diff --git a/docs/api/puppeteer.securitydetails.issuer.md b/docs/api/puppeteer.securitydetails.issuer.md index a7bb3fded73c9..b82835a844fe6 100644 --- a/docs/api/puppeteer.securitydetails.issuer.md +++ b/docs/api/puppeteer.securitydetails.issuer.md @@ -4,6 +4,8 @@ sidebar_label: SecurityDetails.issuer # SecurityDetails.issuer() method +The name of the issuer of the certificate. + #### Signature: ```typescript @@ -15,5 +17,3 @@ class SecurityDetails { **Returns:** string - -The name of the issuer of the certificate. diff --git a/docs/api/puppeteer.securitydetails.md b/docs/api/puppeteer.securitydetails.md index db50be39adb95..1c9fa17deb284 100644 --- a/docs/api/puppeteer.securitydetails.md +++ b/docs/api/puppeteer.securitydetails.md @@ -18,11 +18,11 @@ The constructor for this class is marked as internal. Third-party code should no ## Methods -| Method | Modifiers | Description | -| ----------------------------------------------------------------------------------- | --------- | ----------- | -| [issuer()](./puppeteer.securitydetails.issuer.md) | | | -| [protocol()](./puppeteer.securitydetails.protocol.md) | | | -| [subjectAlternativeNames()](./puppeteer.securitydetails.subjectalternativenames.md) | | | -| [subjectName()](./puppeteer.securitydetails.subjectname.md) | | | -| [validFrom()](./puppeteer.securitydetails.validfrom.md) | | | -| [validTo()](./puppeteer.securitydetails.validto.md) | | | +| Method | Modifiers | Description | +| ----------------------------------------------------------------------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------- | +| [issuer()](./puppeteer.securitydetails.issuer.md) | | The name of the issuer of the certificate. | +| [protocol()](./puppeteer.securitydetails.protocol.md) | | The security protocol being used, e.g. "TLS 1.2". | +| [subjectAlternativeNames()](./puppeteer.securitydetails.subjectalternativenames.md) | | The list of [subject alternative names (SANs)](https://en.wikipedia.org/wiki/Subject_Alternative_Name) of the certificate. | +| [subjectName()](./puppeteer.securitydetails.subjectname.md) | | The name of the subject to which the certificate was issued. | +| [validFrom()](./puppeteer.securitydetails.validfrom.md) | | [Unix timestamp](https://en.wikipedia.org/wiki/Unix_time) marking the start of the certificate's validity. | +| [validTo()](./puppeteer.securitydetails.validto.md) | | [Unix timestamp](https://en.wikipedia.org/wiki/Unix_time) marking the end of the certificate's validity. | diff --git a/docs/api/puppeteer.securitydetails.protocol.md b/docs/api/puppeteer.securitydetails.protocol.md index d6a7b735e295d..421a82e20a4e7 100644 --- a/docs/api/puppeteer.securitydetails.protocol.md +++ b/docs/api/puppeteer.securitydetails.protocol.md @@ -4,6 +4,8 @@ sidebar_label: SecurityDetails.protocol # SecurityDetails.protocol() method +The security protocol being used, e.g. "TLS 1.2". + #### Signature: ```typescript @@ -15,5 +17,3 @@ class SecurityDetails { **Returns:** string - -The security protocol being used, e.g. "TLS 1.2". diff --git a/docs/api/puppeteer.securitydetails.subjectalternativenames.md b/docs/api/puppeteer.securitydetails.subjectalternativenames.md index 926991082c0a1..448651fd58103 100644 --- a/docs/api/puppeteer.securitydetails.subjectalternativenames.md +++ b/docs/api/puppeteer.securitydetails.subjectalternativenames.md @@ -4,6 +4,8 @@ sidebar_label: SecurityDetails.subjectAlternativeNames # SecurityDetails.subjectAlternativeNames() method +The list of [subject alternative names (SANs)](https://en.wikipedia.org/wiki/Subject_Alternative_Name) of the certificate. + #### Signature: ```typescript @@ -15,5 +17,3 @@ class SecurityDetails { **Returns:** string\[\] - -The list of [subject alternative names (SANs)](https://en.wikipedia.org/wiki/Subject_Alternative_Name) of the certificate. diff --git a/docs/api/puppeteer.securitydetails.subjectname.md b/docs/api/puppeteer.securitydetails.subjectname.md index 0727f2dbb08ca..211c67bc02965 100644 --- a/docs/api/puppeteer.securitydetails.subjectname.md +++ b/docs/api/puppeteer.securitydetails.subjectname.md @@ -4,6 +4,8 @@ sidebar_label: SecurityDetails.subjectName # SecurityDetails.subjectName() method +The name of the subject to which the certificate was issued. + #### Signature: ```typescript @@ -15,5 +17,3 @@ class SecurityDetails { **Returns:** string - -The name of the subject to which the certificate was issued. diff --git a/docs/api/puppeteer.securitydetails.validfrom.md b/docs/api/puppeteer.securitydetails.validfrom.md index 7bd6d81ad7baa..e42cb0c007289 100644 --- a/docs/api/puppeteer.securitydetails.validfrom.md +++ b/docs/api/puppeteer.securitydetails.validfrom.md @@ -4,6 +4,8 @@ sidebar_label: SecurityDetails.validFrom # SecurityDetails.validFrom() method +[Unix timestamp](https://en.wikipedia.org/wiki/Unix_time) marking the start of the certificate's validity. + #### Signature: ```typescript @@ -15,5 +17,3 @@ class SecurityDetails { **Returns:** number - -[Unix timestamp](https://en.wikipedia.org/wiki/Unix_time) marking the start of the certificate's validity. diff --git a/docs/api/puppeteer.securitydetails.validto.md b/docs/api/puppeteer.securitydetails.validto.md index 85629da76a775..e1710b1a64dda 100644 --- a/docs/api/puppeteer.securitydetails.validto.md +++ b/docs/api/puppeteer.securitydetails.validto.md @@ -4,6 +4,8 @@ sidebar_label: SecurityDetails.validTo # SecurityDetails.validTo() method +[Unix timestamp](https://en.wikipedia.org/wiki/Unix_time) marking the end of the certificate's validity. + #### Signature: ```typescript @@ -15,5 +17,3 @@ class SecurityDetails { **Returns:** number - -[Unix timestamp](https://en.wikipedia.org/wiki/Unix_time) marking the end of the certificate's validity. diff --git a/docs/api/puppeteer.serializedaxnode.autocomplete.md b/docs/api/puppeteer.serializedaxnode.autocomplete.md deleted file mode 100644 index 7cc56fabb5cb0..0000000000000 --- a/docs/api/puppeteer.serializedaxnode.autocomplete.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: SerializedAXNode.autocomplete ---- - -# SerializedAXNode.autocomplete property - -#### Signature: - -```typescript -interface SerializedAXNode { - autocomplete?: string; -} -``` diff --git a/docs/api/puppeteer.serializedaxnode.checked.md b/docs/api/puppeteer.serializedaxnode.checked.md deleted file mode 100644 index dd6f243ca9bb1..0000000000000 --- a/docs/api/puppeteer.serializedaxnode.checked.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: SerializedAXNode.checked ---- - -# SerializedAXNode.checked property - -Whether the checkbox is checked, or in a [mixed state](https://www.w3.org/TR/wai-aria-practices/examples/checkbox/checkbox-2/checkbox-2.html). - -#### Signature: - -```typescript -interface SerializedAXNode { - checked?: boolean | 'mixed'; -} -``` diff --git a/docs/api/puppeteer.serializedaxnode.children.md b/docs/api/puppeteer.serializedaxnode.children.md deleted file mode 100644 index 40c4076397c2a..0000000000000 --- a/docs/api/puppeteer.serializedaxnode.children.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: SerializedAXNode.children ---- - -# SerializedAXNode.children property - -Children of this node, if there are any. - -#### Signature: - -```typescript -interface SerializedAXNode { - children?: SerializedAXNode[]; -} -``` diff --git a/docs/api/puppeteer.serializedaxnode.description.md b/docs/api/puppeteer.serializedaxnode.description.md deleted file mode 100644 index 6cb5ba48a4c14..0000000000000 --- a/docs/api/puppeteer.serializedaxnode.description.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: SerializedAXNode.description ---- - -# SerializedAXNode.description property - -An additional human readable description of the node. - -#### Signature: - -```typescript -interface SerializedAXNode { - description?: string; -} -``` diff --git a/docs/api/puppeteer.serializedaxnode.disabled.md b/docs/api/puppeteer.serializedaxnode.disabled.md deleted file mode 100644 index ed39f74d68769..0000000000000 --- a/docs/api/puppeteer.serializedaxnode.disabled.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: SerializedAXNode.disabled ---- - -# SerializedAXNode.disabled property - -#### Signature: - -```typescript -interface SerializedAXNode { - disabled?: boolean; -} -``` diff --git a/docs/api/puppeteer.serializedaxnode.expanded.md b/docs/api/puppeteer.serializedaxnode.expanded.md deleted file mode 100644 index 64db5849266a0..0000000000000 --- a/docs/api/puppeteer.serializedaxnode.expanded.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: SerializedAXNode.expanded ---- - -# SerializedAXNode.expanded property - -#### Signature: - -```typescript -interface SerializedAXNode { - expanded?: boolean; -} -``` diff --git a/docs/api/puppeteer.serializedaxnode.focused.md b/docs/api/puppeteer.serializedaxnode.focused.md deleted file mode 100644 index 955e9b2646fd8..0000000000000 --- a/docs/api/puppeteer.serializedaxnode.focused.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: SerializedAXNode.focused ---- - -# SerializedAXNode.focused property - -#### Signature: - -```typescript -interface SerializedAXNode { - focused?: boolean; -} -``` diff --git a/docs/api/puppeteer.serializedaxnode.haspopup.md b/docs/api/puppeteer.serializedaxnode.haspopup.md deleted file mode 100644 index 7685397d9bf7d..0000000000000 --- a/docs/api/puppeteer.serializedaxnode.haspopup.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: SerializedAXNode.haspopup ---- - -# SerializedAXNode.haspopup property - -#### Signature: - -```typescript -interface SerializedAXNode { - haspopup?: string; -} -``` diff --git a/docs/api/puppeteer.serializedaxnode.invalid.md b/docs/api/puppeteer.serializedaxnode.invalid.md deleted file mode 100644 index 8add34410acc0..0000000000000 --- a/docs/api/puppeteer.serializedaxnode.invalid.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: SerializedAXNode.invalid ---- - -# SerializedAXNode.invalid property - -Whether and in what way this node's value is invalid. - -#### Signature: - -```typescript -interface SerializedAXNode { - invalid?: string; -} -``` diff --git a/docs/api/puppeteer.serializedaxnode.keyshortcuts.md b/docs/api/puppeteer.serializedaxnode.keyshortcuts.md deleted file mode 100644 index ef318c947cd31..0000000000000 --- a/docs/api/puppeteer.serializedaxnode.keyshortcuts.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: SerializedAXNode.keyshortcuts ---- - -# SerializedAXNode.keyshortcuts property - -Any keyboard shortcuts associated with this node. - -#### Signature: - -```typescript -interface SerializedAXNode { - keyshortcuts?: string; -} -``` diff --git a/docs/api/puppeteer.serializedaxnode.level.md b/docs/api/puppeteer.serializedaxnode.level.md deleted file mode 100644 index b29d56fa9f359..0000000000000 --- a/docs/api/puppeteer.serializedaxnode.level.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: SerializedAXNode.level ---- - -# SerializedAXNode.level property - -The level of a heading. - -#### Signature: - -```typescript -interface SerializedAXNode { - level?: number; -} -``` diff --git a/docs/api/puppeteer.serializedaxnode.md b/docs/api/puppeteer.serializedaxnode.md index 22e71d4b68ec9..c7518c4a48ac2 100644 --- a/docs/api/puppeteer.serializedaxnode.md +++ b/docs/api/puppeteer.serializedaxnode.md @@ -14,31 +14,31 @@ export interface SerializedAXNode ## Properties -| Property | Modifiers | Type | Description | Default | -| ------------------------------------------------------------------- | --------- | ------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | -| [autocomplete?](./puppeteer.serializedaxnode.autocomplete.md) | | string | _(Optional)_ | | -| [checked?](./puppeteer.serializedaxnode.checked.md) | | boolean \| 'mixed' | _(Optional)_ Whether the checkbox is checked, or in a [mixed state](https://www.w3.org/TR/wai-aria-practices/examples/checkbox/checkbox-2/checkbox-2.html). | | -| [children?](./puppeteer.serializedaxnode.children.md) | | [SerializedAXNode](./puppeteer.serializedaxnode.md)\[\] | _(Optional)_ Children of this node, if there are any. | | -| [description?](./puppeteer.serializedaxnode.description.md) | | string | _(Optional)_ An additional human readable description of the node. | | -| [disabled?](./puppeteer.serializedaxnode.disabled.md) | | boolean | _(Optional)_ | | -| [expanded?](./puppeteer.serializedaxnode.expanded.md) | | boolean | _(Optional)_ | | -| [focused?](./puppeteer.serializedaxnode.focused.md) | | boolean | _(Optional)_ | | -| [haspopup?](./puppeteer.serializedaxnode.haspopup.md) | | string | _(Optional)_ | | -| [invalid?](./puppeteer.serializedaxnode.invalid.md) | | string | _(Optional)_ Whether and in what way this node's value is invalid. | | -| [keyshortcuts?](./puppeteer.serializedaxnode.keyshortcuts.md) | | string | _(Optional)_ Any keyboard shortcuts associated with this node. | | -| [level?](./puppeteer.serializedaxnode.level.md) | | number | _(Optional)_ The level of a heading. | | -| [modal?](./puppeteer.serializedaxnode.modal.md) | | boolean | _(Optional)_ | | -| [multiline?](./puppeteer.serializedaxnode.multiline.md) | | boolean | _(Optional)_ | | -| [multiselectable?](./puppeteer.serializedaxnode.multiselectable.md) | | boolean | _(Optional)_ Whether more than one child can be selected. | | -| [name?](./puppeteer.serializedaxnode.name.md) | | string | _(Optional)_ A human readable name for the node. | | -| [orientation?](./puppeteer.serializedaxnode.orientation.md) | | string | _(Optional)_ | | -| [pressed?](./puppeteer.serializedaxnode.pressed.md) | | boolean \| 'mixed' | _(Optional)_ Whether the node is checked or in a mixed state. | | -| [readonly?](./puppeteer.serializedaxnode.readonly.md) | | boolean | _(Optional)_ | | -| [required?](./puppeteer.serializedaxnode.required.md) | | boolean | _(Optional)_ | | -| [role](./puppeteer.serializedaxnode.role.md) | | string | The [role](https://www.w3.org/TR/wai-aria/#usage_intro) of the node. | | -| [roledescription?](./puppeteer.serializedaxnode.roledescription.md) | | string | _(Optional)_ A human readable alternative to the role. | | -| [selected?](./puppeteer.serializedaxnode.selected.md) | | boolean | _(Optional)_ | | -| [value?](./puppeteer.serializedaxnode.value.md) | | string \| number | _(Optional)_ The current value of the node. | | -| [valuemax?](./puppeteer.serializedaxnode.valuemax.md) | | number | _(Optional)_ | | -| [valuemin?](./puppeteer.serializedaxnode.valuemin.md) | | number | _(Optional)_ | | -| [valuetext?](./puppeteer.serializedaxnode.valuetext.md) | | string | _(Optional)_ A description of the current value. | | +| Property | Modifiers | Type | Description | Default | +| --------------- | --------------------- | ------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | ------- | +| autocomplete | optional | string | | | +| checked | optional | boolean \| 'mixed' | Whether the checkbox is checked, or in a [mixed state](https://www.w3.org/TR/wai-aria-practices/examples/checkbox/checkbox-2/checkbox-2.html). | | +| children | optional | [SerializedAXNode](./puppeteer.serializedaxnode.md)\[\] | Children of this node, if there are any. | | +| description | optional | string | An additional human readable description of the node. | | +| disabled | optional | boolean | | | +| expanded | optional | boolean | | | +| focused | optional | boolean | | | +| haspopup | optional | string | | | +| invalid | optional | string | Whether and in what way this node's value is invalid. | | +| keyshortcuts | optional | string | Any keyboard shortcuts associated with this node. | | +| level | optional | number | The level of a heading. | | +| modal | optional | boolean | | | +| multiline | optional | boolean | | | +| multiselectable | optional | boolean | Whether more than one child can be selected. | | +| name | optional | string | A human readable name for the node. | | +| orientation | optional | string | | | +| pressed | optional | boolean \| 'mixed' | Whether the node is checked or in a mixed state. | | +| readonly | optional | boolean | | | +| required | optional | boolean | | | +| role | | string | The [role](https://www.w3.org/TR/wai-aria/#usage_intro) of the node. | | +| roledescription | optional | string | A human readable alternative to the role. | | +| selected | optional | boolean | | | +| value | optional | string \| number | The current value of the node. | | +| valuemax | optional | number | | | +| valuemin | optional | number | | | +| valuetext | optional | string | A description of the current value. | | diff --git a/docs/api/puppeteer.serializedaxnode.modal.md b/docs/api/puppeteer.serializedaxnode.modal.md deleted file mode 100644 index 683d6f3e3eb27..0000000000000 --- a/docs/api/puppeteer.serializedaxnode.modal.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: SerializedAXNode.modal ---- - -# SerializedAXNode.modal property - -#### Signature: - -```typescript -interface SerializedAXNode { - modal?: boolean; -} -``` diff --git a/docs/api/puppeteer.serializedaxnode.multiline.md b/docs/api/puppeteer.serializedaxnode.multiline.md deleted file mode 100644 index 1bc9a8ef912a4..0000000000000 --- a/docs/api/puppeteer.serializedaxnode.multiline.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: SerializedAXNode.multiline ---- - -# SerializedAXNode.multiline property - -#### Signature: - -```typescript -interface SerializedAXNode { - multiline?: boolean; -} -``` diff --git a/docs/api/puppeteer.serializedaxnode.multiselectable.md b/docs/api/puppeteer.serializedaxnode.multiselectable.md deleted file mode 100644 index dd7982bec27a7..0000000000000 --- a/docs/api/puppeteer.serializedaxnode.multiselectable.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: SerializedAXNode.multiselectable ---- - -# SerializedAXNode.multiselectable property - -Whether more than one child can be selected. - -#### Signature: - -```typescript -interface SerializedAXNode { - multiselectable?: boolean; -} -``` diff --git a/docs/api/puppeteer.serializedaxnode.name.md b/docs/api/puppeteer.serializedaxnode.name.md deleted file mode 100644 index 659bc6ec7bc68..0000000000000 --- a/docs/api/puppeteer.serializedaxnode.name.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: SerializedAXNode.name ---- - -# SerializedAXNode.name property - -A human readable name for the node. - -#### Signature: - -```typescript -interface SerializedAXNode { - name?: string; -} -``` diff --git a/docs/api/puppeteer.serializedaxnode.orientation.md b/docs/api/puppeteer.serializedaxnode.orientation.md deleted file mode 100644 index 000514e3c0b9e..0000000000000 --- a/docs/api/puppeteer.serializedaxnode.orientation.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: SerializedAXNode.orientation ---- - -# SerializedAXNode.orientation property - -#### Signature: - -```typescript -interface SerializedAXNode { - orientation?: string; -} -``` diff --git a/docs/api/puppeteer.serializedaxnode.pressed.md b/docs/api/puppeteer.serializedaxnode.pressed.md deleted file mode 100644 index f02030cfbc157..0000000000000 --- a/docs/api/puppeteer.serializedaxnode.pressed.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: SerializedAXNode.pressed ---- - -# SerializedAXNode.pressed property - -Whether the node is checked or in a mixed state. - -#### Signature: - -```typescript -interface SerializedAXNode { - pressed?: boolean | 'mixed'; -} -``` diff --git a/docs/api/puppeteer.serializedaxnode.readonly.md b/docs/api/puppeteer.serializedaxnode.readonly.md deleted file mode 100644 index 88568124ba85b..0000000000000 --- a/docs/api/puppeteer.serializedaxnode.readonly.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: SerializedAXNode.readonly ---- - -# SerializedAXNode.readonly property - -#### Signature: - -```typescript -interface SerializedAXNode { - readonly?: boolean; -} -``` diff --git a/docs/api/puppeteer.serializedaxnode.required.md b/docs/api/puppeteer.serializedaxnode.required.md deleted file mode 100644 index 1a022c55f9f17..0000000000000 --- a/docs/api/puppeteer.serializedaxnode.required.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: SerializedAXNode.required ---- - -# SerializedAXNode.required property - -#### Signature: - -```typescript -interface SerializedAXNode { - required?: boolean; -} -``` diff --git a/docs/api/puppeteer.serializedaxnode.role.md b/docs/api/puppeteer.serializedaxnode.role.md deleted file mode 100644 index b9ffe0c1c5318..0000000000000 --- a/docs/api/puppeteer.serializedaxnode.role.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: SerializedAXNode.role ---- - -# SerializedAXNode.role property - -The [role](https://www.w3.org/TR/wai-aria/#usage_intro) of the node. - -#### Signature: - -```typescript -interface SerializedAXNode { - role: string; -} -``` diff --git a/docs/api/puppeteer.serializedaxnode.roledescription.md b/docs/api/puppeteer.serializedaxnode.roledescription.md deleted file mode 100644 index 3158eb49f6d44..0000000000000 --- a/docs/api/puppeteer.serializedaxnode.roledescription.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: SerializedAXNode.roledescription ---- - -# SerializedAXNode.roledescription property - -A human readable alternative to the role. - -#### Signature: - -```typescript -interface SerializedAXNode { - roledescription?: string; -} -``` diff --git a/docs/api/puppeteer.serializedaxnode.selected.md b/docs/api/puppeteer.serializedaxnode.selected.md deleted file mode 100644 index 24dd72b0cf2e6..0000000000000 --- a/docs/api/puppeteer.serializedaxnode.selected.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: SerializedAXNode.selected ---- - -# SerializedAXNode.selected property - -#### Signature: - -```typescript -interface SerializedAXNode { - selected?: boolean; -} -``` diff --git a/docs/api/puppeteer.serializedaxnode.value.md b/docs/api/puppeteer.serializedaxnode.value.md deleted file mode 100644 index d464edc5dedae..0000000000000 --- a/docs/api/puppeteer.serializedaxnode.value.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: SerializedAXNode.value ---- - -# SerializedAXNode.value property - -The current value of the node. - -#### Signature: - -```typescript -interface SerializedAXNode { - value?: string | number; -} -``` diff --git a/docs/api/puppeteer.serializedaxnode.valuemax.md b/docs/api/puppeteer.serializedaxnode.valuemax.md deleted file mode 100644 index e38d544148f14..0000000000000 --- a/docs/api/puppeteer.serializedaxnode.valuemax.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: SerializedAXNode.valuemax ---- - -# SerializedAXNode.valuemax property - -#### Signature: - -```typescript -interface SerializedAXNode { - valuemax?: number; -} -``` diff --git a/docs/api/puppeteer.serializedaxnode.valuemin.md b/docs/api/puppeteer.serializedaxnode.valuemin.md deleted file mode 100644 index d43e63c440c44..0000000000000 --- a/docs/api/puppeteer.serializedaxnode.valuemin.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: SerializedAXNode.valuemin ---- - -# SerializedAXNode.valuemin property - -#### Signature: - -```typescript -interface SerializedAXNode { - valuemin?: number; -} -``` diff --git a/docs/api/puppeteer.serializedaxnode.valuetext.md b/docs/api/puppeteer.serializedaxnode.valuetext.md deleted file mode 100644 index 1633bcca4feb5..0000000000000 --- a/docs/api/puppeteer.serializedaxnode.valuetext.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: SerializedAXNode.valuetext ---- - -# SerializedAXNode.valuetext property - -A description of the current value. - -#### Signature: - -```typescript -interface SerializedAXNode { - valuetext?: string; -} -``` diff --git a/docs/api/puppeteer.snapshotoptions.interestingonly.md b/docs/api/puppeteer.snapshotoptions.interestingonly.md deleted file mode 100644 index d8b85fad10b50..0000000000000 --- a/docs/api/puppeteer.snapshotoptions.interestingonly.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: SnapshotOptions.interestingOnly ---- - -# SnapshotOptions.interestingOnly property - -Prune uninteresting nodes from the tree. - -#### Signature: - -```typescript -interface SnapshotOptions { - interestingOnly?: boolean; -} -``` - -#### Default value: - -true diff --git a/docs/api/puppeteer.snapshotoptions.md b/docs/api/puppeteer.snapshotoptions.md index 8deebc485c0da..45afea40b9e96 100644 --- a/docs/api/puppeteer.snapshotoptions.md +++ b/docs/api/puppeteer.snapshotoptions.md @@ -12,7 +12,7 @@ export interface SnapshotOptions ## Properties -| Property | Modifiers | Type | Description | Default | -| ------------------------------------------------------------------ | --------- | --------------------------------------------------------- | -------------------------------------------------------- | --------------------------------- | -| [interestingOnly?](./puppeteer.snapshotoptions.interestingonly.md) | | boolean | _(Optional)_ Prune uninteresting nodes from the tree. | true | -| [root?](./puppeteer.snapshotoptions.root.md) | | [ElementHandle](./puppeteer.elementhandle.md)<Node> | _(Optional)_ Root node to get the accessibility tree for | The root node of the entire page. | +| Property | Modifiers | Type | Description | Default | +| --------------- | --------------------- | --------------------------------------------------------- | ------------------------------------------- | --------------------------------- | +| interestingOnly | optional | boolean | Prune uninteresting nodes from the tree. | true | +| root | optional | [ElementHandle](./puppeteer.elementhandle.md)<Node> | Root node to get the accessibility tree for | The root node of the entire page. | diff --git a/docs/api/puppeteer.snapshotoptions.root.md b/docs/api/puppeteer.snapshotoptions.root.md deleted file mode 100644 index 3fd2b1a7da3d3..0000000000000 --- a/docs/api/puppeteer.snapshotoptions.root.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: SnapshotOptions.root ---- - -# SnapshotOptions.root property - -Root node to get the accessibility tree for - -#### Signature: - -```typescript -interface SnapshotOptions { - root?: ElementHandle; -} -``` - -#### Default value: - -The root node of the entire page. diff --git a/docs/api/puppeteer.target.md b/docs/api/puppeteer.target.md index dfb7f2a2149bb..a20eef9f07a5f 100644 --- a/docs/api/puppeteer.target.md +++ b/docs/api/puppeteer.target.md @@ -18,13 +18,13 @@ The constructor for this class is marked as internal. Third-party code should no ## Methods -| Method | Modifiers | Description | -| ------------------------------------------------------------ | --------- | ------------------------------------------------------------------------------------------------------------------------------------------ | -| [browser()](./puppeteer.target.browser.md) | | Get the browser the target belongs to. | -| [browserContext()](./puppeteer.target.browsercontext.md) | | Get the browser context the target belongs to. | -| [createCDPSession()](./puppeteer.target.createcdpsession.md) | | Creates a Chrome Devtools Protocol session attached to the target. | -| [opener()](./puppeteer.target.opener.md) | | Get the target that opened this target. Top-level targets return null. | -| [page()](./puppeteer.target.page.md) | | If the target is not of type "page" or "background_page", returns null. | -| [type()](./puppeteer.target.type.md) | | Identifies what kind of target this is. | -| [url()](./puppeteer.target.url.md) | | | -| [worker()](./puppeteer.target.worker.md) | | If the target is not of type "service_worker" or "shared_worker", returns null. | +| Method | Modifiers | Description | +| ------------------------------------------------------------ | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [browser()](./puppeteer.target.browser.md) | | Get the browser the target belongs to. | +| [browserContext()](./puppeteer.target.browsercontext.md) | | Get the browser context the target belongs to. | +| [createCDPSession()](./puppeteer.target.createcdpsession.md) | | Creates a Chrome Devtools Protocol session attached to the target. | +| [opener()](./puppeteer.target.opener.md) | | Get the target that opened this target. Top-level targets return null. | +| [page()](./puppeteer.target.page.md) | | If the target is not of type "page", "webview" or "background_page", returns null. | +| [type()](./puppeteer.target.type.md) | | Identifies what kind of target this is. | +| [url()](./puppeteer.target.url.md) | | | +| [worker()](./puppeteer.target.worker.md) | | If the target is not of type "service_worker" or "shared_worker", returns null. | diff --git a/docs/api/puppeteer.target.page.md b/docs/api/puppeteer.target.page.md index 4a2fd2a74339e..b4d6d53b9d6b2 100644 --- a/docs/api/puppeteer.target.page.md +++ b/docs/api/puppeteer.target.page.md @@ -4,7 +4,7 @@ sidebar_label: Target.page # Target.page() method -If the target is not of type `"page"` or `"background_page"`, returns `null`. +If the target is not of type `"page"`, `"webview"` or `"background_page"`, returns `null`. #### Signature: diff --git a/docs/api/puppeteer.target.type.md b/docs/api/puppeteer.target.type.md index 39c573445e0ca..ef63849b57e1f 100644 --- a/docs/api/puppeteer.target.type.md +++ b/docs/api/puppeteer.target.type.md @@ -10,20 +10,13 @@ Identifies what kind of target this is. ```typescript class Target { - type(): - | 'page' - | 'background_page' - | 'service_worker' - | 'shared_worker' - | 'other' - | 'browser' - | 'webview'; + type(): TargetType; } ``` **Returns:** -'page' \| 'background_page' \| 'service_worker' \| 'shared_worker' \| 'other' \| 'browser' \| 'webview' +[TargetType](./puppeteer.targettype.md) ## Remarks diff --git a/docs/api/puppeteer.targetfiltercallback.md b/docs/api/puppeteer.targetfiltercallback.md index 45efa95f909ec..77611196ca0dc 100644 --- a/docs/api/puppeteer.targetfiltercallback.md +++ b/docs/api/puppeteer.targetfiltercallback.md @@ -7,7 +7,7 @@ sidebar_label: TargetFilterCallback #### Signature: ```typescript -export type TargetFilterCallback = ( - target: Protocol.Target.TargetInfo -) => boolean; +export type TargetFilterCallback = (target: Target) => boolean; ``` + +**References:** [Target](./puppeteer.target.md) diff --git a/docs/api/puppeteer.targettype.md b/docs/api/puppeteer.targettype.md new file mode 100644 index 0000000000000..ebc8244edaae7 --- /dev/null +++ b/docs/api/puppeteer.targettype.md @@ -0,0 +1,23 @@ +--- +sidebar_label: TargetType +--- + +# TargetType enum + +#### Signature: + +```typescript +export declare enum TargetType +``` + +## Enumeration Members + +| Member | Value | Description | +| --------------- | ---------------------------------------- | ----------- | +| BACKGROUND_PAGE | "background_page" | | +| BROWSER | "browser" | | +| OTHER | "other" | | +| PAGE | "page" | | +| SERVICE_WORKER | "service_worker" | | +| SHARED_WORKER | "shared_worker" | | +| WEBVIEW | "webview" | | diff --git a/docs/api/puppeteer.tracingoptions.categories.md b/docs/api/puppeteer.tracingoptions.categories.md deleted file mode 100644 index 3cdf4605b2316..0000000000000 --- a/docs/api/puppeteer.tracingoptions.categories.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: TracingOptions.categories ---- - -# TracingOptions.categories property - -#### Signature: - -```typescript -interface TracingOptions { - categories?: string[]; -} -``` diff --git a/docs/api/puppeteer.tracingoptions.md b/docs/api/puppeteer.tracingoptions.md index f19646be7ecdc..315b15add09f5 100644 --- a/docs/api/puppeteer.tracingoptions.md +++ b/docs/api/puppeteer.tracingoptions.md @@ -12,8 +12,8 @@ export interface TracingOptions ## Properties -| Property | Modifiers | Type | Description | Default | -| --------------------------------------------------------- | --------- | ---------- | ------------ | ------- | -| [categories?](./puppeteer.tracingoptions.categories.md) | | string\[\] | _(Optional)_ | | -| [path?](./puppeteer.tracingoptions.path.md) | | string | _(Optional)_ | | -| [screenshots?](./puppeteer.tracingoptions.screenshots.md) | | boolean | _(Optional)_ | | +| Property | Modifiers | Type | Description | Default | +| ----------- | --------------------- | ---------- | ----------- | ------- | +| categories | optional | string\[\] | | | +| path | optional | string | | | +| screenshots | optional | boolean | | | diff --git a/docs/api/puppeteer.tracingoptions.path.md b/docs/api/puppeteer.tracingoptions.path.md deleted file mode 100644 index b6efbc1a72c1d..0000000000000 --- a/docs/api/puppeteer.tracingoptions.path.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: TracingOptions.path ---- - -# TracingOptions.path property - -#### Signature: - -```typescript -interface TracingOptions { - path?: string; -} -``` diff --git a/docs/api/puppeteer.tracingoptions.screenshots.md b/docs/api/puppeteer.tracingoptions.screenshots.md deleted file mode 100644 index d1d9a8736e838..0000000000000 --- a/docs/api/puppeteer.tracingoptions.screenshots.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: TracingOptions.screenshots ---- - -# TracingOptions.screenshots property - -#### Signature: - -```typescript -interface TracingOptions { - screenshots?: boolean; -} -``` diff --git a/docs/api/puppeteer.trimcache.md b/docs/api/puppeteer.trimcache.md new file mode 100644 index 0000000000000..5b28527c2b560 --- /dev/null +++ b/docs/api/puppeteer.trimcache.md @@ -0,0 +1,11 @@ +--- +sidebar_label: trimCache +--- + +# trimCache variable + +#### Signature: + +```typescript +trimCache: () => Promise; +``` diff --git a/docs/api/puppeteer.unionlocatorof.md b/docs/api/puppeteer.unionlocatorof.md new file mode 100644 index 0000000000000..ea442953b4dfb --- /dev/null +++ b/docs/api/puppeteer.unionlocatorof.md @@ -0,0 +1,13 @@ +--- +sidebar_label: UnionLocatorOf +--- + +# UnionLocatorOf type + +#### Signature: + +```typescript +export type UnionLocatorOf = T extends Array> ? S : never; +``` + +**References:** [Locator](./puppeteer.locator.md) diff --git a/docs/api/puppeteer.viewport.devicescalefactor.md b/docs/api/puppeteer.viewport.devicescalefactor.md deleted file mode 100644 index dd3b2d97b4161..0000000000000 --- a/docs/api/puppeteer.viewport.devicescalefactor.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: Viewport.deviceScaleFactor ---- - -# Viewport.deviceScaleFactor property - -Specify device scale factor. See [devicePixelRatio](https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio) for more info. - -#### Signature: - -```typescript -interface Viewport { - deviceScaleFactor?: number; -} -``` - -#### Default value: - -1 diff --git a/docs/api/puppeteer.viewport.hastouch.md b/docs/api/puppeteer.viewport.hastouch.md deleted file mode 100644 index 4e8577a2bbf40..0000000000000 --- a/docs/api/puppeteer.viewport.hastouch.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: Viewport.hasTouch ---- - -# Viewport.hasTouch property - -Specify if the viewport supports touch events. - -#### Signature: - -```typescript -interface Viewport { - hasTouch?: boolean; -} -``` - -#### Default value: - -false diff --git a/docs/api/puppeteer.viewport.height.md b/docs/api/puppeteer.viewport.height.md deleted file mode 100644 index 420210c34c908..0000000000000 --- a/docs/api/puppeteer.viewport.height.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: Viewport.height ---- - -# Viewport.height property - -The page height in pixels. - -#### Signature: - -```typescript -interface Viewport { - height: number; -} -``` diff --git a/docs/api/puppeteer.viewport.islandscape.md b/docs/api/puppeteer.viewport.islandscape.md deleted file mode 100644 index d039d565e9ec0..0000000000000 --- a/docs/api/puppeteer.viewport.islandscape.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: Viewport.isLandscape ---- - -# Viewport.isLandscape property - -Specifies if the viewport is in landscape mode. - -#### Signature: - -```typescript -interface Viewport { - isLandscape?: boolean; -} -``` - -#### Default value: - -false diff --git a/docs/api/puppeteer.viewport.ismobile.md b/docs/api/puppeteer.viewport.ismobile.md deleted file mode 100644 index c2d90d24c786d..0000000000000 --- a/docs/api/puppeteer.viewport.ismobile.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: Viewport.isMobile ---- - -# Viewport.isMobile property - -Whether the `meta viewport` tag is taken into account. - -#### Signature: - -```typescript -interface Viewport { - isMobile?: boolean; -} -``` - -#### Default value: - -false diff --git a/docs/api/puppeteer.viewport.md b/docs/api/puppeteer.viewport.md index 5fdf6c8741a8d..5fa1f4d2a380e 100644 --- a/docs/api/puppeteer.viewport.md +++ b/docs/api/puppeteer.viewport.md @@ -14,11 +14,11 @@ export interface Viewport ## Properties -| Property | Modifiers | Type | Description | Default | -| --------------------------------------------------------------- | --------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | -| [deviceScaleFactor?](./puppeteer.viewport.devicescalefactor.md) | | number | _(Optional)_ Specify device scale factor. See [devicePixelRatio](https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio) for more info. | 1 | -| [hasTouch?](./puppeteer.viewport.hastouch.md) | | boolean | _(Optional)_ Specify if the viewport supports touch events. | false | -| [height](./puppeteer.viewport.height.md) | | number | The page height in pixels. | | -| [isLandscape?](./puppeteer.viewport.islandscape.md) | | boolean | _(Optional)_ Specifies if the viewport is in landscape mode. | false | -| [isMobile?](./puppeteer.viewport.ismobile.md) | | boolean | _(Optional)_ Whether the meta viewport tag is taken into account. | false | -| [width](./puppeteer.viewport.width.md) | | number | The page width in pixels. | | +| Property | Modifiers | Type | Description | Default | +| ----------------- | --------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | +| deviceScaleFactor | optional | number | Specify device scale factor. See [devicePixelRatio](https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio) for more info. | 1 | +| hasTouch | optional | boolean | Specify if the viewport supports touch events. | false | +| height | | number | The page height in pixels. | | +| isLandscape | optional | boolean | Specifies if the viewport is in landscape mode. | false | +| isMobile | optional | boolean | Whether the meta viewport tag is taken into account. | false | +| width | | number | The page width in pixels. | | diff --git a/docs/api/puppeteer.viewport.width.md b/docs/api/puppeteer.viewport.width.md deleted file mode 100644 index ddd8e3d5d23b4..0000000000000 --- a/docs/api/puppeteer.viewport.width.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -sidebar_label: Viewport.width ---- - -# Viewport.width property - -The page width in pixels. - -#### Signature: - -```typescript -interface Viewport { - width: number; -} -``` diff --git a/docs/api/puppeteer.visibilityoption.md b/docs/api/puppeteer.visibilityoption.md new file mode 100644 index 0000000000000..1af2ec00500f8 --- /dev/null +++ b/docs/api/puppeteer.visibilityoption.md @@ -0,0 +1,11 @@ +--- +sidebar_label: VisibilityOption +--- + +# VisibilityOption type + +#### Signature: + +```typescript +export type VisibilityOption = 'hidden' | 'visible' | null; +``` diff --git a/docs/api/puppeteer.waitforoptions.md b/docs/api/puppeteer.waitforoptions.md index 138111ef1f1e7..a9e5448895383 100644 --- a/docs/api/puppeteer.waitforoptions.md +++ b/docs/api/puppeteer.waitforoptions.md @@ -12,7 +12,7 @@ export interface WaitForOptions ## Properties -| Property | Modifiers | Type | Description | Default | -| ----------------------------------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | -| [timeout?](./puppeteer.waitforoptions.timeout.md) | | number |

_(Optional)_ Maximum wait time in milliseconds. Pass 0 to disable the timeout.

The default value can be changed by using the [Page.setDefaultTimeout()](./puppeteer.page.setdefaulttimeout.md) or [Page.setDefaultNavigationTimeout()](./puppeteer.page.setdefaultnavigationtimeout.md) methods.

| 30000 | -| [waitUntil?](./puppeteer.waitforoptions.waituntil.md) | | [PuppeteerLifeCycleEvent](./puppeteer.puppeteerlifecycleevent.md) \| [PuppeteerLifeCycleEvent](./puppeteer.puppeteerlifecycleevent.md)\[\] | _(Optional)_ | | +| Property | Modifiers | Type | Description | Default | +| --------- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------ | +| timeout | optional | number |

Maximum wait time in milliseconds. Pass 0 to disable the timeout.

The default value can be changed by using the [Page.setDefaultTimeout()](./puppeteer.page.setdefaulttimeout.md) or [Page.setDefaultNavigationTimeout()](./puppeteer.page.setdefaultnavigationtimeout.md) methods.

| 30000 | +| waitUntil | optional | [PuppeteerLifeCycleEvent](./puppeteer.puppeteerlifecycleevent.md) \| [PuppeteerLifeCycleEvent](./puppeteer.puppeteerlifecycleevent.md)\[\] | | | diff --git a/docs/api/puppeteer.waitforoptions.timeout.md b/docs/api/puppeteer.waitforoptions.timeout.md deleted file mode 100644 index 626af770bea41..0000000000000 --- a/docs/api/puppeteer.waitforoptions.timeout.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -sidebar_label: WaitForOptions.timeout ---- - -# WaitForOptions.timeout property - -Maximum wait time in milliseconds. Pass 0 to disable the timeout. - -The default value can be changed by using the [Page.setDefaultTimeout()](./puppeteer.page.setdefaulttimeout.md) or [Page.setDefaultNavigationTimeout()](./puppeteer.page.setdefaultnavigationtimeout.md) methods. - -#### Signature: - -```typescript -interface WaitForOptions { - timeout?: number; -} -``` - -#### Default value: - -`30000` diff --git a/docs/api/puppeteer.waitforoptions.waituntil.md b/docs/api/puppeteer.waitforoptions.waituntil.md deleted file mode 100644 index ba585b2e10a43..0000000000000 --- a/docs/api/puppeteer.waitforoptions.waituntil.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: WaitForOptions.waitUntil ---- - -# WaitForOptions.waitUntil property - -#### Signature: - -```typescript -interface WaitForOptions { - waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[]; -} -``` diff --git a/docs/api/puppeteer.waitforselectoroptions.hidden.md b/docs/api/puppeteer.waitforselectoroptions.hidden.md deleted file mode 100644 index ad01b65febe4d..0000000000000 --- a/docs/api/puppeteer.waitforselectoroptions.hidden.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: WaitForSelectorOptions.hidden ---- - -# WaitForSelectorOptions.hidden property - -Wait for the selected element to not be found in the DOM or to be hidden, i.e. have `display: none` or `visibility: hidden` CSS properties. - -#### Signature: - -```typescript -interface WaitForSelectorOptions { - hidden?: boolean; -} -``` - -#### Default value: - -`false` diff --git a/docs/api/puppeteer.waitforselectoroptions.md b/docs/api/puppeteer.waitforselectoroptions.md index d3f101460412d..41dbd25c9f785 100644 --- a/docs/api/puppeteer.waitforselectoroptions.md +++ b/docs/api/puppeteer.waitforselectoroptions.md @@ -12,8 +12,9 @@ export interface WaitForSelectorOptions ## Properties -| Property | Modifiers | Type | Description | Default | -| --------------------------------------------------------- | --------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------- | -| [hidden?](./puppeteer.waitforselectoroptions.hidden.md) | | boolean | _(Optional)_ Wait for the selected element to not be found in the DOM or to be hidden, i.e. have display: none or visibility: hidden CSS properties. | false | -| [timeout?](./puppeteer.waitforselectoroptions.timeout.md) | | number |

_(Optional)_ Maximum time to wait in milliseconds. Pass 0 to disable timeout.

The default value can be changed by using [Page.setDefaultTimeout()](./puppeteer.page.setdefaulttimeout.md)

| 30000 (30 seconds) | -| [visible?](./puppeteer.waitforselectoroptions.visible.md) | | boolean | _(Optional)_ Wait for the selected element to be present in DOM and to be visible, i.e. to not have display: none or visibility: hidden CSS properties. | false | +| Property | Modifiers | Type | Description | Default | +| -------- | --------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------- | +| hidden | optional | boolean | Wait for the selected element to not be found in the DOM or to be hidden, i.e. have display: none or visibility: hidden CSS properties. | false | +| signal | optional | AbortSignal | A signal object that allows you to cancel a waitForSelector call. | | +| timeout | optional | number |

Maximum time to wait in milliseconds. Pass 0 to disable timeout.

The default value can be changed by using [Page.setDefaultTimeout()](./puppeteer.page.setdefaulttimeout.md)

| 30_000 (30 seconds) | +| visible | optional | boolean | Wait for the selected element to be present in DOM and to be visible, i.e. to not have display: none or visibility: hidden CSS properties. | false | diff --git a/docs/api/puppeteer.waitforselectoroptions.timeout.md b/docs/api/puppeteer.waitforselectoroptions.timeout.md deleted file mode 100644 index e87455f54a1d8..0000000000000 --- a/docs/api/puppeteer.waitforselectoroptions.timeout.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -sidebar_label: WaitForSelectorOptions.timeout ---- - -# WaitForSelectorOptions.timeout property - -Maximum time to wait in milliseconds. Pass `0` to disable timeout. - -The default value can be changed by using [Page.setDefaultTimeout()](./puppeteer.page.setdefaulttimeout.md) - -#### Signature: - -```typescript -interface WaitForSelectorOptions { - timeout?: number; -} -``` - -#### Default value: - -`30000` (30 seconds) diff --git a/docs/api/puppeteer.waitforselectoroptions.visible.md b/docs/api/puppeteer.waitforselectoroptions.visible.md deleted file mode 100644 index 045670daf7b49..0000000000000 --- a/docs/api/puppeteer.waitforselectoroptions.visible.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: WaitForSelectorOptions.visible ---- - -# WaitForSelectorOptions.visible property - -Wait for the selected element to be present in DOM and to be visible, i.e. to not have `display: none` or `visibility: hidden` CSS properties. - -#### Signature: - -```typescript -interface WaitForSelectorOptions { - visible?: boolean; -} -``` - -#### Default value: - -`false` diff --git a/docs/api/puppeteer.waitfortargetoptions.md b/docs/api/puppeteer.waitfortargetoptions.md index 980689b53937e..b1787356499ec 100644 --- a/docs/api/puppeteer.waitfortargetoptions.md +++ b/docs/api/puppeteer.waitfortargetoptions.md @@ -12,6 +12,6 @@ export interface WaitForTargetOptions ## Properties -| Property | Modifiers | Type | Description | Default | -| ------------------------------------------------------- | --------- | ------ | ------------------------------------------------------------------------------------------- | ----------- | -| [timeout?](./puppeteer.waitfortargetoptions.timeout.md) | | number | _(Optional)_ Maximum wait time in milliseconds. Pass 0 to disable the timeout. | 30 seconds. | +| Property | Modifiers | Type | Description | Default | +| -------- | --------------------- | ------ | ------------------------------------------------------------------------------ | ------------------- | +| timeout | optional | number | Maximum wait time in milliseconds. Pass 0 to disable the timeout. | 30_000 | diff --git a/docs/api/puppeteer.waitfortargetoptions.timeout.md b/docs/api/puppeteer.waitfortargetoptions.timeout.md deleted file mode 100644 index e5304748b4df7..0000000000000 --- a/docs/api/puppeteer.waitfortargetoptions.timeout.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -sidebar_label: WaitForTargetOptions.timeout ---- - -# WaitForTargetOptions.timeout property - -Maximum wait time in milliseconds. Pass `0` to disable the timeout. - -#### Signature: - -```typescript -interface WaitForTargetOptions { - timeout?: number; -} -``` - -#### Default value: - -30 seconds. diff --git a/docs/api/puppeteer.waittimeoutoptions.md b/docs/api/puppeteer.waittimeoutoptions.md index ef693c9aac76d..e436a96d96244 100644 --- a/docs/api/puppeteer.waittimeoutoptions.md +++ b/docs/api/puppeteer.waittimeoutoptions.md @@ -12,6 +12,6 @@ export interface WaitTimeoutOptions ## Properties -| Property | Modifiers | Type | Description | Default | -| ----------------------------------------------------- | --------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | -| [timeout?](./puppeteer.waittimeoutoptions.timeout.md) | | number |

_(Optional)_ Maximum wait time in milliseconds. Pass 0 to disable the timeout.

The default value can be changed by using the [Page.setDefaultTimeout()](./puppeteer.page.setdefaulttimeout.md) method.

| 30000 | +| Property | Modifiers | Type | Description | Default | +| -------- | --------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------ | +| timeout | optional | number |

Maximum wait time in milliseconds. Pass 0 to disable the timeout.

The default value can be changed by using the [Page.setDefaultTimeout()](./puppeteer.page.setdefaulttimeout.md) method.

| 30000 | diff --git a/docs/api/puppeteer.waittimeoutoptions.timeout.md b/docs/api/puppeteer.waittimeoutoptions.timeout.md deleted file mode 100644 index 5d65eda5e70f7..0000000000000 --- a/docs/api/puppeteer.waittimeoutoptions.timeout.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -sidebar_label: WaitTimeoutOptions.timeout ---- - -# WaitTimeoutOptions.timeout property - -Maximum wait time in milliseconds. Pass 0 to disable the timeout. - -The default value can be changed by using the [Page.setDefaultTimeout()](./puppeteer.page.setdefaulttimeout.md) method. - -#### Signature: - -```typescript -interface WaitTimeoutOptions { - timeout?: number; -} -``` - -#### Default value: - -`30000` diff --git a/docs/api/puppeteer.webworker.evaluate.md b/docs/api/puppeteer.webworker.evaluate.md index 42245d0562458..61884c3c767b9 100644 --- a/docs/api/puppeteer.webworker.evaluate.md +++ b/docs/api/puppeteer.webworker.evaluate.md @@ -12,7 +12,7 @@ If the function passed to the `worker.evaluate` returns a Promise, then `worker. class WebWorker { evaluate< Params extends unknown[], - Func extends EvaluateFunc = EvaluateFunc + Func extends EvaluateFunc = EvaluateFunc, >( pageFunction: Func | string, ...args: Params diff --git a/docs/api/puppeteer.webworker.evaluatehandle.md b/docs/api/puppeteer.webworker.evaluatehandle.md index 0347c4f6860c3..d84a05d0833d9 100644 --- a/docs/api/puppeteer.webworker.evaluatehandle.md +++ b/docs/api/puppeteer.webworker.evaluatehandle.md @@ -12,7 +12,7 @@ The only difference between `worker.evaluate` and `worker.evaluateHandle` is tha class WebWorker { evaluateHandle< Params extends unknown[], - Func extends EvaluateFunc = EvaluateFunc + Func extends EvaluateFunc = EvaluateFunc, >( pageFunction: Func | string, ...args: Params diff --git a/docs/api/puppeteer.webworker.md b/docs/api/puppeteer.webworker.md index 5662bc435fdd3..3723f438ce4ee 100644 --- a/docs/api/puppeteer.webworker.md +++ b/docs/api/puppeteer.webworker.md @@ -36,10 +36,16 @@ for (const worker of page.workers()) { } ``` +## Properties + +| Property | Modifiers | Type | Description | +| -------- | --------------------- | --------------------------------------- | ------------------------------------------------ | +| client | readonly | [CDPSession](./puppeteer.cdpsession.md) | The CDP session client the WebWorker belongs to. | + ## Methods | Method | Modifiers | Description | | ----------------------------------------------------------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | [evaluate(pageFunction, args)](./puppeteer.webworker.evaluate.md) | | If the function passed to the worker.evaluate returns a Promise, then worker.evaluate would wait for the promise to resolve and return its value. If the function passed to the worker.evaluate returns a non-serializable value, then worker.evaluate resolves to undefined. DevTools Protocol also supports transferring some additional values that are not serializable by JSON: -0, NaN, Infinity, -Infinity, and bigint literals. Shortcut for await worker.executionContext()).evaluate(pageFunction, ...args). | | [evaluateHandle(pageFunction, args)](./puppeteer.webworker.evaluatehandle.md) | | The only difference between worker.evaluate and worker.evaluateHandle is that worker.evaluateHandle returns in-page object (JSHandle). If the function passed to the worker.evaluateHandle returns a Promise, then worker.evaluateHandle would wait for the promise to resolve and return its value. Shortcut for await worker.executionContext()).evaluateHandle(pageFunction, ...args) | -| [url()](./puppeteer.webworker.url.md) | | | +| [url()](./puppeteer.webworker.url.md) | | The URL of this web worker. | diff --git a/docs/api/puppeteer.webworker.url.md b/docs/api/puppeteer.webworker.url.md index a8a09c6a94c04..8893c385dca18 100644 --- a/docs/api/puppeteer.webworker.url.md +++ b/docs/api/puppeteer.webworker.url.md @@ -4,6 +4,8 @@ sidebar_label: WebWorker.url # WebWorker.url() method +The URL of this web worker. + #### Signature: ```typescript @@ -15,5 +17,3 @@ class WebWorker { **Returns:** string - -The URL of this web worker. diff --git a/docs/browsers-api/browsers.browser.md b/docs/browsers-api/browsers.browser.md new file mode 100644 index 0000000000000..9020e96331408 --- /dev/null +++ b/docs/browsers-api/browsers.browser.md @@ -0,0 +1,22 @@ +--- +sidebar_label: Browser +--- + +# Browser enum + +Supported browsers. + +#### Signature: + +```typescript +export declare enum Browser +``` + +## Enumeration Members + +| Member | Value | Description | +| ------------ | ------------------------------------- | ----------- | +| CHROME | "chrome" | | +| CHROMEDRIVER | "chromedriver" | | +| CHROMIUM | "chromium" | | +| FIREFOX | "firefox" | | diff --git a/docs/browsers-api/browsers.browserplatform.md b/docs/browsers-api/browsers.browserplatform.md new file mode 100644 index 0000000000000..50c021f1bae2f --- /dev/null +++ b/docs/browsers-api/browsers.browserplatform.md @@ -0,0 +1,23 @@ +--- +sidebar_label: BrowserPlatform +--- + +# BrowserPlatform enum + +Platform names used to identify a OS platfrom x architecture combination in the way that is relevant for the browser download. + +#### Signature: + +```typescript +export declare enum BrowserPlatform +``` + +## Enumeration Members + +| Member | Value | Description | +| ------- | -------------------------------- | ----------- | +| LINUX | "linux" | | +| MAC | "mac" | | +| MAC_ARM | "mac_arm" | | +| WIN32 | "win32" | | +| WIN64 | "win64" | | diff --git a/docs/browsers-api/browsers.candownload.md b/docs/browsers-api/browsers.candownload.md new file mode 100644 index 0000000000000..ec56447d442c3 --- /dev/null +++ b/docs/browsers-api/browsers.candownload.md @@ -0,0 +1,21 @@ +--- +sidebar_label: canDownload +--- + +# canDownload() function + +#### Signature: + +```typescript +export declare function canDownload(options: InstallOptions): Promise; +``` + +## Parameters + +| Parameter | Type | Description | +| --------- | ---------------------------------------------- | ----------- | +| options | [InstallOptions](./browsers.installoptions.md) | | + +**Returns:** + +Promise<boolean> diff --git a/docs/browsers-api/browsers.cdp_websocket_endpoint_regex.md b/docs/browsers-api/browsers.cdp_websocket_endpoint_regex.md new file mode 100644 index 0000000000000..328b04338d4b3 --- /dev/null +++ b/docs/browsers-api/browsers.cdp_websocket_endpoint_regex.md @@ -0,0 +1,11 @@ +--- +sidebar_label: CDP_WEBSOCKET_ENDPOINT_REGEX +--- + +# CDP_WEBSOCKET_ENDPOINT_REGEX variable + +#### Signature: + +```typescript +CDP_WEBSOCKET_ENDPOINT_REGEX: RegExp; +``` diff --git a/docs/browsers-api/browsers.chromereleasechannel.md b/docs/browsers-api/browsers.chromereleasechannel.md new file mode 100644 index 0000000000000..79559f39573ca --- /dev/null +++ b/docs/browsers-api/browsers.chromereleasechannel.md @@ -0,0 +1,20 @@ +--- +sidebar_label: ChromeReleaseChannel +--- + +# ChromeReleaseChannel enum + +#### Signature: + +```typescript +export declare enum ChromeReleaseChannel +``` + +## Enumeration Members + +| Member | Value | Description | +| ------ | ------------------------------- | ----------- | +| BETA | "beta" | | +| CANARY | "canary" | | +| DEV | "dev" | | +| STABLE | "stable" | | diff --git a/docs/browsers-api/browsers.cli._constructor_.md b/docs/browsers-api/browsers.cli._constructor_.md new file mode 100644 index 0000000000000..e671661707bfe --- /dev/null +++ b/docs/browsers-api/browsers.cli._constructor_.md @@ -0,0 +1,22 @@ +--- +sidebar_label: CLI.(constructor) +--- + +# CLI.(constructor) + +Constructs a new instance of the `CLI` class + +#### Signature: + +```typescript +class CLI { + constructor(cachePath?: string, rl?: readline.Interface); +} +``` + +## Parameters + +| Parameter | Type | Description | +| --------- | ------------------ | ------------ | +| cachePath | string | _(Optional)_ | +| rl | readline.Interface | _(Optional)_ | diff --git a/docs/browsers-api/browsers.cli.md b/docs/browsers-api/browsers.cli.md new file mode 100644 index 0000000000000..1e4fc22c84192 --- /dev/null +++ b/docs/browsers-api/browsers.cli.md @@ -0,0 +1,23 @@ +--- +sidebar_label: CLI +--- + +# CLI class + +#### Signature: + +```typescript +export declare class CLI +``` + +## Constructors + +| Constructor | Modifiers | Description | +| --------------------------------------------------------------- | --------- | ------------------------------------------------------- | +| [(constructor)(cachePath, rl)](./browsers.cli._constructor_.md) | | Constructs a new instance of the CLI class | + +## Methods + +| Method | Modifiers | Description | +| ---------------------------------- | --------- | ----------- | +| [run(argv)](./browsers.cli.run.md) | | | diff --git a/docs/browsers-api/browsers.cli.run.md b/docs/browsers-api/browsers.cli.run.md new file mode 100644 index 0000000000000..9c91b0791a849 --- /dev/null +++ b/docs/browsers-api/browsers.cli.run.md @@ -0,0 +1,23 @@ +--- +sidebar_label: CLI.run +--- + +# CLI.run() method + +#### Signature: + +```typescript +class CLI { + run(argv: string[]): Promise; +} +``` + +## Parameters + +| Parameter | Type | Description | +| --------- | ---------- | ----------- | +| argv | string\[\] | | + +**Returns:** + +Promise<void> diff --git a/docs/browsers-api/browsers.computeexecutablepath.md b/docs/browsers-api/browsers.computeexecutablepath.md new file mode 100644 index 0000000000000..993038fea422f --- /dev/null +++ b/docs/browsers-api/browsers.computeexecutablepath.md @@ -0,0 +1,23 @@ +--- +sidebar_label: computeExecutablePath +--- + +# computeExecutablePath() function + +#### Signature: + +```typescript +export declare function computeExecutablePath( + options: ComputeExecutablePathOptions +): string; +``` + +## Parameters + +| Parameter | Type | Description | +| --------- | ----------------------------------------------------- | ----------- | +| options | [ComputeExecutablePathOptions](./browsers.options.md) | | + +**Returns:** + +string diff --git a/docs/browsers-api/browsers.computesystemexecutablepath.md b/docs/browsers-api/browsers.computesystemexecutablepath.md new file mode 100644 index 0000000000000..b1e9a8467da73 --- /dev/null +++ b/docs/browsers-api/browsers.computesystemexecutablepath.md @@ -0,0 +1,23 @@ +--- +sidebar_label: computeSystemExecutablePath +--- + +# computeSystemExecutablePath() function + +#### Signature: + +```typescript +export declare function computeSystemExecutablePath( + options: SystemOptions +): string; +``` + +## Parameters + +| Parameter | Type | Description | +| --------- | -------------------------------------------- | ----------- | +| options | [SystemOptions](./browsers.systemoptions.md) | | + +**Returns:** + +string diff --git a/docs/browsers-api/browsers.createprofile.md b/docs/browsers-api/browsers.createprofile.md new file mode 100644 index 0000000000000..3edbbdf8bc327 --- /dev/null +++ b/docs/browsers-api/browsers.createprofile.md @@ -0,0 +1,25 @@ +--- +sidebar_label: createProfile +--- + +# createProfile() function + +#### Signature: + +```typescript +export declare function createProfile( + browser: Browser, + opts: ProfileOptions +): Promise; +``` + +## Parameters + +| Parameter | Type | Description | +| --------- | ---------------------------------------------- | ----------- | +| browser | [Browser](./browsers.browser.md) | | +| opts | [ProfileOptions](./browsers.profileoptions.md) | | + +**Returns:** + +Promise<void> diff --git a/docs/browsers-api/browsers.detectbrowserplatform.md b/docs/browsers-api/browsers.detectbrowserplatform.md new file mode 100644 index 0000000000000..f3d7865d70f52 --- /dev/null +++ b/docs/browsers-api/browsers.detectbrowserplatform.md @@ -0,0 +1,15 @@ +--- +sidebar_label: detectBrowserPlatform +--- + +# detectBrowserPlatform() function + +#### Signature: + +```typescript +export declare function detectBrowserPlatform(): BrowserPlatform | undefined; +``` + +**Returns:** + +[BrowserPlatform](./browsers.browserplatform.md) \| undefined diff --git a/docs/browsers-api/browsers.getinstalledbrowsers.md b/docs/browsers-api/browsers.getinstalledbrowsers.md new file mode 100644 index 0000000000000..0b220af6066d2 --- /dev/null +++ b/docs/browsers-api/browsers.getinstalledbrowsers.md @@ -0,0 +1,25 @@ +--- +sidebar_label: getInstalledBrowsers +--- + +# getInstalledBrowsers() function + +Returns metadata about browsers installed in the cache directory. + +#### Signature: + +```typescript +export declare function getInstalledBrowsers( + options: GetInstalledBrowsersOptions +): Promise; +``` + +## Parameters + +| Parameter | Type | Description | +| --------- | ------------------------------------------------------------------------ | ----------- | +| options | [GetInstalledBrowsersOptions](./browsers.getinstalledbrowsersoptions.md) | | + +**Returns:** + +Promise<[InstalledBrowser](./browsers.installedbrowser.md)\[\]> diff --git a/docs/browsers-api/browsers.getinstalledbrowsersoptions.md b/docs/browsers-api/browsers.getinstalledbrowsersoptions.md new file mode 100644 index 0000000000000..cd6a19625c5ee --- /dev/null +++ b/docs/browsers-api/browsers.getinstalledbrowsersoptions.md @@ -0,0 +1,17 @@ +--- +sidebar_label: GetInstalledBrowsersOptions +--- + +# GetInstalledBrowsersOptions interface + +#### Signature: + +```typescript +export interface GetInstalledBrowsersOptions +``` + +## Properties + +| Property | Modifiers | Type | Description | Default | +| -------- | --------- | ------ | -------------------------------------------- | ------- | +| cacheDir | | string | The path to the root of the cache directory. | | diff --git a/docs/browsers-api/browsers.install.md b/docs/browsers-api/browsers.install.md new file mode 100644 index 0000000000000..8b9936c075d25 --- /dev/null +++ b/docs/browsers-api/browsers.install.md @@ -0,0 +1,25 @@ +--- +sidebar_label: install +--- + +# install() function + +#### Signature: + +```typescript +export declare function install( + options: InstallOptions & { + unpack?: true; + } +): Promise; +``` + +## Parameters + +| Parameter | Type | Description | +| --------- | ----------------------------------------------------------------------- | ----------- | +| options | [InstallOptions](./browsers.installoptions.md) & { unpack?: true; } | | + +**Returns:** + +Promise<[InstalledBrowser](./browsers.installedbrowser.md)> diff --git a/docs/browsers-api/browsers.install_1.md b/docs/browsers-api/browsers.install_1.md new file mode 100644 index 0000000000000..f44fdab2eb756 --- /dev/null +++ b/docs/browsers-api/browsers.install_1.md @@ -0,0 +1,25 @@ +--- +sidebar_label: install_1 +--- + +# install() function + +#### Signature: + +```typescript +export declare function install( + options: InstallOptions & { + unpack: false; + } +): Promise; +``` + +## Parameters + +| Parameter | Type | Description | +| --------- | ----------------------------------------------------------------------- | ----------- | +| options | [InstallOptions](./browsers.installoptions.md) & { unpack: false; } | | + +**Returns:** + +Promise<string> diff --git a/docs/browsers-api/browsers.installedbrowser.md b/docs/browsers-api/browsers.installedbrowser.md new file mode 100644 index 0000000000000..48ad1a90fab02 --- /dev/null +++ b/docs/browsers-api/browsers.installedbrowser.md @@ -0,0 +1,25 @@ +--- +sidebar_label: InstalledBrowser +--- + +# InstalledBrowser class + +#### Signature: + +```typescript +export declare class InstalledBrowser +``` + +## Remarks + +The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `InstalledBrowser` class. + +## Properties + +| Property | Modifiers | Type | Description | +| -------------- | --------------------- | ------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------- | +| browser | | [Browser](./browsers.browser.md) | | +| buildId | | string | | +| executablePath | readonly | string | | +| path | readonly | string | Path to the root of the installation folder. Use [computeExecutablePath()](./browsers.computeexecutablepath.md) to get the path to the executable binary. | +| platform | | [BrowserPlatform](./browsers.browserplatform.md) | | diff --git a/docs/browsers-api/browsers.installoptions.md b/docs/browsers-api/browsers.installoptions.md new file mode 100644 index 0000000000000..21b353bbf3682 --- /dev/null +++ b/docs/browsers-api/browsers.installoptions.md @@ -0,0 +1,23 @@ +--- +sidebar_label: InstallOptions +--- + +# InstallOptions interface + +#### Signature: + +```typescript +export interface InstallOptions +``` + +## Properties + +| Property | Modifiers | Type | Description | Default | +| ------------------------ | --------------------- | -------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| baseUrl | optional | string | Determines the host that will be used for downloading. |

Either

- https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing or - https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central

| +| browser | | [Browser](./browsers.browser.md) | Determines which browser to install. | | +| buildId | | string | Determines which buildId to download. BuildId should uniquely identify binaries and they are used for caching. | | +| cacheDir | | string | Determines the path to download browsers to. | | +| downloadProgressCallback | optional | (downloadedBytes: number, totalBytes: number) => void | Provides information about the progress of the download. | | +| platform | optional | [BrowserPlatform](./browsers.browserplatform.md) | Determines which platform the browser will be suited for. | **Auto-detected.** | +| unpack | optional | boolean | Whether to unpack and install browser archives. | true | diff --git a/docs/browsers-api/browsers.launch.md b/docs/browsers-api/browsers.launch.md new file mode 100644 index 0000000000000..72a68040a65fb --- /dev/null +++ b/docs/browsers-api/browsers.launch.md @@ -0,0 +1,21 @@ +--- +sidebar_label: launch +--- + +# launch() function + +#### Signature: + +```typescript +export declare function launch(opts: LaunchOptions): Process; +``` + +## Parameters + +| Parameter | Type | Description | +| --------- | -------------------------------------------- | ----------- | +| opts | [LaunchOptions](./browsers.launchoptions.md) | | + +**Returns:** + +[Process](./browsers.process.md) diff --git a/docs/browsers-api/browsers.launchoptions.md b/docs/browsers-api/browsers.launchoptions.md new file mode 100644 index 0000000000000..fd023acdc2402 --- /dev/null +++ b/docs/browsers-api/browsers.launchoptions.md @@ -0,0 +1,26 @@ +--- +sidebar_label: LaunchOptions +--- + +# LaunchOptions interface + +#### Signature: + +```typescript +export interface LaunchOptions +``` + +## Properties + +| Property | Modifiers | Type | Description | Default | +| -------------- | --------------------- | ----------------------------------------- | ----------- | ------- | +| args | optional | string\[\] | | | +| detached | optional | boolean | | | +| dumpio | optional | boolean | | | +| env | optional | Record<string, string \| undefined> | | | +| executablePath | | string | | | +| handleSIGHUP | optional | boolean | | | +| handleSIGINT | optional | boolean | | | +| handleSIGTERM | optional | boolean | | | +| onExit | optional | () => Promise<void> | | | +| pipe | optional | boolean | | | diff --git a/docs/browsers-api/browsers.makeprogresscallback.md b/docs/browsers-api/browsers.makeprogresscallback.md new file mode 100644 index 0000000000000..8a1aab3238279 --- /dev/null +++ b/docs/browsers-api/browsers.makeprogresscallback.md @@ -0,0 +1,25 @@ +--- +sidebar_label: makeProgressCallback +--- + +# makeProgressCallback() function + +#### Signature: + +```typescript +export declare function makeProgressCallback( + browser: Browser, + buildId: string +): (downloadedBytes: number, totalBytes: number) => void; +``` + +## Parameters + +| Parameter | Type | Description | +| --------- | -------------------------------- | ----------- | +| browser | [Browser](./browsers.browser.md) | | +| buildId | string | | + +**Returns:** + +(downloadedBytes: number, totalBytes: number) => void diff --git a/docs/browsers-api/browsers.options.md b/docs/browsers-api/browsers.options.md new file mode 100644 index 0000000000000..f377b3585da1b --- /dev/null +++ b/docs/browsers-api/browsers.options.md @@ -0,0 +1,20 @@ +--- +sidebar_label: Options +--- + +# Options interface + +#### Signature: + +```typescript +export interface ComputeExecutablePathOptions +``` + +## Properties + +| Property | Modifiers | Type | Description | Default | +| -------- | --------------------- | ------------------------------------------------ | -------------------------------------------------------------------------------------------------------------- | ------------------ | +| browser | | [Browser](./browsers.browser.md) | Determines which browser to launch. | | +| buildId | | string | Determines which buildId to download. BuildId should uniquely identify binaries and they are used for caching. | | +| cacheDir | | string | Root path to the storage directory. | | +| platform | optional | [BrowserPlatform](./browsers.browserplatform.md) | Determines which platform the browser will be suited for. | **Auto-detected.** | diff --git a/docs/browsers-api/browsers.process._constructor_.md b/docs/browsers-api/browsers.process._constructor_.md new file mode 100644 index 0000000000000..83fad9086ec55 --- /dev/null +++ b/docs/browsers-api/browsers.process._constructor_.md @@ -0,0 +1,21 @@ +--- +sidebar_label: Process.(constructor) +--- + +# Process.(constructor) + +Constructs a new instance of the `Process` class + +#### Signature: + +```typescript +class Process { + constructor(opts: LaunchOptions); +} +``` + +## Parameters + +| Parameter | Type | Description | +| --------- | -------------------------------------------- | ----------- | +| opts | [LaunchOptions](./browsers.launchoptions.md) | | diff --git a/docs/browsers-api/browsers.process.close.md b/docs/browsers-api/browsers.process.close.md new file mode 100644 index 0000000000000..3468076285e89 --- /dev/null +++ b/docs/browsers-api/browsers.process.close.md @@ -0,0 +1,17 @@ +--- +sidebar_label: Process.close +--- + +# Process.close() method + +#### Signature: + +```typescript +class Process { + close(): Promise; +} +``` + +**Returns:** + +Promise<void> diff --git a/docs/browsers-api/browsers.process.hasclosed.md b/docs/browsers-api/browsers.process.hasclosed.md new file mode 100644 index 0000000000000..1ce8e81f0058d --- /dev/null +++ b/docs/browsers-api/browsers.process.hasclosed.md @@ -0,0 +1,17 @@ +--- +sidebar_label: Process.hasClosed +--- + +# Process.hasClosed() method + +#### Signature: + +```typescript +class Process { + hasClosed(): Promise; +} +``` + +**Returns:** + +Promise<void> diff --git a/docs/browsers-api/browsers.process.kill.md b/docs/browsers-api/browsers.process.kill.md new file mode 100644 index 0000000000000..f25c05918604c --- /dev/null +++ b/docs/browsers-api/browsers.process.kill.md @@ -0,0 +1,17 @@ +--- +sidebar_label: Process.kill +--- + +# Process.kill() method + +#### Signature: + +```typescript +class Process { + kill(): void; +} +``` + +**Returns:** + +void diff --git a/docs/browsers-api/browsers.process.md b/docs/browsers-api/browsers.process.md new file mode 100644 index 0000000000000..8b5d642e6c188 --- /dev/null +++ b/docs/browsers-api/browsers.process.md @@ -0,0 +1,32 @@ +--- +sidebar_label: Process +--- + +# Process class + +#### Signature: + +```typescript +export declare class Process +``` + +## Constructors + +| Constructor | Modifiers | Description | +| ---------------------------------------------------------- | --------- | ----------------------------------------------------------- | +| [(constructor)(opts)](./browsers.process._constructor_.md) | | Constructs a new instance of the Process class | + +## Properties + +| Property | Modifiers | Type | Description | +| ----------- | --------------------- | ------------------------- | ----------- | +| nodeProcess | readonly | childProcess.ChildProcess | | + +## Methods + +| Method | Modifiers | Description | +| ---------------------------------------------------------------------------- | --------- | ----------- | +| [close()](./browsers.process.close.md) | | | +| [hasClosed()](./browsers.process.hasclosed.md) | | | +| [kill()](./browsers.process.kill.md) | | | +| [waitForLineOutput(regex, timeout)](./browsers.process.waitforlineoutput.md) | | | diff --git a/docs/browsers-api/browsers.process.waitforlineoutput.md b/docs/browsers-api/browsers.process.waitforlineoutput.md new file mode 100644 index 0000000000000..41d94f3e2cb3b --- /dev/null +++ b/docs/browsers-api/browsers.process.waitforlineoutput.md @@ -0,0 +1,24 @@ +--- +sidebar_label: Process.waitForLineOutput +--- + +# Process.waitForLineOutput() method + +#### Signature: + +```typescript +class Process { + waitForLineOutput(regex: RegExp, timeout?: number): Promise; +} +``` + +## Parameters + +| Parameter | Type | Description | +| --------- | ------ | ------------ | +| regex | RegExp | | +| timeout | number | _(Optional)_ | + +**Returns:** + +Promise<string> diff --git a/docs/browsers-api/browsers.profileoptions.md b/docs/browsers-api/browsers.profileoptions.md new file mode 100644 index 0000000000000..a314fa188713c --- /dev/null +++ b/docs/browsers-api/browsers.profileoptions.md @@ -0,0 +1,18 @@ +--- +sidebar_label: ProfileOptions +--- + +# ProfileOptions interface + +#### Signature: + +```typescript +export interface ProfileOptions +``` + +## Properties + +| Property | Modifiers | Type | Description | Default | +| ----------- | --------- | ----------------------------- | ----------- | ------- | +| path | | string | | | +| preferences | | Record<string, unknown> | | | diff --git a/docs/browsers-api/browsers.resolvebuildid.md b/docs/browsers-api/browsers.resolvebuildid.md new file mode 100644 index 0000000000000..02cc30119e357 --- /dev/null +++ b/docs/browsers-api/browsers.resolvebuildid.md @@ -0,0 +1,27 @@ +--- +sidebar_label: resolveBuildId +--- + +# resolveBuildId() function + +#### Signature: + +```typescript +export declare function resolveBuildId( + browser: Browser, + platform: BrowserPlatform, + tag: string +): Promise; +``` + +## Parameters + +| Parameter | Type | Description | +| --------- | ------------------------------------------------ | ----------- | +| browser | [Browser](./browsers.browser.md) | | +| platform | [BrowserPlatform](./browsers.browserplatform.md) | | +| tag | string | | + +**Returns:** + +Promise<string> diff --git a/docs/browsers-api/browsers.systemoptions.md b/docs/browsers-api/browsers.systemoptions.md new file mode 100644 index 0000000000000..7fee22d26cd30 --- /dev/null +++ b/docs/browsers-api/browsers.systemoptions.md @@ -0,0 +1,19 @@ +--- +sidebar_label: SystemOptions +--- + +# SystemOptions interface + +#### Signature: + +```typescript +export interface SystemOptions +``` + +## Properties + +| Property | Modifiers | Type | Description | Default | +| -------- | --------------------- | ---------------------------------------------------------- | --------------------------------------------------------- | ------------------ | +| browser | | [Browser](./browsers.browser.md) | Determines which browser to launch. | | +| channel | | [ChromeReleaseChannel](./browsers.chromereleasechannel.md) | Release channel to look for on the system. | | +| platform | optional | [BrowserPlatform](./browsers.browserplatform.md) | Determines which platform the browser will be suited for. | **Auto-detected.** | diff --git a/docs/browsers-api/browsers.timeouterror.md b/docs/browsers-api/browsers.timeouterror.md new file mode 100644 index 0000000000000..48442d68b3326 --- /dev/null +++ b/docs/browsers-api/browsers.timeouterror.md @@ -0,0 +1,17 @@ +--- +sidebar_label: TimeoutError +--- + +# TimeoutError class + +#### Signature: + +```typescript +export declare class TimeoutError extends Error +``` + +**Extends:** Error + +## Remarks + +The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `TimeoutError` class. diff --git a/docs/browsers-api/browsers.uninstall.md b/docs/browsers-api/browsers.uninstall.md new file mode 100644 index 0000000000000..523d9095e065b --- /dev/null +++ b/docs/browsers-api/browsers.uninstall.md @@ -0,0 +1,21 @@ +--- +sidebar_label: uninstall +--- + +# uninstall() function + +#### Signature: + +```typescript +export declare function uninstall(options: UninstallOptions): Promise; +``` + +## Parameters + +| Parameter | Type | Description | +| --------- | -------------------------------------------------- | ----------- | +| options | [UninstallOptions](./browsers.uninstalloptions.md) | | + +**Returns:** + +Promise<void> diff --git a/docs/browsers-api/browsers.uninstalloptions.md b/docs/browsers-api/browsers.uninstalloptions.md new file mode 100644 index 0000000000000..f1ad6206f450d --- /dev/null +++ b/docs/browsers-api/browsers.uninstalloptions.md @@ -0,0 +1,20 @@ +--- +sidebar_label: UninstallOptions +--- + +# UninstallOptions interface + +#### Signature: + +```typescript +export interface UninstallOptions +``` + +## Properties + +| Property | Modifiers | Type | Description | Default | +| -------- | --------------------- | ------------------------------------------------ | ----------------------------------------------- | ------------------ | +| browser | | [Browser](./browsers.browser.md) | Determines which browser to uninstall. | | +| buildId | | string | The browser build to uninstall | | +| cacheDir | | string | The path to the root of the cache directory. | | +| platform | optional | [BrowserPlatform](./browsers.browserplatform.md) | Determines the platform for the browser binary. | **Auto-detected.** | diff --git a/docs/browsers-api/browsers.webdriver_bidi_websocket_endpoint_regex.md b/docs/browsers-api/browsers.webdriver_bidi_websocket_endpoint_regex.md new file mode 100644 index 0000000000000..ad47afe048546 --- /dev/null +++ b/docs/browsers-api/browsers.webdriver_bidi_websocket_endpoint_regex.md @@ -0,0 +1,11 @@ +--- +sidebar_label: WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX +--- + +# WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX variable + +#### Signature: + +```typescript +WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX: RegExp; +``` diff --git a/docs/browsers-api/index.md b/docs/browsers-api/index.md new file mode 100644 index 0000000000000..11cac42d5e634 --- /dev/null +++ b/docs/browsers-api/index.md @@ -0,0 +1,85 @@ +--- +sidebar_label: API +--- + +# @puppeteer/browsers + +Manage and launch browsers/drivers from a CLI or programmatically. + +## CLI + +Use `npx` to run the CLI: + +```bash +npx @puppeteer/browsers --help +``` + +CLI help will provide all documentation you need to use the CLI. + +```bash +npx @puppeteer/browsers --help # help for all commands +npx @puppeteer/browsers install --help # help for the install command +npx @puppeteer/browsers launch --help # help for the launch command +``` + +## Known limitations + +1. We support installing and running Firefox, Chrome and Chromium. The `latest`, `beta`, `dev`, `canary`, `stable` keywords are only supported for the install command. For the `launch` command you need to specify an exact build ID. The build ID is provided by the `install` command (see `npx @puppeteer/browsers install --help` for the format). +2. Launching the system browsers is only possible for Chrome/Chromium. + +## API + +The programmatic API allows installing and launching browsers from your code. See the `test` folder for examples on how to use the `install`, `canInstall`, `launch`, `computeExecutablePath`, `computeSystemExecutablePath` and other methods. + +## Classes + +| Class | Description | +| -------------------------------------------------- | ----------- | +| [CLI](./browsers.cli.md) | | +| [InstalledBrowser](./browsers.installedbrowser.md) | | +| [Process](./browsers.process.md) | | +| [TimeoutError](./browsers.timeouterror.md) | | + +## Enumerations + +| Enumeration | Description | +| ---------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | +| [Browser](./browsers.browser.md) | Supported browsers. | +| [BrowserPlatform](./browsers.browserplatform.md) | Platform names used to identify a OS platfrom x architecture combination in the way that is relevant for the browser download. | +| [ChromeReleaseChannel](./browsers.chromereleasechannel.md) | | + +## Functions + +| Function | Description | +| --------------------------------------------------------------------------------- | ----------------------------------------------------------------- | +| [canDownload(options)](./browsers.candownload.md) | | +| [computeExecutablePath(options)](./browsers.computeexecutablepath.md) | | +| [computeSystemExecutablePath(options)](./browsers.computesystemexecutablepath.md) | | +| [createProfile(browser, opts)](./browsers.createprofile.md) | | +| [detectBrowserPlatform()](./browsers.detectbrowserplatform.md) | | +| [getInstalledBrowsers(options)](./browsers.getinstalledbrowsers.md) | Returns metadata about browsers installed in the cache directory. | +| [install(options)](./browsers.install.md) | | +| [install(options)](./browsers.install_1.md) | | +| [launch(opts)](./browsers.launch.md) | | +| [makeProgressCallback(browser, buildId)](./browsers.makeprogresscallback.md) | | +| [resolveBuildId(browser, platform, tag)](./browsers.resolvebuildid.md) | | +| [uninstall(options)](./browsers.uninstall.md) | | + +## Interfaces + +| Interface | Description | +| ------------------------------------------------------------------------ | ----------- | +| [GetInstalledBrowsersOptions](./browsers.getinstalledbrowsersoptions.md) | | +| [InstallOptions](./browsers.installoptions.md) | | +| [LaunchOptions](./browsers.launchoptions.md) | | +| [Options](./browsers.options.md) | | +| [ProfileOptions](./browsers.profileoptions.md) | | +| [SystemOptions](./browsers.systemoptions.md) | | +| [UninstallOptions](./browsers.uninstalloptions.md) | | + +## Variables + +| Variable | Description | +| ------------------------------------------------------------------------------------------------ | ----------- | +| [CDP_WEBSOCKET_ENDPOINT_REGEX](./browsers.cdp_websocket_endpoint_regex.md) | | +| [WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX](./browsers.webdriver_bidi_websocket_endpoint_regex.md) | | diff --git a/docs/chromium-support.md b/docs/chromium-support.md index 6205635f0a731..d67cb1997714d 100644 --- a/docs/chromium-support.md +++ b/docs/chromium-support.md @@ -4,6 +4,12 @@ The following versions of Chromium are supported, mapped to Puppeteer version: +- Chromium 115.0.5790.98 - [Puppeteer v20.9.0](https://pptr.dev/20.9.0) +- [Chrome for Testing](https://goo.gle/chrome-for-testing) 114.0.5735.133 - [Puppeteer v20.7.2](https://pptr.dev/20.7.2) +- [Chrome for Testing](https://goo.gle/chrome-for-testing) 114.0.5735.90 - [Puppeteer v20.6.0](https://pptr.dev/20.6.0) +- [Chrome for Testing](https://goo.gle/chrome-for-testing) 113.0.5672.63 - [Puppeteer v20.1.0](https://pptr.dev/20.1.0) +- [Chrome for Testing](https://goo.gle/chrome-for-testing) 112.0.5615.121 - [Puppeteer v20.0.0](https://pptr.dev/20.0.0) +- Chromium 112.0.5614.0 - [Puppeteer v19.8.0](https://github.com/puppeteer/puppeteer/blob/v19.8.0/docs/api/index.md) - Chromium 111.0.5556.0 - [Puppeteer v19.7.0](https://github.com/puppeteer/puppeteer/blob/v19.7.0/docs/api/index.md) - Chromium 110.0.5479.0 - [Puppeteer v19.6.0](https://github.com/puppeteer/puppeteer/blob/v19.6.0/docs/api/index.md) - Chromium 109.0.5412.0 - [Puppeteer v19.4.0](https://github.com/puppeteer/puppeteer/blob/v19.4.0/docs/api/index.md) diff --git a/docs/contributing.md b/docs/contributing.md index ec8981e3df3a4..4bddec351ad11 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -19,7 +19,7 @@ again. 1. Clone this repository - ```sh + ```bash git clone https://github.com/puppeteer/puppeteer cd puppeteer ``` @@ -30,7 +30,7 @@ again. 2. Install the dependencies - ```sh + ```bash npm install # Or to download Firefox PUPPETEER_PRODUCT=firefox npm install @@ -38,38 +38,21 @@ again. 3. Build all packages - ```sh + ```bash npm run build ``` 4. Run all tests - ```sh + ```bash npm test ``` -### macOS ARM and custom executables. - -- To run experimental Chromium macOS ARM tests, firstly ensure you have correct - Chromium version installed locally (you only need to do this once, not on - every test run) and then you can run the tests: - - ```bash - PUPPETEER_EXPERIMENTAL_CHROMIUM_MAC_ARM=1 npm install - PUPPETEER_EXPERIMENTAL_CHROMIUM_MAC_ARM=1 npm run test - ``` - -- To run tests with custom browser executable: - - ```bash - BINARY= npm run test:chrome # Or npm run test:firefox - ``` - ## Building a single package To build a single package, you can run: -```sh +```bash npm run build --workspace # e.g. puppeteer ``` @@ -82,7 +65,7 @@ packages is sufficient. This is all possible due to To continuously build a package, you can run: -```sh +```bash npm run build --watch --workspace # e.g. puppeteer ``` @@ -97,14 +80,16 @@ It's possible some generated artifacts (such as rely on complex conditions (such as names of distinct files) that cannot be captured by the build system. To clean artifacts, you can run -```sh -npm run clean # or npm run clean --workspace +```bash +npm run clean +# or specify the package +npm run clean --workspace ``` ## Comprehensive testing Outside of `npm test`, there are several other -[`npm` scripts](https://docs.npmjs.com/cli/v8/using-npm/scripts) that are +[`npm` scripts](https://docs.npmjs.com/cli/using-npm/scripts) that are usually check through CI: - `test-install` - Tests whether `puppeteer` and `puppeteer-core` install @@ -113,6 +98,7 @@ usually check through CI: [`tsd`](https://github.com/SamVerschueren/tsd). - `test:chrome:**` - Tests `puppeteer` on Chromium. - `test:firefox:**` - Tests `puppeteer` on Firefox. +- `unit` - Runs unit tests. The default `npm test` runs `test:{chrome,firefox}:headless` which is generally sufficient. @@ -123,6 +109,15 @@ to see if a given test result is expected or not. See more info about the test runner in [`tools/mochaRunner`](https://github.com/puppeteer/puppeteer/tree/main/tools/mochaRunner). +### Unit tests + +Tests that only test code (without the running browser) are put next to the classes they test +and run using the Node test runner (requires Node 20+): + +```bash +npm run unit +``` + ## Code reviews All submissions, including submissions by project members, require review. We @@ -138,8 +133,7 @@ Our coding style is fully defined in [`.prettierrc.cjs`](https://github.com/puppeteer/puppeteer/blob/main/.prettierrc.cjs) ([Prettier](https://prettier.io)). -Code is checked during `pre-push` using -[Husky](https://typicode.github.io/husky/#/), but you can check your code +Code is checked for PRs automatically and you can check your code manually by running: ```bash @@ -180,7 +174,6 @@ When authoring new API methods, consider the following: Commit messages should follow [the Conventional Commits format](https://www.conventionalcommits.org/en/v1.0.0/#summary). -This is enforced via `npm run commitlint`. In particular, breaking changes should clearly be noted as “BREAKING CHANGE:” in the commit message footer. Example: @@ -199,8 +192,10 @@ To deliver to a different location, use the "deliver" option: ## Writing documentation -Documentation is generated via `npm run docs`. It is automatically published to -our documentation site on merge and gets versioned on release. +Documentation is generated from TSDoc comments via `npm run docs`. It is automatically +published to our documentation site on merge and gets versioned on release. + +This means that you should not change the markdown in files `docs/api` manually. ## Writing TSDoc comments @@ -270,56 +265,51 @@ Copy the provided default `.vscode/launch.template.json` to `.vscode/launch.json Remember to build test before launching via: -```sh +```bash npm run build --workspace @puppeteer-test/test ``` # For Project Maintainers -## Rolling new Chromium version +## Rolling new Chrome version + +There is a [GitHub action](https://github.com/puppeteer/puppeteer/blob/main/.github/workflows/update-browser-pins.yml) that runs once per day. +The action has a manual trigger that can be found on the [Actions Tab](https://github.com/puppeteer/puppeteer/actions/workflows/update-browser-pins.yml). + +### Manual instructions + +You can run the [`tools/update_chrome_revision.mjs`](https://github.com/puppeteer/puppeteer/blob/main/tools/update_chrome_revision.mjs) locally +and try see if any changes need to be committed. -The following steps are needed to update the Chromium version. +> Note: You may need to run `node --experimental-fetch tools/update_chrome_revision.mjs` as the script relies on `fetch` -1. Find a suitable Chromium revision. Not all revisions have builds for all - platforms, so we need to find one that does. The easiest way is to run - `tools/check_availability.js -rd` to find the latest suitable `dev` Chromium - revision (see `tools/check_availability.js -help` for more options). -2. Update `packages/puppeteer-core/src/revisions.ts` with the found revision +The following steps are manual version of the script above. + +1. Find a suitable Chrome `revision` and `version` via https://googlechromelabs.github.io/chrome-for-testing/ or https://chromiumdash.appspot.com/. +2. Update `packages/puppeteer-core/src/revisions.ts` with the found `version` number. -3. Update `versions.js` with the new Chromium-to-Puppeteer version mapping and - update `lastMaintainedChromiumVersion` with the latest stable Chrome version. - You can find the corresponding version by going to [omahaproxy.appspot.com](https://omahaproxy.appspot.com/) then - searching in `Find Releases` for `r`. +3. Update `versions.js` with the new Chrome-to-Puppeteer `version` mapping and + update `lastMaintainedChromeVersion` with the the next one in from the list. 4. Run `npm run check`. If it fails, update `packages/puppeteer-core/package.json` with the expected `devtools-protocol` version and run `npm install` to generate an updated `package-lock.json`. -5. Run `npm run clean`, `npm run build` and `npm install`. +5. Run `npm run clean`, `npm install` and `npm run build`. 6. Run `npm test` and ensure that all tests pass. If a test fails, [bisect](#bisecting-upstream-changes) the upstream cause of the failure, and either update the test expectations accordingly (if it was an intended change) or work around the changes in Puppeteer (if it’s not desirable to change Puppeteer’s observable behavior). 7. Commit and push your changes and open a pull request. The commit message must - contain the version in `Chromium (r)` format to ensure + contain the version in `Chrome (r)` format to ensure that [pptr.dev](https://pptr.dev/) can parse it correctly, e.g. - `'feat(chromium): roll to Chromium 90.0.4427.0 (r856583)'`. - -### Bisecting upstream changes + `feat(chrome): roll to Chrome 90.0.4427.0 (r856583)`. -Sometimes, performing a Chromium roll causes tests to fail. To figure out the -cause, you need to bisect Chromium revisions to figure out the earliest possible -revision that changed the behavior. The `bisect` script can be helpful here. -Given a pattern for one or more unit tests, it will automatically bisect the -current range: +> NOTE: Another place you can find version corresponding version is [omahaproxy.appspot.com](https://omahaproxy.appspot.com/) by +> searching in `Find Releases` for `r`. -```sh -npm run bisect -- --good 686378 --bad 706915 script.js -npm run bisect -- --unit-test Response.fromCache -``` +### Bisecting upstream changes -By default, it will use the Chromium revision in -`packages/puppeteer-core/src/revisions.ts` from the `main` branch and from the -working tree to determine the range to bisect. +For bisecting Chrome/Chromium changes use https://www.chromium.org/developers/bisect-builds-py/. ## Releasing to npm diff --git a/docs/faq.md b/docs/faq.md index 41eec4d3021b2..a23efe9849e1c 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -97,30 +97,10 @@ taking place in the Chromium repository. Here’s a typical story: - Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/puppeteer/puppeteer/pull/2769 -However, oftentimes it is desirable to use Puppeteer with the official Google -Chrome rather than Chromium. For this to work, you should install a -`puppeteer-core` version that corresponds to the Chrome version. +## Q: Which Chrome version does Puppeteer use? -For example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` -npm tag: - -```bash -npm install puppeteer-core@chrome-71 -``` - -## Q: Which Chromium version does Puppeteer use? - -Find the version using one of the following ways: - -- Look for the `chromium` entry in - [revisions.ts](https://github.com/puppeteer/puppeteer/blob/main/packages/puppeteer-core/src/revisions.ts). - To find the corresponding Chromium commit and version number, search for the - revision prefixed by an `r` in [OmahaProxy](https://omahaproxy.appspot.com/)'s - "Find Releases" section. -- Look for the `versionsPerRelease` map in - [versions.js](https://github.com/puppeteer/puppeteer/blob/main/versions.js) - which contains mapping between Chromium and the smallest Puppeteer version - that supports it. +Look for the `chrome` entry in +[revisions.ts](https://github.com/puppeteer/puppeteer/blob/main/packages/puppeteer-core/src/revisions.ts). ## Q: Which Firefox version does Puppeteer use? @@ -135,7 +115,6 @@ To fetch Firefox Nightly as part of Puppeteer installation: ```bash PUPPETEER_PRODUCT=firefox npm i puppeteer -# or "yarn add puppeteer" ``` #### Q: What’s considered a “Navigation”? @@ -187,13 +166,13 @@ that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/puppeteer/puppeteer/issues/291).) There are two reasons for this: -- Puppeteer is bundled with Chromium — not Chrome — and so by default, it +- Puppeteer is bundled with [Chrome for Testing](https://goo.gle/chrome-for-testing) — not the regular Chrome — and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the - [`executablePath` option to `puppeteer.launch`](./api/puppeteer.launchoptions.executablepath). + [`executablePath` option to `puppeteer.launch`](./api/puppeteer.launchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.) - Since Puppeteer (in all configurations) controls a desktop version of @@ -207,30 +186,6 @@ We have a [troubleshooting](https://pptr.dev/troubleshooting) guide for various operating systems that lists the required dependencies. -#### Q: Chromium gets downloaded on every `npm ci` run. How can I cache the download? - -The default download path is `node_modules/puppeteer/.local-chromium`. However, -you can change that path with the `PUPPETEER_DOWNLOAD_PATH` environment -variable. - -Puppeteer uses that variable to resolve the Chromium executable location during -launch, so you don’t need to specify `PUPPETEER_EXECUTABLE_PATH` as well. - -For example, if you wish to keep the Chromium download in `~/.npm/chromium`: - -```sh -export PUPPETEER_DOWNLOAD_PATH=~/.npm/chromium -npm ci - -# by default the Chromium executable path is inferred -# from the download path -npm test - -# a new run of npm ci will check for the existence of -# Chromium in ~/.npm/chromium -npm ci -``` - #### Q: I have more questions! Where do I ask? There are many ways to get help on Puppeteer: diff --git a/docs/guides/configuration.mdx b/docs/guides/configuration.mdx index a9fd3885cffa0..4a47d3b7a0d51 100644 --- a/docs/guides/configuration.mdx +++ b/docs/guides/configuration.mdx @@ -78,49 +78,6 @@ about the ambient environment is needed (in this case, `__dirname`). ::: -#### Enabling experiments - -By default, experiments are turned off, but they can be individually turned on -using the [`experiments`](../api/puppeteer.configuration.experiments) key. - -For example, if you want to enable ARM-native macOS chromium, you can use - - - - -```js title=".puppeteerrc.cjs" -/** - * @type {import("puppeteer").Configuration} - */ -module.exports = { - experiments: { - macArmChromiumEnabled: true, - }, -}; -``` - - - - -```json title=".puppeteerrc.json" -{ - "experiments": { - "macArmChromiumEnabled": true - } -} -``` - - - - -```yaml title=".puppeteerrc.yaml" -experiments: - macArmChromiumEnabled: true -``` - - - - ## Environment variables Along with configuration files, Puppeteer looks for certain diff --git a/docs/guides/debugging.md b/docs/guides/debugging.md index 17c64bbba5b7b..cddd867b9fe82 100644 --- a/docs/guides/debugging.md +++ b/docs/guides/debugging.md @@ -23,13 +23,13 @@ before These methods can be used to debug any situation. These should be used as a quick sanity check before diving into more complex methods. -### Turn off [`headless`](../api/puppeteer.browserlaunchargumentoptions.headless) +### Turn off [`headless`](../api/puppeteer.browserlaunchargumentoptions) Sometimes it's useful to see what the browser is displaying. Instead of launching in -[`headless`](../api/puppeteer.browserlaunchargumentoptions.headless) mode, +[`headless`](../api/puppeteer.browserlaunchargumentoptions) mode, launch a full version of the browser with -[`headless`](../api/puppeteer.browserlaunchargumentoptions.headless) set to +[`headless`](../api/puppeteer.browserlaunchargumentoptions) set to `false`: ```ts @@ -38,7 +38,7 @@ const browser = await puppeteer.launch({headless: false}); ### Puppeteer "slow-mo" -The [`slowMo`](../api/puppeteer.browserconnectoptions.slowmo) option slows down +The [`slowMo`](../api/puppeteer.browserconnectoptions) option slows down Puppeteer operations by a specified amount of milliseconds. It's another way to help see what's going on. @@ -55,7 +55,7 @@ const browser = await puppeteer.launch({ Since client code runs in the browser, doing `console.*` in client code will not directly log to Node.js. However, you can [listen](../api/puppeteer.page.on) for -the [`console`](../api/puppeteer.pageeventobject.console) event which returns a +the [`console`](../api/puppeteer.pageeventobject) event which returns a payload with the logged text. ```ts @@ -66,7 +66,7 @@ await page.evaluate(() => console.log(`url is ${location.href}`)); ### Use the debugger in the browser -1. Set [`devtools`](../api/puppeteer.browserlaunchargumentoptions.devtools) to +1. Set [`devtools`](../api/puppeteer.browserlaunchargumentoptions) to `true` when launching Puppeteer: ```ts @@ -98,7 +98,7 @@ to this [Chromium bug](https://bugs.chromium.org/p/chromium/issues/detail?id=833928), so if you want to try something out, you have to add it to your test file. -1. Set [`headless`](../api/puppeteer.browserlaunchargumentoptions.headless) to +1. Set [`headless`](../api/puppeteer.browserlaunchargumentoptions) to `false`. 2. Add `debugger` to any server code you want debugged. For example, @@ -109,7 +109,7 @@ if you want to try something out, you have to add it to your test file. 3. Run your server code with `--inspect-brk`. For example, - ```sh + ```bash node --inspect-brk path/to/script.js ``` @@ -126,7 +126,7 @@ DevTools protocol. You can debug this by setting the `DEBUG` environment variable before running your script. This will log internal traffic via [`debug`](https://github.com/visionmedia/debug) under the `puppeteer` namespace. -```sh +```bash # Basic verbose logging env DEBUG="puppeteer:*" node script.js diff --git a/docs/guides/docker.md b/docs/guides/docker.md index fdce67104ec5b..2391aacd54636 100644 --- a/docs/guides/docker.md +++ b/docs/guides/docker.md @@ -1,13 +1,13 @@ # Docker -Puppeteer offers a Docker image that includes Chromium along with the required +Puppeteer offers a Docker image that includes [Chrome for Testing](https://goo.gle/chrome-for-testing) along with the required dependencies and a pre-installed Puppeteer version. The image is available via the [GitHub Container Registry](https://github.com/puppeteer/puppeteer/pkgs/container/puppeteer). The latest image is tagged as `latest` and other tags match Puppeteer versions. For example, -```sh +```bash docker pull ghcr.io/puppeteer/puppeteer:latest # pulls the latest docker pull ghcr.io/puppeteer/puppeteer:16.1.0 # pulls the image that contains Puppeteer v16.1.0 ``` @@ -19,7 +19,7 @@ running the image requires the `SYS_ADMIN` capability. To use the docker image directly, run: -```sh +```bash docker run -i --init --cap-add=SYS_ADMIN --rm ghcr.io/puppeteer/puppeteer:latest node -e "$(cat path/to/script.js)" ``` diff --git a/docs/guides/locators.md b/docs/guides/locators.md new file mode 100644 index 0000000000000..0985a28dd284e --- /dev/null +++ b/docs/guides/locators.md @@ -0,0 +1,108 @@ +# Locators + +Locators is a new experimental API that combines `waitForSelector` and element +actions in a single unit. In combination with additional precondition checks +this allows locators to retry failed actions automatically leading to less flaky +automation scripts. + +:::note + +Locators API is experimental and we will not follow semver for breaking changes +in the Locators API. + +::: + +## Clicking an element + +```ts +await page.locator('button').click(); +``` + +The following preconditions are automatically checked: + +- Ensures the element is in the viewport. +- Waits for the element to become + [visible](https://pptr.dev/api/puppeteer.elementhandle.isvisible/) or hidden. +- Waits for the element to become enabled. +- Waits for the element to have a stable bounding box over two consecutive + animation frames. + +## Filling out an input + +```ts +await page.locator('input').fill('value'); +``` + +Automatically detects the input type and choose an approritate way to fill it out with the provided value. + +The following preconditions are automatically checked: + +- Ensures the element is in the viewport. +- Waits for the element to become + [visible](https://pptr.dev/api/puppeteer.elementhandle.isvisible/) or hidden. +- Waits for the element to become enabled. +- Waits for the element to have a stable bounding box over two consecutive + animation frames. + +## Hover over an element + +```ts +await page.locator('div').hover(); +``` + +The following preconditions are automatically checked: + +- Ensures the element is in the viewport. +- Waits for the element to become + [visible](https://pptr.dev/api/puppeteer.elementhandle.isvisible/) or hidden. +- Waits for the element to have a stable bounding box over two consecutive + animation frames. + +## Scroll an element + +```ts +await page.locator('div').scroll({ + scrollLeft: 10, + scrollTop: 20, +}); +``` + +The following preconditions are automatically checked: + +- Ensures the element is in the viewport. +- Waits for the element to become + [visible](https://pptr.dev/api/puppeteer.elementhandle.isvisible/) or hidden. +- Waits for the element to have a stable bounding box over two consecutive + animation frames. + +## Configuring locators + +Locators can be configured to tune configure the preconditions and other other options: + +```ts +await page + .locator('button') + .setEnsureElementIsInTheViewport(false) + .setTimeout(0) + .setVisibility(null) + .setWaitForEnabled(false) + .setWaitForStableBoundingBox(false) + .click(); +``` + +## Getting locator events + +Currently, locators support a single event that notifies you when the locator is about to perform the action: + +```ts +let willClick = false; +await page + .locator('button') + .on(LocatorEmittedEvents.Action, () => { + willClick = true; + }) + .click(); +``` + +This event can be used for logging/debugging or other purposes. The event might +fire multiple times if the locator retries the action. diff --git a/docs/guides/query-selectors-legacy.md b/docs/guides/query-selectors-legacy.md new file mode 100644 index 0000000000000..b52526ea8a140 --- /dev/null +++ b/docs/guides/query-selectors-legacy.md @@ -0,0 +1,118 @@ +# Query Selectors (legacy) + +Queries are the primary mechanism for interacting with the DOM on your site. For example, a typical workflow goes like: + +```ts +// Import puppeteer +import puppeteer from 'puppeteer'; + +(async () => { + // Launch the browser + const browser = await puppeteer.launch(); + + // Create a page + const page = await browser.newPage(); + + // Go to your site + await page.goto('YOUR_SITE'); + + // Query for an element handle. + const element = await page.waitForSelector('div > .class-name'); + + // Do something with element... + await element.click(); // Just an example. + + // Dispose of handle + await element.dispose(); + + // Close browser. + await browser.close(); +})(); +``` + +## CSS + +CSS selectors follow the CSS spec of the browser being automated. We provide some basic type deduction for CSS selectors (such as `HTMLInputElement` for `input`), but any selector that contains no type information (such as `.class-name`) will need to be coerced manually using TypeScript's `as` coercion mechanism. + +### Example + +```ts +// Automatic +const element = await page.waitForSelector('div > input'); +// Manual +const element = (await page.waitForSelector( + 'div > .class-name-for-input' +)) as HTMLInputElement; +``` + +## Built-in selectors + +Built-in selectors are Puppeteer's own class of selectors for doing things CSS cannot. Every built-in selector starts with a prefix `.../` to assist Puppeteer in distinguishing between CSS selectors and a built-in. + +### Text selectors (`text/`) + +Text selectors will select "minimal" elements containing the given text, even within (open) shadow roots. Here, "minimum" means the deepest elements that contain a given text, but not their parents (which technically will also contain the given text). + +#### Example + +```ts +// Note we usually need type coercion since the type cannot be deduced, but for text selectors, `instanceof` checks may be better for runtime validation. +const element = await page.waitForSelector('text/My name is Jun'); +``` + +### XPath selectors (`xpath/`) + +XPath selectors will use the browser's native [`Document.evaluate`](https://developer.mozilla.org/en-US/docs/Web/API/Document/evaluate) to query for elements. + +#### Example + +```ts +// There is not type deduction for XPaths. +const node = await page.waitForSelector('xpath/h2'); +``` + +### ARIA selectors (`aria/`) + +ARIA selectors can be used to find elements with a given ARIA label. These labels are computed using Chrome's internal representation. + +#### Example + +```ts +const node = await page.waitForSelector('aria/Button name'); +``` + +### Pierce selectors (`pierce/`) + +Pierce selectors will run the `querySelector*` API on the document and all shadow roots to find an element. + +:::danger + +Selectors will **not** _partially_ pierce through shadow roots. See the examples below. + +::: + +#### Example + +Suppose the HTML is + +```html +
+ +
+
+
+``` + +Then + +```ts +// This will be two elements because of the outer and inner div. +expect((await page.$$('pierce/div')).length).toBe(2); + +// Partial piercing doesn't work. +expect((await page.$$('pierce/div div')).length).toBe(0); +``` + +## Custom selectors + +Puppeteer provides users the ability to add their own query selectors to Puppeteer using [Puppeteer.registerCustomQueryHandler](../api/puppeteer.registercustomqueryhandler.md). This is useful for creating custom selectors based on framework objects or other vendor-specific objects. diff --git a/docs/guides/query-selectors.md b/docs/guides/query-selectors.md index ef590d48d08da..5514046d9309b 100644 --- a/docs/guides/query-selectors.md +++ b/docs/guides/query-selectors.md @@ -30,89 +30,113 @@ import puppeteer from 'puppeteer'; })(); ``` -## CSS +## `P` Selectors -CSS selectors follow the CSS spec of the browser being automated. We provide some basic type deduction for CSS selectors (such as `HTMLInputElement` for `input`), but any selector that contains no type information (such as `.class-name`) will need to be coerced manually using TypeScript's `as` coercion mechanism. +Puppeteer uses a superset of the CSS selector syntax for querying. We call this syntax _P selectors_ and it's supercharged with extra capabilities such as deep combinators and text selection. -### Example +:::caution -```ts -// Automatic -const element = await page.waitForSelector('div > input'); -// Manual -const element = (await page.waitForSelector( - 'div > .class-name-for-input' -)) as HTMLInputElement; -``` +Although P selectors look like real CSS selectors (we intentionally designed it this way), they should not be used for actually CSS styling. They are designed only for Puppeteer. -## Built-in selectors +::: -Built-in selectors are Puppeteer's own class of selectors for doing things CSS cannot. Every built-in selector starts with a prefix `.../` to assist Puppeteer in distinguishing between CSS selectors and a built-in. +:::note -### Text selectors (`text/`) +P selectors only work on the first "depth" of selectors; for example, `:is(div >>> a)` will not work. -Text selectors will select "minimal" elements containing the given text, even within (open) shadow roots. Here, "minimum" means the deepest elements that contain a given text, but not their parents (which technically will also contain the given text). +::: -#### Example +### `>>>` and `>>>>` combinators -```ts -// Note we usually need type coercion since the type cannot be deduced, but for text selectors, `instanceof` checks may be better for runtime validation. -const element = await page.waitForSelector('text/My name is Jun'); -``` +The `>>>` and `>>>>` are called _deep descendent_ and _deep_ combinators respectively. Both combinators have the effect of going into shadow hosts with `>>>` going into every shadow host under a node and `>>>>` going into the immediate one (if the node is a shadow host; otherwise, it's a no-op). -### XPath selectors (`xpath/`) +:::note -XPath selectors will use the browser's native [`Document.evaluate`](https://developer.mozilla.org/en-US/docs/Web/API/Document/evaluate) to query for elements. +A common question is when should `>>>>` be chosen over `>>>` considering the flexibility of `>>>`. A similar question can be asked about `>` and a space; choose `>` if you do not need to query all elements under a given node and a space otherwise. This answer extends to `>>>>` (`>`) and `>>>` (space) naturally. + +::: #### Example -```ts -// There is not type deduction for XPaths. -const node = await page.waitForSelector('xpath/h2'); +Suppose we have the markup + +```html + + + + + + +

Light content

+
+
+
``` -### ARIA selectors (`aria/`) +> Note: `