isomorfeus-puppetmaster 0.5.7 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +167 -201
- data/lib/isomorfeus/puppeteer/dom_world.rb +13 -0
- data/lib/isomorfeus/puppeteer/element_handle.rb +238 -0
- data/lib/isomorfeus/puppeteer/execution_context.rb +90 -0
- data/lib/isomorfeus/puppeteer/frame.rb +33 -0
- data/lib/isomorfeus/puppeteer/js_handle.rb +13 -0
- data/lib/isomorfeus/puppeteer/page.rb +252 -0
- data/lib/isomorfeus/puppetmaster/dsl.rb +90 -17
- data/lib/isomorfeus/puppetmaster/server/checker.rb +38 -38
- data/lib/isomorfeus/puppetmaster/server.rb +169 -157
- data/lib/isomorfeus/puppetmaster/session.rb +149 -0
- data/lib/isomorfeus/puppetmaster/version.rb +1 -1
- data/lib/isomorfeus/puppetmaster.rb +4 -45
- data/lib/isomorfeus-puppetmaster.rb +10 -31
- metadata +50 -1006
- data/lib/isomorfeus/puppetmaster/console_message.rb +0 -19
- data/lib/isomorfeus/puppetmaster/cookie.rb +0 -46
- data/lib/isomorfeus/puppetmaster/document.rb +0 -271
- data/lib/isomorfeus/puppetmaster/driver/puppeteer.rb +0 -413
- data/lib/isomorfeus/puppetmaster/driver/puppeteer_document.rb +0 -953
- data/lib/isomorfeus/puppetmaster/driver/puppeteer_node.rb +0 -851
- data/lib/isomorfeus/puppetmaster/driver_registration.rb +0 -7
- data/lib/isomorfeus/puppetmaster/errors.rb +0 -90
- data/lib/isomorfeus/puppetmaster/iframe.rb +0 -17
- data/lib/isomorfeus/puppetmaster/node/checkbox.rb +0 -17
- data/lib/isomorfeus/puppetmaster/node/content_editable.rb +0 -18
- data/lib/isomorfeus/puppetmaster/node/filechooser.rb +0 -9
- data/lib/isomorfeus/puppetmaster/node/input.rb +0 -21
- data/lib/isomorfeus/puppetmaster/node/radiobutton.rb +0 -13
- data/lib/isomorfeus/puppetmaster/node/select.rb +0 -36
- data/lib/isomorfeus/puppetmaster/node/textarea.rb +0 -7
- data/lib/isomorfeus/puppetmaster/node.rb +0 -280
- data/lib/isomorfeus/puppetmaster/request.rb +0 -17
- data/lib/isomorfeus/puppetmaster/response.rb +0 -26
- data/lib/isomorfeus/puppetmaster/rspec/features.rb +0 -23
- data/lib/isomorfeus/puppetmaster/rspec/matcher_proxies.rb +0 -80
- data/lib/isomorfeus/puppetmaster/rspec/matchers/base.rb +0 -98
- data/lib/isomorfeus/puppetmaster/rspec/matchers/become_closed.rb +0 -33
- data/lib/isomorfeus/puppetmaster/rspec/matchers/compound.rb +0 -88
- data/lib/isomorfeus/puppetmaster/rspec/matchers/have_current_path.rb +0 -29
- data/lib/isomorfeus/puppetmaster/rspec/matchers/have_selector.rb +0 -69
- data/lib/isomorfeus/puppetmaster/rspec/matchers/have_text.rb +0 -33
- data/lib/isomorfeus/puppetmaster/rspec/matchers/have_title.rb +0 -29
- data/lib/isomorfeus/puppetmaster/rspec/matchers/match_selector.rb +0 -27
- data/lib/isomorfeus/puppetmaster/rspec/matchers/match_style.rb +0 -38
- data/lib/isomorfeus/puppetmaster/rspec/matchers.rb +0 -164
- data/lib/isomorfeus/puppetmaster/self_forwardable.rb +0 -39
- data/lib/isomorfeus/puppetmaster/server_registration.rb +0 -13
- data/node_modules/.bin/extract-zip +0 -12
- data/node_modules/.bin/extract-zip.cmd +0 -17
- data/node_modules/.bin/extract-zip.ps1 +0 -28
- data/node_modules/.bin/rimraf +0 -12
- data/node_modules/.bin/rimraf.cmd +0 -17
- data/node_modules/.bin/rimraf.ps1 +0 -28
- data/node_modules/.package-lock.json +0 -530
- data/node_modules/@types/node/LICENSE +0 -21
- data/node_modules/@types/node/README.md +0 -16
- data/node_modules/@types/node/assert/strict.d.ts +0 -8
- data/node_modules/@types/node/assert.d.ts +0 -912
- data/node_modules/@types/node/async_hooks.d.ts +0 -497
- data/node_modules/@types/node/buffer.d.ts +0 -2142
- data/node_modules/@types/node/child_process.d.ts +0 -1355
- data/node_modules/@types/node/cluster.d.ts +0 -414
- data/node_modules/@types/node/console.d.ts +0 -407
- data/node_modules/@types/node/constants.d.ts +0 -18
- data/node_modules/@types/node/crypto.d.ts +0 -3224
- data/node_modules/@types/node/dgram.d.ts +0 -545
- data/node_modules/@types/node/diagnostics_channel.d.ts +0 -128
- data/node_modules/@types/node/dns/promises.d.ts +0 -357
- data/node_modules/@types/node/dns.d.ts +0 -643
- data/node_modules/@types/node/domain.d.ts +0 -169
- data/node_modules/@types/node/events.d.ts +0 -623
- data/node_modules/@types/node/fs/promises.d.ts +0 -997
- data/node_modules/@types/node/fs.d.ts +0 -3723
- data/node_modules/@types/node/globals.d.ts +0 -285
- data/node_modules/@types/node/globals.global.d.ts +0 -1
- data/node_modules/@types/node/http.d.ts +0 -1358
- data/node_modules/@types/node/http2.d.ts +0 -2100
- data/node_modules/@types/node/https.d.ts +0 -391
- data/node_modules/@types/node/index.d.ts +0 -131
- data/node_modules/@types/node/inspector.d.ts +0 -2738
- data/node_modules/@types/node/module.d.ts +0 -114
- data/node_modules/@types/node/net.d.ts +0 -783
- data/node_modules/@types/node/os.d.ts +0 -455
- data/node_modules/@types/node/package.json +0 -230
- data/node_modules/@types/node/path.d.ts +0 -172
- data/node_modules/@types/node/perf_hooks.d.ts +0 -555
- data/node_modules/@types/node/process.d.ts +0 -1477
- data/node_modules/@types/node/punycode.d.ts +0 -117
- data/node_modules/@types/node/querystring.d.ts +0 -131
- data/node_modules/@types/node/readline.d.ts +0 -542
- data/node_modules/@types/node/repl.d.ts +0 -424
- data/node_modules/@types/node/stream/consumers.d.ts +0 -24
- data/node_modules/@types/node/stream/promises.d.ts +0 -42
- data/node_modules/@types/node/stream/web.d.ts +0 -6
- data/node_modules/@types/node/stream.d.ts +0 -1181
- data/node_modules/@types/node/string_decoder.d.ts +0 -67
- data/node_modules/@types/node/timers/promises.d.ts +0 -68
- data/node_modules/@types/node/timers.d.ts +0 -94
- data/node_modules/@types/node/tls.d.ts +0 -1019
- data/node_modules/@types/node/trace_events.d.ts +0 -161
- data/node_modules/@types/node/tty.d.ts +0 -206
- data/node_modules/@types/node/url.d.ts +0 -798
- data/node_modules/@types/node/util.d.ts +0 -1556
- data/node_modules/@types/node/v8.d.ts +0 -378
- data/node_modules/@types/node/vm.d.ts +0 -504
- data/node_modules/@types/node/wasi.d.ts +0 -153
- data/node_modules/@types/node/worker_threads.d.ts +0 -649
- data/node_modules/@types/node/zlib.d.ts +0 -517
- data/node_modules/@types/yauzl/LICENSE +0 -21
- data/node_modules/@types/yauzl/README.md +0 -16
- data/node_modules/@types/yauzl/index.d.ts +0 -98
- data/node_modules/@types/yauzl/package.json +0 -27
- data/node_modules/agent-base/README.md +0 -145
- data/node_modules/agent-base/dist/src/index.d.ts +0 -78
- data/node_modules/agent-base/dist/src/index.js +0 -203
- data/node_modules/agent-base/dist/src/index.js.map +0 -1
- data/node_modules/agent-base/dist/src/promisify.d.ts +0 -4
- data/node_modules/agent-base/dist/src/promisify.js +0 -18
- data/node_modules/agent-base/dist/src/promisify.js.map +0 -1
- data/node_modules/agent-base/package.json +0 -64
- data/node_modules/agent-base/src/index.ts +0 -345
- data/node_modules/agent-base/src/promisify.ts +0 -33
- data/node_modules/balanced-match/.github/FUNDING.yml +0 -2
- data/node_modules/balanced-match/LICENSE.md +0 -21
- data/node_modules/balanced-match/README.md +0 -97
- data/node_modules/balanced-match/index.js +0 -62
- data/node_modules/balanced-match/package.json +0 -48
- data/node_modules/base64-js/LICENSE +0 -21
- data/node_modules/base64-js/README.md +0 -34
- data/node_modules/base64-js/base64js.min.js +0 -1
- data/node_modules/base64-js/index.d.ts +0 -3
- data/node_modules/base64-js/index.js +0 -150
- data/node_modules/base64-js/package.json +0 -47
- data/node_modules/bl/.travis.yml +0 -17
- data/node_modules/bl/BufferList.js +0 -396
- data/node_modules/bl/LICENSE.md +0 -13
- data/node_modules/bl/README.md +0 -247
- data/node_modules/bl/bl.js +0 -84
- data/node_modules/bl/package.json +0 -37
- data/node_modules/bl/test/convert.js +0 -21
- data/node_modules/bl/test/indexOf.js +0 -492
- data/node_modules/bl/test/isBufferList.js +0 -32
- data/node_modules/bl/test/test.js +0 -869
- data/node_modules/brace-expansion/LICENSE +0 -21
- data/node_modules/brace-expansion/README.md +0 -129
- data/node_modules/brace-expansion/index.js +0 -201
- data/node_modules/brace-expansion/package.json +0 -47
- data/node_modules/buffer/AUTHORS.md +0 -70
- data/node_modules/buffer/LICENSE +0 -21
- data/node_modules/buffer/README.md +0 -410
- data/node_modules/buffer/index.d.ts +0 -186
- data/node_modules/buffer/index.js +0 -1817
- data/node_modules/buffer/package.json +0 -96
- data/node_modules/buffer-crc32/LICENSE +0 -19
- data/node_modules/buffer-crc32/README.md +0 -47
- data/node_modules/buffer-crc32/index.js +0 -111
- data/node_modules/buffer-crc32/package.json +0 -39
- data/node_modules/chownr/LICENSE +0 -15
- data/node_modules/chownr/README.md +0 -3
- data/node_modules/chownr/chownr.js +0 -167
- data/node_modules/chownr/package.json +0 -29
- data/node_modules/concat-map/.travis.yml +0 -4
- data/node_modules/concat-map/LICENSE +0 -18
- data/node_modules/concat-map/README.markdown +0 -62
- data/node_modules/concat-map/example/map.js +0 -6
- data/node_modules/concat-map/index.js +0 -13
- data/node_modules/concat-map/package.json +0 -43
- data/node_modules/concat-map/test/map.js +0 -39
- data/node_modules/debug/LICENSE +0 -19
- data/node_modules/debug/README.md +0 -455
- data/node_modules/debug/package.json +0 -59
- data/node_modules/debug/src/browser.js +0 -269
- data/node_modules/debug/src/common.js +0 -274
- data/node_modules/debug/src/index.js +0 -10
- data/node_modules/debug/src/node.js +0 -263
- data/node_modules/devtools-protocol/LICENSE +0 -27
- data/node_modules/devtools-protocol/README.md +0 -12
- data/node_modules/devtools-protocol/json/browser_protocol.json +0 -20986
- data/node_modules/devtools-protocol/json/js_protocol.json +0 -3532
- data/node_modules/devtools-protocol/package.json +0 -17
- data/node_modules/devtools-protocol/pdl/browser_protocol.pdl +0 -9849
- data/node_modules/devtools-protocol/pdl/js_protocol.pdl +0 -1653
- data/node_modules/devtools-protocol/types/protocol-mapping.d.ts +0 -4333
- data/node_modules/devtools-protocol/types/protocol-proxy-api.d.ts +0 -3695
- data/node_modules/devtools-protocol/types/protocol.d.ts +0 -15714
- data/node_modules/end-of-stream/LICENSE +0 -21
- data/node_modules/end-of-stream/README.md +0 -54
- data/node_modules/end-of-stream/index.js +0 -94
- data/node_modules/end-of-stream/package.json +0 -37
- data/node_modules/extract-zip/LICENSE +0 -23
- data/node_modules/extract-zip/cli.js +0 -19
- data/node_modules/extract-zip/index.d.ts +0 -21
- data/node_modules/extract-zip/index.js +0 -173
- data/node_modules/extract-zip/package.json +0 -80
- data/node_modules/extract-zip/readme.md +0 -57
- data/node_modules/fd-slicer/.npmignore +0 -2
- data/node_modules/fd-slicer/.travis.yml +0 -7
- data/node_modules/fd-slicer/CHANGELOG.md +0 -49
- data/node_modules/fd-slicer/LICENSE +0 -21
- data/node_modules/fd-slicer/README.md +0 -199
- data/node_modules/fd-slicer/index.js +0 -296
- data/node_modules/fd-slicer/package.json +0 -36
- data/node_modules/fd-slicer/test/test.js +0 -350
- data/node_modules/find-up/index.d.ts +0 -137
- data/node_modules/find-up/index.js +0 -89
- data/node_modules/find-up/license +0 -9
- data/node_modules/find-up/package.json +0 -53
- data/node_modules/find-up/readme.md +0 -156
- data/node_modules/fs-constants/LICENSE +0 -21
- data/node_modules/fs-constants/README.md +0 -26
- data/node_modules/fs-constants/browser.js +0 -1
- data/node_modules/fs-constants/index.js +0 -1
- data/node_modules/fs-constants/package.json +0 -19
- data/node_modules/fs.realpath/LICENSE +0 -43
- data/node_modules/fs.realpath/README.md +0 -33
- data/node_modules/fs.realpath/index.js +0 -66
- data/node_modules/fs.realpath/old.js +0 -303
- data/node_modules/fs.realpath/package.json +0 -26
- data/node_modules/get-stream/buffer-stream.js +0 -52
- data/node_modules/get-stream/index.d.ts +0 -108
- data/node_modules/get-stream/index.js +0 -60
- data/node_modules/get-stream/license +0 -9
- data/node_modules/get-stream/package.json +0 -50
- data/node_modules/get-stream/readme.md +0 -124
- data/node_modules/glob/LICENSE +0 -21
- data/node_modules/glob/README.md +0 -375
- data/node_modules/glob/changelog.md +0 -67
- data/node_modules/glob/common.js +0 -234
- data/node_modules/glob/glob.js +0 -788
- data/node_modules/glob/package.json +0 -51
- data/node_modules/glob/sync.js +0 -484
- data/node_modules/https-proxy-agent/README.md +0 -137
- data/node_modules/https-proxy-agent/dist/agent.d.ts +0 -30
- data/node_modules/https-proxy-agent/dist/agent.js +0 -180
- data/node_modules/https-proxy-agent/dist/agent.js.map +0 -1
- data/node_modules/https-proxy-agent/dist/index.d.ts +0 -23
- data/node_modules/https-proxy-agent/dist/index.js +0 -14
- data/node_modules/https-proxy-agent/dist/index.js.map +0 -1
- data/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts +0 -7
- data/node_modules/https-proxy-agent/dist/parse-proxy-response.js +0 -66
- data/node_modules/https-proxy-agent/dist/parse-proxy-response.js.map +0 -1
- data/node_modules/https-proxy-agent/package.json +0 -56
- data/node_modules/ieee754/LICENSE +0 -11
- data/node_modules/ieee754/README.md +0 -51
- data/node_modules/ieee754/index.d.ts +0 -10
- data/node_modules/ieee754/index.js +0 -85
- data/node_modules/ieee754/package.json +0 -52
- data/node_modules/inflight/LICENSE +0 -15
- data/node_modules/inflight/README.md +0 -37
- data/node_modules/inflight/inflight.js +0 -54
- data/node_modules/inflight/package.json +0 -29
- data/node_modules/inherits/LICENSE +0 -16
- data/node_modules/inherits/README.md +0 -42
- data/node_modules/inherits/inherits.js +0 -9
- data/node_modules/inherits/inherits_browser.js +0 -27
- data/node_modules/inherits/package.json +0 -29
- data/node_modules/locate-path/index.d.ts +0 -83
- data/node_modules/locate-path/index.js +0 -65
- data/node_modules/locate-path/license +0 -9
- data/node_modules/locate-path/package.json +0 -45
- data/node_modules/locate-path/readme.md +0 -122
- data/node_modules/minimatch/LICENSE +0 -15
- data/node_modules/minimatch/README.md +0 -209
- data/node_modules/minimatch/minimatch.js +0 -923
- data/node_modules/minimatch/package.json +0 -30
- data/node_modules/mkdirp-classic/LICENSE +0 -21
- data/node_modules/mkdirp-classic/README.md +0 -18
- data/node_modules/mkdirp-classic/index.js +0 -98
- data/node_modules/mkdirp-classic/package.json +0 -18
- data/node_modules/ms/index.js +0 -162
- data/node_modules/ms/license.md +0 -21
- data/node_modules/ms/package.json +0 -37
- data/node_modules/ms/readme.md +0 -60
- data/node_modules/node-fetch/LICENSE.md +0 -22
- data/node_modules/node-fetch/README.md +0 -590
- data/node_modules/node-fetch/browser.js +0 -25
- data/node_modules/node-fetch/lib/index.es.js +0 -1662
- data/node_modules/node-fetch/lib/index.js +0 -1671
- data/node_modules/node-fetch/lib/index.mjs +0 -1660
- data/node_modules/node-fetch/package.json +0 -68
- data/node_modules/once/LICENSE +0 -15
- data/node_modules/once/README.md +0 -79
- data/node_modules/once/once.js +0 -42
- data/node_modules/once/package.json +0 -33
- data/node_modules/p-limit/index.d.ts +0 -38
- data/node_modules/p-limit/index.js +0 -57
- data/node_modules/p-limit/license +0 -9
- data/node_modules/p-limit/package.json +0 -52
- data/node_modules/p-limit/readme.md +0 -101
- data/node_modules/p-locate/index.d.ts +0 -64
- data/node_modules/p-locate/index.js +0 -52
- data/node_modules/p-locate/license +0 -9
- data/node_modules/p-locate/package.json +0 -53
- data/node_modules/p-locate/readme.md +0 -90
- data/node_modules/p-try/index.d.ts +0 -39
- data/node_modules/p-try/index.js +0 -9
- data/node_modules/p-try/license +0 -9
- data/node_modules/p-try/package.json +0 -42
- data/node_modules/p-try/readme.md +0 -58
- data/node_modules/path-exists/index.d.ts +0 -28
- data/node_modules/path-exists/index.js +0 -23
- data/node_modules/path-exists/license +0 -9
- data/node_modules/path-exists/package.json +0 -39
- data/node_modules/path-exists/readme.md +0 -52
- data/node_modules/path-is-absolute/index.js +0 -20
- data/node_modules/path-is-absolute/license +0 -21
- data/node_modules/path-is-absolute/package.json +0 -43
- data/node_modules/path-is-absolute/readme.md +0 -59
- data/node_modules/pend/LICENSE +0 -23
- data/node_modules/pend/README.md +0 -41
- data/node_modules/pend/index.js +0 -55
- data/node_modules/pend/package.json +0 -18
- data/node_modules/pend/test.js +0 -137
- data/node_modules/pkg-dir/index.d.ts +0 -44
- data/node_modules/pkg-dir/index.js +0 -17
- data/node_modules/pkg-dir/license +0 -9
- data/node_modules/pkg-dir/package.json +0 -56
- data/node_modules/pkg-dir/readme.md +0 -66
- data/node_modules/progress/CHANGELOG.md +0 -115
- data/node_modules/progress/LICENSE +0 -22
- data/node_modules/progress/Makefile +0 -8
- data/node_modules/progress/Readme.md +0 -146
- data/node_modules/progress/index.js +0 -1
- data/node_modules/progress/lib/node-progress.js +0 -236
- data/node_modules/progress/package.json +0 -26
- data/node_modules/proxy-from-env/.eslintrc +0 -29
- data/node_modules/proxy-from-env/.travis.yml +0 -10
- data/node_modules/proxy-from-env/LICENSE +0 -20
- data/node_modules/proxy-from-env/README.md +0 -131
- data/node_modules/proxy-from-env/index.js +0 -108
- data/node_modules/proxy-from-env/package.json +0 -34
- data/node_modules/proxy-from-env/test.js +0 -483
- data/node_modules/pump/.travis.yml +0 -5
- data/node_modules/pump/LICENSE +0 -21
- data/node_modules/pump/README.md +0 -65
- data/node_modules/pump/index.js +0 -82
- data/node_modules/pump/package.json +0 -24
- data/node_modules/pump/test-browser.js +0 -66
- data/node_modules/pump/test-node.js +0 -53
- data/node_modules/puppeteer-core/CHANGELOG.md +0 -319
- data/node_modules/puppeteer-core/LICENSE +0 -202
- data/node_modules/puppeteer-core/README.md +0 -481
- data/node_modules/puppeteer-core/cjs-entry-core.js +0 -29
- data/node_modules/puppeteer-core/cjs-entry.js +0 -29
- data/node_modules/puppeteer-core/install.js +0 -89
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/api-docs-entry.d.ts +0 -111
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/api-docs-entry.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/api-docs-entry.js +0 -81
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/api-docs-entry.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Accessibility.d.ts +0 -176
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Accessibility.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Accessibility.js +0 -361
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Accessibility.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/AriaQueryHandler.d.ts +0 -21
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/AriaQueryHandler.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/AriaQueryHandler.js +0 -85
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/AriaQueryHandler.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Browser.d.ts +0 -456
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Browser.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Browser.js +0 -541
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Browser.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/BrowserConnector.d.ts +0 -54
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/BrowserConnector.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/BrowserConnector.js +0 -98
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/BrowserConnector.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/BrowserWebSocketTransport.d.ts +0 -26
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/BrowserWebSocketTransport.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/BrowserWebSocketTransport.js +0 -35
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/BrowserWebSocketTransport.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.d.ts +0 -136
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js +0 -299
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ConnectionTransport.d.ts +0 -25
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ConnectionTransport.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ConnectionTransport.js +0 -18
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ConnectionTransport.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ConsoleMessage.d.ts +0 -73
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ConsoleMessage.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ConsoleMessage.js +0 -65
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ConsoleMessage.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Coverage.d.ts +0 -205
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Coverage.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Coverage.js +0 -336
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Coverage.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/DOMWorld.d.ts +0 -176
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/DOMWorld.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/DOMWorld.js +0 -663
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/DOMWorld.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Debug.d.ts +0 -53
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Debug.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Debug.js +0 -82
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Debug.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/DeviceDescriptors.d.ts +0 -41
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/DeviceDescriptors.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/DeviceDescriptors.js +0 -1071
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/DeviceDescriptors.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Dialog.d.ts +0 -75
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Dialog.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Dialog.js +0 -98
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Dialog.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EmulationManager.d.ts +0 -25
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EmulationManager.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EmulationManager.js +0 -38
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EmulationManager.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Errors.d.ts +0 -51
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Errors.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Errors.js +0 -57
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Errors.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EvalTypes.d.ts +0 -61
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EvalTypes.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EvalTypes.js +0 -18
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EvalTypes.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EventEmitter.d.ts +0 -93
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EventEmitter.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EventEmitter.js +0 -117
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EventEmitter.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Events.d.ts +0 -82
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Events.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Events.js +0 -87
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Events.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ExecutionContext.d.ts +0 -194
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ExecutionContext.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ExecutionContext.js +0 -322
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ExecutionContext.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/FileChooser.d.ts +0 -59
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/FileChooser.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/FileChooser.js +0 -72
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/FileChooser.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/FrameManager.d.ts +0 -745
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/FrameManager.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/FrameManager.js +0 -1048
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/FrameManager.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/HTTPRequest.d.ts +0 -351
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/HTTPRequest.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/HTTPRequest.js +0 -550
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/HTTPRequest.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/HTTPResponse.d.ts +0 -135
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/HTTPResponse.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/HTTPResponse.js +0 -185
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/HTTPResponse.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Input.d.ts +0 -359
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Input.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Input.js +0 -544
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Input.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/JSHandle.d.ts +0 -491
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/JSHandle.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/JSHandle.js +0 -828
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/JSHandle.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/LifecycleWatcher.d.ts +0 -66
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/LifecycleWatcher.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/LifecycleWatcher.js +0 -150
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/LifecycleWatcher.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/NetworkConditions.d.ts +0 -27
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/NetworkConditions.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/NetworkConditions.js +0 -34
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/NetworkConditions.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/NetworkManager.d.ts +0 -127
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/NetworkManager.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/NetworkManager.js +0 -468
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/NetworkManager.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/PDFOptions.d.ts +0 -162
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/PDFOptions.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/PDFOptions.js +0 -35
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/PDFOptions.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Page.d.ts +0 -2056
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Page.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Page.js +0 -2534
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Page.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Product.d.ts +0 -21
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Product.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Product.js +0 -18
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Product.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Puppeteer.d.ts +0 -160
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Puppeteer.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Puppeteer.js +0 -162
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Puppeteer.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/PuppeteerViewport.d.ts +0 -52
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/PuppeteerViewport.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/PuppeteerViewport.js +0 -3
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/PuppeteerViewport.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/QueryHandler.d.ts +0 -65
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/QueryHandler.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/QueryHandler.js +0 -166
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/QueryHandler.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/SecurityDetails.d.ts +0 -61
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/SecurityDetails.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/SecurityDetails.js +0 -77
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/SecurityDetails.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Target.d.ts +0 -101
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Target.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Target.js +0 -146
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Target.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/TaskQueue.d.ts +0 -21
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/TaskQueue.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/TaskQueue.js +0 -30
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/TaskQueue.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/TimeoutSettings.d.ts +0 -28
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/TimeoutSettings.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/TimeoutSettings.js +0 -48
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/TimeoutSettings.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Tracing.d.ts +0 -47
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Tracing.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Tracing.js +0 -110
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Tracing.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/USKeyboardLayout.d.ts +0 -40
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/USKeyboardLayout.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/USKeyboardLayout.js +0 -407
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/USKeyboardLayout.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/WebWorker.d.ts +0 -99
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/WebWorker.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/WebWorker.js +0 -113
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/WebWorker.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/assert.d.ts +0 -23
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/assert.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/assert.js +0 -34
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/assert.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/fetch.d.ts +0 -17
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/fetch.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/fetch.js +0 -44
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/fetch.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/helper.d.ts +0 -85
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/helper.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/helper.js +0 -328
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/helper.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/environment.d.ts +0 -17
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/environment.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/environment.js +0 -20
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/environment.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/global.d.ts +0 -17
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/global.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/global.js +0 -3
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/global.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/initialize-node.d.ts +0 -18
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/initialize-node.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/initialize-node.js +0 -45
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/initialize-node.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/initialize-web.d.ts +0 -18
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/initialize-web.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/initialize-web.js +0 -27
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/initialize-web.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserFetcher.d.ts +0 -134
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserFetcher.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserFetcher.js +0 -501
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserFetcher.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.d.ts +0 -41
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.js +0 -257
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/LaunchOptions.d.ts +0 -135
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/LaunchOptions.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/LaunchOptions.js +0 -18
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/LaunchOptions.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/Launcher.d.ts +0 -17
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/Launcher.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/Launcher.js +0 -656
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/Launcher.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/NodeWebSocketTransport.d.ts +0 -27
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/NodeWebSocketTransport.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/NodeWebSocketTransport.js +0 -48
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/NodeWebSocketTransport.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/PipeTransport.d.ts +0 -30
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/PipeTransport.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/PipeTransport.js +0 -65
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/PipeTransport.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/Puppeteer.d.ts +0 -154
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/Puppeteer.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/Puppeteer.js +0 -189
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/Puppeteer.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/install.d.ts +0 -18
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/install.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/install.js +0 -174
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/install.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node-puppeteer-core.d.ts +0 -18
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node-puppeteer-core.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node-puppeteer-core.js +0 -25
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node-puppeteer-core.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node.d.ts +0 -18
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node.js +0 -24
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/revisions.d.ts +0 -22
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/revisions.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/revisions.js +0 -23
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/revisions.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/web.d.ts +0 -18
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/web.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/web.js +0 -24
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/web.js.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/vendor/mitt/src/index.d.ts +0 -28
- data/node_modules/puppeteer-core/lib/cjs/vendor/mitt/src/index.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/cjs/vendor/mitt/src/index.js +0 -57
- data/node_modules/puppeteer-core/lib/cjs/vendor/mitt/src/index.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/api-docs-entry.d.ts +0 -111
- data/node_modules/puppeteer-core/lib/esm/puppeteer/api-docs-entry.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/api-docs-entry.js +0 -81
- data/node_modules/puppeteer-core/lib/esm/puppeteer/api-docs-entry.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Accessibility.d.ts +0 -176
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Accessibility.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Accessibility.js +0 -357
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Accessibility.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/AriaQueryHandler.d.ts +0 -21
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/AriaQueryHandler.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/AriaQueryHandler.js +0 -82
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/AriaQueryHandler.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Browser.d.ts +0 -456
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Browser.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Browser.js +0 -536
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Browser.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/BrowserConnector.d.ts +0 -54
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/BrowserConnector.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/BrowserConnector.js +0 -75
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/BrowserConnector.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/BrowserWebSocketTransport.d.ts +0 -26
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/BrowserWebSocketTransport.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/BrowserWebSocketTransport.js +0 -31
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/BrowserWebSocketTransport.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Connection.d.ts +0 -136
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Connection.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Connection.js +0 -294
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Connection.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/ConnectionTransport.d.ts +0 -25
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/ConnectionTransport.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/ConnectionTransport.js +0 -17
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/ConnectionTransport.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/ConsoleMessage.d.ts +0 -73
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/ConsoleMessage.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/ConsoleMessage.js +0 -61
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/ConsoleMessage.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Coverage.d.ts +0 -205
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Coverage.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Coverage.js +0 -330
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Coverage.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/DOMWorld.d.ts +0 -176
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/DOMWorld.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/DOMWorld.js +0 -658
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/DOMWorld.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Debug.d.ts +0 -53
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Debug.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Debug.js +0 -78
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Debug.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/DeviceDescriptors.d.ts +0 -41
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/DeviceDescriptors.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/DeviceDescriptors.js +0 -1068
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/DeviceDescriptors.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Dialog.d.ts +0 -75
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Dialog.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Dialog.js +0 -94
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Dialog.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/EmulationManager.d.ts +0 -25
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/EmulationManager.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/EmulationManager.js +0 -34
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/EmulationManager.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Errors.d.ts +0 -51
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Errors.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Errors.js +0 -51
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Errors.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/EvalTypes.d.ts +0 -61
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/EvalTypes.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/EvalTypes.js +0 -17
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/EvalTypes.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/EventEmitter.d.ts +0 -93
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/EventEmitter.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/EventEmitter.js +0 -110
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/EventEmitter.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Events.d.ts +0 -82
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Events.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Events.js +0 -84
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Events.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/ExecutionContext.d.ts +0 -194
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/ExecutionContext.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/ExecutionContext.js +0 -318
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/ExecutionContext.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/FileChooser.d.ts +0 -59
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/FileChooser.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/FileChooser.js +0 -68
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/FileChooser.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/FrameManager.d.ts +0 -745
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/FrameManager.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/FrameManager.js +0 -1043
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/FrameManager.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/HTTPRequest.d.ts +0 -351
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/HTTPRequest.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/HTTPRequest.js +0 -546
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/HTTPRequest.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/HTTPResponse.d.ts +0 -135
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/HTTPResponse.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/HTTPResponse.js +0 -181
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/HTTPResponse.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Input.d.ts +0 -359
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Input.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Input.js +0 -538
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Input.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/JSHandle.d.ts +0 -491
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/JSHandle.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/JSHandle.js +0 -803
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/JSHandle.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/LifecycleWatcher.d.ts +0 -66
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/LifecycleWatcher.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/LifecycleWatcher.js +0 -146
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/LifecycleWatcher.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/NetworkConditions.d.ts +0 -27
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/NetworkConditions.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/NetworkConditions.js +0 -31
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/NetworkConditions.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/NetworkManager.d.ts +0 -127
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/NetworkManager.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/NetworkManager.js +0 -464
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/NetworkManager.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/PDFOptions.d.ts +0 -162
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/PDFOptions.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/PDFOptions.js +0 -32
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/PDFOptions.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Page.d.ts +0 -2056
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Page.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Page.js +0 -2530
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Page.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Product.d.ts +0 -21
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Product.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Product.js +0 -17
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Product.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Puppeteer.d.ts +0 -160
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Puppeteer.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Puppeteer.js +0 -158
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Puppeteer.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/PuppeteerViewport.d.ts +0 -52
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/PuppeteerViewport.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/PuppeteerViewport.js +0 -2
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/PuppeteerViewport.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/QueryHandler.d.ts +0 -65
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/QueryHandler.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/QueryHandler.js +0 -158
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/QueryHandler.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/SecurityDetails.d.ts +0 -61
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/SecurityDetails.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/SecurityDetails.js +0 -73
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/SecurityDetails.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Target.d.ts +0 -101
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Target.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Target.js +0 -142
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Target.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/TaskQueue.d.ts +0 -21
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/TaskQueue.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/TaskQueue.js +0 -26
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/TaskQueue.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/TimeoutSettings.d.ts +0 -28
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/TimeoutSettings.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/TimeoutSettings.js +0 -44
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/TimeoutSettings.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Tracing.d.ts +0 -47
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Tracing.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Tracing.js +0 -106
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Tracing.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/USKeyboardLayout.d.ts +0 -40
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/USKeyboardLayout.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/USKeyboardLayout.js +0 -404
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/USKeyboardLayout.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/WebWorker.d.ts +0 -99
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/WebWorker.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/WebWorker.js +0 -109
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/WebWorker.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/assert.d.ts +0 -23
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/assert.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/assert.js +0 -29
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/assert.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/fetch.d.ts +0 -17
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/fetch.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/fetch.js +0 -21
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/fetch.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/helper.d.ts +0 -85
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/helper.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/helper.js +0 -306
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/helper.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/environment.d.ts +0 -17
- data/node_modules/puppeteer-core/lib/esm/puppeteer/environment.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/environment.js +0 -17
- data/node_modules/puppeteer-core/lib/esm/puppeteer/environment.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/global.d.ts +0 -17
- data/node_modules/puppeteer-core/lib/esm/puppeteer/global.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/global.js +0 -2
- data/node_modules/puppeteer-core/lib/esm/puppeteer/global.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/initialize-node.d.ts +0 -18
- data/node_modules/puppeteer-core/lib/esm/puppeteer/initialize-node.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/initialize-node.js +0 -38
- data/node_modules/puppeteer-core/lib/esm/puppeteer/initialize-node.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/initialize-web.d.ts +0 -18
- data/node_modules/puppeteer-core/lib/esm/puppeteer/initialize-web.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/initialize-web.js +0 -23
- data/node_modules/puppeteer-core/lib/esm/puppeteer/initialize-web.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserFetcher.d.ts +0 -134
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserFetcher.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserFetcher.js +0 -475
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserFetcher.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserRunner.d.ts +0 -41
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserRunner.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserRunner.js +0 -231
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserRunner.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/LaunchOptions.d.ts +0 -135
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/LaunchOptions.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/LaunchOptions.js +0 -17
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/LaunchOptions.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/Launcher.d.ts +0 -17
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/Launcher.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/Launcher.js +0 -634
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/Launcher.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/NodeWebSocketTransport.d.ts +0 -27
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/NodeWebSocketTransport.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/NodeWebSocketTransport.js +0 -41
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/NodeWebSocketTransport.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/PipeTransport.d.ts +0 -30
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/PipeTransport.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/PipeTransport.js +0 -61
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/PipeTransport.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/Puppeteer.d.ts +0 -154
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/Puppeteer.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/Puppeteer.js +0 -182
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/Puppeteer.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/install.d.ts +0 -18
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/install.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/install.js +0 -166
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/install.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node-puppeteer-core.d.ts +0 -18
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node-puppeteer-core.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node-puppeteer-core.js +0 -23
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node-puppeteer-core.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node.d.ts +0 -18
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node.js +0 -22
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/revisions.d.ts +0 -22
- data/node_modules/puppeteer-core/lib/esm/puppeteer/revisions.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/revisions.js +0 -20
- data/node_modules/puppeteer-core/lib/esm/puppeteer/revisions.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/web.d.ts +0 -18
- data/node_modules/puppeteer-core/lib/esm/puppeteer/web.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/web.js +0 -22
- data/node_modules/puppeteer-core/lib/esm/puppeteer/web.js.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/vendor/mitt/src/index.d.ts +0 -28
- data/node_modules/puppeteer-core/lib/esm/vendor/mitt/src/index.d.ts.map +0 -1
- data/node_modules/puppeteer-core/lib/esm/vendor/mitt/src/index.js +0 -54
- data/node_modules/puppeteer-core/lib/esm/vendor/mitt/src/index.js.map +0 -1
- data/node_modules/puppeteer-core/lib/types.d.ts +0 -7141
- data/node_modules/puppeteer-core/package.json +0 -116
- data/node_modules/puppeteer-core/typescript-if-required.js +0 -61
- data/node_modules/readable-stream/CONTRIBUTING.md +0 -38
- data/node_modules/readable-stream/GOVERNANCE.md +0 -136
- data/node_modules/readable-stream/LICENSE +0 -47
- data/node_modules/readable-stream/README.md +0 -106
- data/node_modules/readable-stream/errors-browser.js +0 -127
- data/node_modules/readable-stream/errors.js +0 -116
- data/node_modules/readable-stream/experimentalWarning.js +0 -17
- data/node_modules/readable-stream/lib/_stream_duplex.js +0 -139
- data/node_modules/readable-stream/lib/_stream_passthrough.js +0 -39
- data/node_modules/readable-stream/lib/_stream_readable.js +0 -1124
- data/node_modules/readable-stream/lib/_stream_transform.js +0 -201
- data/node_modules/readable-stream/lib/_stream_writable.js +0 -697
- data/node_modules/readable-stream/lib/internal/streams/async_iterator.js +0 -207
- data/node_modules/readable-stream/lib/internal/streams/buffer_list.js +0 -210
- data/node_modules/readable-stream/lib/internal/streams/destroy.js +0 -105
- data/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +0 -104
- data/node_modules/readable-stream/lib/internal/streams/from-browser.js +0 -3
- data/node_modules/readable-stream/lib/internal/streams/from.js +0 -64
- data/node_modules/readable-stream/lib/internal/streams/pipeline.js +0 -97
- data/node_modules/readable-stream/lib/internal/streams/state.js +0 -27
- data/node_modules/readable-stream/lib/internal/streams/stream-browser.js +0 -1
- data/node_modules/readable-stream/lib/internal/streams/stream.js +0 -1
- data/node_modules/readable-stream/package.json +0 -68
- data/node_modules/readable-stream/readable-browser.js +0 -9
- data/node_modules/readable-stream/readable.js +0 -16
- data/node_modules/rimraf/CHANGELOG.md +0 -65
- data/node_modules/rimraf/LICENSE +0 -15
- data/node_modules/rimraf/README.md +0 -101
- data/node_modules/rimraf/bin.js +0 -68
- data/node_modules/rimraf/package.json +0 -32
- data/node_modules/rimraf/rimraf.js +0 -360
- data/node_modules/safe-buffer/LICENSE +0 -21
- data/node_modules/safe-buffer/README.md +0 -584
- data/node_modules/safe-buffer/index.d.ts +0 -187
- data/node_modules/safe-buffer/index.js +0 -65
- data/node_modules/safe-buffer/package.json +0 -51
- data/node_modules/string_decoder/LICENSE +0 -48
- data/node_modules/string_decoder/README.md +0 -47
- data/node_modules/string_decoder/lib/string_decoder.js +0 -296
- data/node_modules/string_decoder/package.json +0 -34
- data/node_modules/tar-fs/.travis.yml +0 -6
- data/node_modules/tar-fs/LICENSE +0 -21
- data/node_modules/tar-fs/README.md +0 -165
- data/node_modules/tar-fs/index.js +0 -351
- data/node_modules/tar-fs/package.json +0 -41
- data/node_modules/tar-fs/test/fixtures/a/hello.txt +0 -1
- data/node_modules/tar-fs/test/fixtures/b/a/test.txt +0 -1
- data/node_modules/tar-fs/test/fixtures/d/file1 +0 -0
- data/node_modules/tar-fs/test/fixtures/d/file2 +0 -0
- data/node_modules/tar-fs/test/fixtures/d/sub-dir/file5 +0 -0
- data/node_modules/tar-fs/test/fixtures/d/sub-files/file3 +0 -0
- data/node_modules/tar-fs/test/fixtures/d/sub-files/file4 +0 -0
- data/node_modules/tar-fs/test/fixtures/e/directory/.ignore +0 -0
- data/node_modules/tar-fs/test/fixtures/e/file +0 -0
- data/node_modules/tar-fs/test/fixtures/invalid.tar +0 -0
- data/node_modules/tar-fs/test/index.js +0 -346
- data/node_modules/tar-stream/LICENSE +0 -21
- data/node_modules/tar-stream/README.md +0 -168
- data/node_modules/tar-stream/extract.js +0 -257
- data/node_modules/tar-stream/headers.js +0 -295
- data/node_modules/tar-stream/index.js +0 -2
- data/node_modules/tar-stream/pack.js +0 -255
- data/node_modules/tar-stream/package.json +0 -58
- data/node_modules/tar-stream/sandbox.js +0 -11
- data/node_modules/through/.travis.yml +0 -5
- data/node_modules/through/LICENSE.APACHE2 +0 -15
- data/node_modules/through/LICENSE.MIT +0 -24
- data/node_modules/through/index.js +0 -108
- data/node_modules/through/package.json +0 -36
- data/node_modules/through/readme.markdown +0 -64
- data/node_modules/through/test/async.js +0 -28
- data/node_modules/through/test/auto-destroy.js +0 -30
- data/node_modules/through/test/buffering.js +0 -71
- data/node_modules/through/test/end.js +0 -45
- data/node_modules/through/test/index.js +0 -133
- data/node_modules/tr46/.npmignore +0 -4
- data/node_modules/tr46/index.js +0 -193
- data/node_modules/tr46/lib/.gitkeep +0 -0
- data/node_modules/tr46/lib/mappingTable.json +0 -1
- data/node_modules/tr46/package.json +0 -31
- data/node_modules/unbzip2-stream/LICENSE +0 -24
- data/node_modules/unbzip2-stream/README.md +0 -59
- data/node_modules/unbzip2-stream/dist/unbzip2-stream.min.js +0 -1
- data/node_modules/unbzip2-stream/index.js +0 -93
- data/node_modules/unbzip2-stream/lib/bit_iterator.js +0 -39
- data/node_modules/unbzip2-stream/lib/bzip2.js +0 -365
- data/node_modules/unbzip2-stream/package.json +0 -51
- data/node_modules/util-deprecate/History.md +0 -16
- data/node_modules/util-deprecate/LICENSE +0 -24
- data/node_modules/util-deprecate/README.md +0 -53
- data/node_modules/util-deprecate/browser.js +0 -67
- data/node_modules/util-deprecate/node.js +0 -6
- data/node_modules/util-deprecate/package.json +0 -27
- data/node_modules/webidl-conversions/LICENSE.md +0 -12
- data/node_modules/webidl-conversions/README.md +0 -53
- data/node_modules/webidl-conversions/lib/index.js +0 -189
- data/node_modules/webidl-conversions/package.json +0 -23
- data/node_modules/whatwg-url/LICENSE.txt +0 -21
- data/node_modules/whatwg-url/README.md +0 -67
- data/node_modules/whatwg-url/lib/URL-impl.js +0 -200
- data/node_modules/whatwg-url/lib/URL.js +0 -196
- data/node_modules/whatwg-url/lib/public-api.js +0 -11
- data/node_modules/whatwg-url/lib/url-state-machine.js +0 -1297
- data/node_modules/whatwg-url/lib/utils.js +0 -20
- data/node_modules/whatwg-url/package.json +0 -32
- data/node_modules/wrappy/LICENSE +0 -15
- data/node_modules/wrappy/README.md +0 -36
- data/node_modules/wrappy/package.json +0 -29
- data/node_modules/wrappy/wrappy.js +0 -33
- data/node_modules/ws/LICENSE +0 -19
- data/node_modules/ws/README.md +0 -493
- data/node_modules/ws/browser.js +0 -8
- data/node_modules/ws/index.js +0 -13
- data/node_modules/ws/lib/buffer-util.js +0 -126
- data/node_modules/ws/lib/constants.js +0 -12
- data/node_modules/ws/lib/event-target.js +0 -266
- data/node_modules/ws/lib/extension.js +0 -203
- data/node_modules/ws/lib/limiter.js +0 -55
- data/node_modules/ws/lib/permessage-deflate.js +0 -511
- data/node_modules/ws/lib/receiver.js +0 -612
- data/node_modules/ws/lib/sender.js +0 -422
- data/node_modules/ws/lib/stream.js +0 -180
- data/node_modules/ws/lib/subprotocol.js +0 -62
- data/node_modules/ws/lib/validation.js +0 -124
- data/node_modules/ws/lib/websocket-server.js +0 -485
- data/node_modules/ws/lib/websocket.js +0 -1149
- data/node_modules/ws/package.json +0 -61
- data/node_modules/ws/wrapper.mjs +0 -8
- data/node_modules/yauzl/LICENSE +0 -21
- data/node_modules/yauzl/README.md +0 -658
- data/node_modules/yauzl/index.js +0 -796
- data/node_modules/yauzl/package.json +0 -40
- data/package.json +0 -6
@@ -1,2534 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
/**
|
3
|
-
* Copyright 2017 Google Inc. All rights reserved.
|
4
|
-
*
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
* you may not use this file except in compliance with the License.
|
7
|
-
* You may obtain a copy of the License at
|
8
|
-
*
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
*
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
* See the License for the specific language governing permissions and
|
15
|
-
* limitations under the License.
|
16
|
-
*/
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
18
|
-
exports.Page = void 0;
|
19
|
-
const EventEmitter_js_1 = require("./EventEmitter.js");
|
20
|
-
const Connection_js_1 = require("./Connection.js");
|
21
|
-
const Dialog_js_1 = require("./Dialog.js");
|
22
|
-
const EmulationManager_js_1 = require("./EmulationManager.js");
|
23
|
-
const FrameManager_js_1 = require("./FrameManager.js");
|
24
|
-
const Input_js_1 = require("./Input.js");
|
25
|
-
const Tracing_js_1 = require("./Tracing.js");
|
26
|
-
const assert_js_1 = require("./assert.js");
|
27
|
-
const helper_js_1 = require("./helper.js");
|
28
|
-
const Coverage_js_1 = require("./Coverage.js");
|
29
|
-
const WebWorker_js_1 = require("./WebWorker.js");
|
30
|
-
const JSHandle_js_1 = require("./JSHandle.js");
|
31
|
-
const NetworkManager_js_1 = require("./NetworkManager.js");
|
32
|
-
const Accessibility_js_1 = require("./Accessibility.js");
|
33
|
-
const TimeoutSettings_js_1 = require("./TimeoutSettings.js");
|
34
|
-
const FileChooser_js_1 = require("./FileChooser.js");
|
35
|
-
const ConsoleMessage_js_1 = require("./ConsoleMessage.js");
|
36
|
-
const PDFOptions_js_1 = require("./PDFOptions.js");
|
37
|
-
const environment_js_1 = require("../environment.js");
|
38
|
-
/**
|
39
|
-
* Page provides methods to interact with a single tab or
|
40
|
-
* {@link https://developer.chrome.com/extensions/background_pages | extension background page} in Chromium.
|
41
|
-
*
|
42
|
-
* @remarks
|
43
|
-
*
|
44
|
-
* One Browser instance might have multiple Page instances.
|
45
|
-
*
|
46
|
-
* @example
|
47
|
-
* This example creates a page, navigates it to a URL, and then * saves a screenshot:
|
48
|
-
* ```js
|
49
|
-
* const puppeteer = require('puppeteer');
|
50
|
-
*
|
51
|
-
* (async () => {
|
52
|
-
* const browser = await puppeteer.launch();
|
53
|
-
* const page = await browser.newPage();
|
54
|
-
* await page.goto('https://example.com');
|
55
|
-
* await page.screenshot({path: 'screenshot.png'});
|
56
|
-
* await browser.close();
|
57
|
-
* })();
|
58
|
-
* ```
|
59
|
-
*
|
60
|
-
* The Page class extends from Puppeteer's {@link EventEmitter} class and will
|
61
|
-
* emit various events which are documented in the {@link PageEmittedEvents} enum.
|
62
|
-
*
|
63
|
-
* @example
|
64
|
-
* This example logs a message for a single page `load` event:
|
65
|
-
* ```js
|
66
|
-
* page.once('load', () => console.log('Page loaded!'));
|
67
|
-
* ```
|
68
|
-
*
|
69
|
-
* To unsubscribe from events use the `off` method:
|
70
|
-
*
|
71
|
-
* ```js
|
72
|
-
* function logRequest(interceptedRequest) {
|
73
|
-
* console.log('A request was made:', interceptedRequest.url());
|
74
|
-
* }
|
75
|
-
* page.on('request', logRequest);
|
76
|
-
* // Sometime later...
|
77
|
-
* page.off('request', logRequest);
|
78
|
-
* ```
|
79
|
-
* @public
|
80
|
-
*/
|
81
|
-
class Page extends EventEmitter_js_1.EventEmitter {
|
82
|
-
/**
|
83
|
-
* @internal
|
84
|
-
*/
|
85
|
-
constructor(client, target, ignoreHTTPSErrors, screenshotTaskQueue) {
|
86
|
-
super();
|
87
|
-
this._closed = false;
|
88
|
-
this._timeoutSettings = new TimeoutSettings_js_1.TimeoutSettings();
|
89
|
-
this._pageBindings = new Map();
|
90
|
-
this._javascriptEnabled = true;
|
91
|
-
this._workers = new Map();
|
92
|
-
// TODO: improve this typedef - it's a function that takes a file chooser or
|
93
|
-
// something?
|
94
|
-
this._fileChooserInterceptors = new Set();
|
95
|
-
this._userDragInterceptionEnabled = false;
|
96
|
-
this._handlerMap = new WeakMap();
|
97
|
-
this._client = client;
|
98
|
-
this._target = target;
|
99
|
-
this._keyboard = new Input_js_1.Keyboard(client);
|
100
|
-
this._mouse = new Input_js_1.Mouse(client, this._keyboard);
|
101
|
-
this._touchscreen = new Input_js_1.Touchscreen(client, this._keyboard);
|
102
|
-
this._accessibility = new Accessibility_js_1.Accessibility(client);
|
103
|
-
this._frameManager = new FrameManager_js_1.FrameManager(client, this, ignoreHTTPSErrors, this._timeoutSettings);
|
104
|
-
this._emulationManager = new EmulationManager_js_1.EmulationManager(client);
|
105
|
-
this._tracing = new Tracing_js_1.Tracing(client);
|
106
|
-
this._coverage = new Coverage_js_1.Coverage(client);
|
107
|
-
this._screenshotTaskQueue = screenshotTaskQueue;
|
108
|
-
this._viewport = null;
|
109
|
-
client.on('Target.attachedToTarget', (event) => {
|
110
|
-
if (event.targetInfo.type !== 'worker' &&
|
111
|
-
event.targetInfo.type !== 'iframe') {
|
112
|
-
// If we don't detach from service workers, they will never die.
|
113
|
-
// We still want to attach to workers for emitting events.
|
114
|
-
// We still want to attach to iframes so sessions may interact with them.
|
115
|
-
// We detach from all other types out of an abundance of caution.
|
116
|
-
// See https://source.chromium.org/chromium/chromium/src/+/main:content/browser/devtools/devtools_agent_host_impl.cc?ss=chromium&q=f:devtools%20-f:out%20%22::kTypePage%5B%5D%22
|
117
|
-
// for the complete list of available types.
|
118
|
-
client
|
119
|
-
.send('Target.detachFromTarget', {
|
120
|
-
sessionId: event.sessionId,
|
121
|
-
})
|
122
|
-
.catch(helper_js_1.debugError);
|
123
|
-
return;
|
124
|
-
}
|
125
|
-
if (event.targetInfo.type === 'worker') {
|
126
|
-
const session = Connection_js_1.Connection.fromSession(client).session(event.sessionId);
|
127
|
-
const worker = new WebWorker_js_1.WebWorker(session, event.targetInfo.url, this._addConsoleMessage.bind(this), this._handleException.bind(this));
|
128
|
-
this._workers.set(event.sessionId, worker);
|
129
|
-
this.emit("workercreated" /* WorkerCreated */, worker);
|
130
|
-
}
|
131
|
-
});
|
132
|
-
client.on('Target.detachedFromTarget', (event) => {
|
133
|
-
const worker = this._workers.get(event.sessionId);
|
134
|
-
if (!worker)
|
135
|
-
return;
|
136
|
-
this._workers.delete(event.sessionId);
|
137
|
-
this.emit("workerdestroyed" /* WorkerDestroyed */, worker);
|
138
|
-
});
|
139
|
-
this._frameManager.on(FrameManager_js_1.FrameManagerEmittedEvents.FrameAttached, (event) => this.emit("frameattached" /* FrameAttached */, event));
|
140
|
-
this._frameManager.on(FrameManager_js_1.FrameManagerEmittedEvents.FrameDetached, (event) => this.emit("framedetached" /* FrameDetached */, event));
|
141
|
-
this._frameManager.on(FrameManager_js_1.FrameManagerEmittedEvents.FrameNavigated, (event) => this.emit("framenavigated" /* FrameNavigated */, event));
|
142
|
-
const networkManager = this._frameManager.networkManager();
|
143
|
-
networkManager.on(NetworkManager_js_1.NetworkManagerEmittedEvents.Request, (event) => this.emit("request" /* Request */, event));
|
144
|
-
networkManager.on(NetworkManager_js_1.NetworkManagerEmittedEvents.RequestServedFromCache, (event) => this.emit("requestservedfromcache" /* RequestServedFromCache */, event));
|
145
|
-
networkManager.on(NetworkManager_js_1.NetworkManagerEmittedEvents.Response, (event) => this.emit("response" /* Response */, event));
|
146
|
-
networkManager.on(NetworkManager_js_1.NetworkManagerEmittedEvents.RequestFailed, (event) => this.emit("requestfailed" /* RequestFailed */, event));
|
147
|
-
networkManager.on(NetworkManager_js_1.NetworkManagerEmittedEvents.RequestFinished, (event) => this.emit("requestfinished" /* RequestFinished */, event));
|
148
|
-
this._fileChooserInterceptors = new Set();
|
149
|
-
client.on('Page.domContentEventFired', () => this.emit("domcontentloaded" /* DOMContentLoaded */));
|
150
|
-
client.on('Page.loadEventFired', () => this.emit("load" /* Load */));
|
151
|
-
client.on('Runtime.consoleAPICalled', (event) => this._onConsoleAPI(event));
|
152
|
-
client.on('Runtime.bindingCalled', (event) => this._onBindingCalled(event));
|
153
|
-
client.on('Page.javascriptDialogOpening', (event) => this._onDialog(event));
|
154
|
-
client.on('Runtime.exceptionThrown', (exception) => this._handleException(exception.exceptionDetails));
|
155
|
-
client.on('Inspector.targetCrashed', () => this._onTargetCrashed());
|
156
|
-
client.on('Performance.metrics', (event) => this._emitMetrics(event));
|
157
|
-
client.on('Log.entryAdded', (event) => this._onLogEntryAdded(event));
|
158
|
-
client.on('Page.fileChooserOpened', (event) => this._onFileChooser(event));
|
159
|
-
this._target._isClosedPromise.then(() => {
|
160
|
-
this.emit("close" /* Close */);
|
161
|
-
this._closed = true;
|
162
|
-
});
|
163
|
-
}
|
164
|
-
/**
|
165
|
-
* @internal
|
166
|
-
*/
|
167
|
-
static async create(client, target, ignoreHTTPSErrors, defaultViewport, screenshotTaskQueue) {
|
168
|
-
const page = new Page(client, target, ignoreHTTPSErrors, screenshotTaskQueue);
|
169
|
-
await page._initialize();
|
170
|
-
if (defaultViewport)
|
171
|
-
await page.setViewport(defaultViewport);
|
172
|
-
return page;
|
173
|
-
}
|
174
|
-
async _initialize() {
|
175
|
-
await Promise.all([
|
176
|
-
this._frameManager.initialize(),
|
177
|
-
this._client.send('Target.setAutoAttach', {
|
178
|
-
autoAttach: true,
|
179
|
-
waitForDebuggerOnStart: false,
|
180
|
-
flatten: true,
|
181
|
-
}),
|
182
|
-
this._client.send('Performance.enable'),
|
183
|
-
this._client.send('Log.enable'),
|
184
|
-
]);
|
185
|
-
}
|
186
|
-
async _onFileChooser(event) {
|
187
|
-
if (!this._fileChooserInterceptors.size)
|
188
|
-
return;
|
189
|
-
const frame = this._frameManager.frame(event.frameId);
|
190
|
-
const context = await frame.executionContext();
|
191
|
-
const element = await context._adoptBackendNodeId(event.backendNodeId);
|
192
|
-
const interceptors = Array.from(this._fileChooserInterceptors);
|
193
|
-
this._fileChooserInterceptors.clear();
|
194
|
-
const fileChooser = new FileChooser_js_1.FileChooser(element, event);
|
195
|
-
for (const interceptor of interceptors)
|
196
|
-
interceptor.call(null, fileChooser);
|
197
|
-
}
|
198
|
-
/**
|
199
|
-
* @returns `true` if drag events are being intercepted, `false` otherwise.
|
200
|
-
*/
|
201
|
-
isDragInterceptionEnabled() {
|
202
|
-
return this._userDragInterceptionEnabled;
|
203
|
-
}
|
204
|
-
/**
|
205
|
-
* @returns `true` if the page has JavaScript enabled, `false` otherwise.
|
206
|
-
*/
|
207
|
-
isJavaScriptEnabled() {
|
208
|
-
return this._javascriptEnabled;
|
209
|
-
}
|
210
|
-
/**
|
211
|
-
* Listen to page events.
|
212
|
-
*/
|
213
|
-
// Note: this method exists to define event typings and handle
|
214
|
-
// proper wireup of cooperative request interception. Actual event listening and
|
215
|
-
// dispatching is delegated to EventEmitter.
|
216
|
-
on(eventName, handler) {
|
217
|
-
if (eventName === 'request') {
|
218
|
-
const wrap = (event) => {
|
219
|
-
event.enqueueInterceptAction(() => handler(event));
|
220
|
-
};
|
221
|
-
this._handlerMap.set(handler, wrap);
|
222
|
-
return super.on(eventName, wrap);
|
223
|
-
}
|
224
|
-
return super.on(eventName, handler);
|
225
|
-
}
|
226
|
-
once(eventName, handler) {
|
227
|
-
// Note: this method only exists to define the types; we delegate the impl
|
228
|
-
// to EventEmitter.
|
229
|
-
return super.once(eventName, handler);
|
230
|
-
}
|
231
|
-
off(eventName, handler) {
|
232
|
-
if (eventName === 'request') {
|
233
|
-
handler = this._handlerMap.get(handler) || handler;
|
234
|
-
}
|
235
|
-
return super.off(eventName, handler);
|
236
|
-
}
|
237
|
-
/**
|
238
|
-
* This method is typically coupled with an action that triggers file
|
239
|
-
* choosing. The following example clicks a button that issues a file chooser
|
240
|
-
* and then responds with `/tmp/myfile.pdf` as if a user has selected this file.
|
241
|
-
*
|
242
|
-
* ```js
|
243
|
-
* const [fileChooser] = await Promise.all([
|
244
|
-
* page.waitForFileChooser(),
|
245
|
-
* page.click('#upload-file-button'),
|
246
|
-
* // some button that triggers file selection
|
247
|
-
* ]);
|
248
|
-
* await fileChooser.accept(['/tmp/myfile.pdf']);
|
249
|
-
* ```
|
250
|
-
*
|
251
|
-
* NOTE: This must be called before the file chooser is launched. It will not
|
252
|
-
* return a currently active file chooser.
|
253
|
-
* @param options - Optional waiting parameters
|
254
|
-
* @returns Resolves after a page requests a file picker.
|
255
|
-
* @remarks
|
256
|
-
* NOTE: In non-headless Chromium, this method results in the native file picker
|
257
|
-
* dialog `not showing up` for the user.
|
258
|
-
*/
|
259
|
-
async waitForFileChooser(options = {}) {
|
260
|
-
if (!this._fileChooserInterceptors.size)
|
261
|
-
await this._client.send('Page.setInterceptFileChooserDialog', {
|
262
|
-
enabled: true,
|
263
|
-
});
|
264
|
-
const { timeout = this._timeoutSettings.timeout() } = options;
|
265
|
-
let callback;
|
266
|
-
const promise = new Promise((x) => (callback = x));
|
267
|
-
this._fileChooserInterceptors.add(callback);
|
268
|
-
return helper_js_1.helper
|
269
|
-
.waitWithTimeout(promise, 'waiting for file chooser', timeout)
|
270
|
-
.catch((error) => {
|
271
|
-
this._fileChooserInterceptors.delete(callback);
|
272
|
-
throw error;
|
273
|
-
});
|
274
|
-
}
|
275
|
-
/**
|
276
|
-
* Sets the page's geolocation.
|
277
|
-
* @remarks
|
278
|
-
* NOTE: Consider using {@link BrowserContext.overridePermissions} to grant
|
279
|
-
* permissions for the page to read its geolocation.
|
280
|
-
* @example
|
281
|
-
* ```js
|
282
|
-
* await page.setGeolocation({latitude: 59.95, longitude: 30.31667});
|
283
|
-
* ```
|
284
|
-
*/
|
285
|
-
async setGeolocation(options) {
|
286
|
-
const { longitude, latitude, accuracy = 0 } = options;
|
287
|
-
if (longitude < -180 || longitude > 180)
|
288
|
-
throw new Error(`Invalid longitude "${longitude}": precondition -180 <= LONGITUDE <= 180 failed.`);
|
289
|
-
if (latitude < -90 || latitude > 90)
|
290
|
-
throw new Error(`Invalid latitude "${latitude}": precondition -90 <= LATITUDE <= 90 failed.`);
|
291
|
-
if (accuracy < 0)
|
292
|
-
throw new Error(`Invalid accuracy "${accuracy}": precondition 0 <= ACCURACY failed.`);
|
293
|
-
await this._client.send('Emulation.setGeolocationOverride', {
|
294
|
-
longitude,
|
295
|
-
latitude,
|
296
|
-
accuracy,
|
297
|
-
});
|
298
|
-
}
|
299
|
-
/**
|
300
|
-
* @returns A target this page was created from.
|
301
|
-
*/
|
302
|
-
target() {
|
303
|
-
return this._target;
|
304
|
-
}
|
305
|
-
/**
|
306
|
-
* Get the CDP session client the page belongs to.
|
307
|
-
* @internal
|
308
|
-
*/
|
309
|
-
client() {
|
310
|
-
return this._client;
|
311
|
-
}
|
312
|
-
/**
|
313
|
-
* Get the browser the page belongs to.
|
314
|
-
*/
|
315
|
-
browser() {
|
316
|
-
return this._target.browser();
|
317
|
-
}
|
318
|
-
/**
|
319
|
-
* Get the browser context that the page belongs to.
|
320
|
-
*/
|
321
|
-
browserContext() {
|
322
|
-
return this._target.browserContext();
|
323
|
-
}
|
324
|
-
_onTargetCrashed() {
|
325
|
-
this.emit('error', new Error('Page crashed!'));
|
326
|
-
}
|
327
|
-
_onLogEntryAdded(event) {
|
328
|
-
const { level, text, args, source, url, lineNumber } = event.entry;
|
329
|
-
if (args)
|
330
|
-
args.map((arg) => helper_js_1.helper.releaseObject(this._client, arg));
|
331
|
-
if (source !== 'worker')
|
332
|
-
this.emit("console" /* Console */, new ConsoleMessage_js_1.ConsoleMessage(level, text, [], [{ url, lineNumber }]));
|
333
|
-
}
|
334
|
-
/**
|
335
|
-
* @returns The page's main frame.
|
336
|
-
* @remarks
|
337
|
-
* Page is guaranteed to have a main frame which persists during navigations.
|
338
|
-
*/
|
339
|
-
mainFrame() {
|
340
|
-
return this._frameManager.mainFrame();
|
341
|
-
}
|
342
|
-
get keyboard() {
|
343
|
-
return this._keyboard;
|
344
|
-
}
|
345
|
-
get touchscreen() {
|
346
|
-
return this._touchscreen;
|
347
|
-
}
|
348
|
-
get coverage() {
|
349
|
-
return this._coverage;
|
350
|
-
}
|
351
|
-
get tracing() {
|
352
|
-
return this._tracing;
|
353
|
-
}
|
354
|
-
get accessibility() {
|
355
|
-
return this._accessibility;
|
356
|
-
}
|
357
|
-
/**
|
358
|
-
* @returns An array of all frames attached to the page.
|
359
|
-
*/
|
360
|
-
frames() {
|
361
|
-
return this._frameManager.frames();
|
362
|
-
}
|
363
|
-
/**
|
364
|
-
* @returns all of the dedicated
|
365
|
-
* {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API |
|
366
|
-
* WebWorkers}
|
367
|
-
* associated with the page.
|
368
|
-
* @remarks
|
369
|
-
* NOTE: This does not contain ServiceWorkers
|
370
|
-
*/
|
371
|
-
workers() {
|
372
|
-
return Array.from(this._workers.values());
|
373
|
-
}
|
374
|
-
/**
|
375
|
-
* @param value - Whether to enable request interception.
|
376
|
-
*
|
377
|
-
* @remarks
|
378
|
-
* Activating request interception enables {@link HTTPRequest.abort},
|
379
|
-
* {@link HTTPRequest.continue} and {@link HTTPRequest.respond} methods. This
|
380
|
-
* provides the capability to modify network requests that are made by a page.
|
381
|
-
*
|
382
|
-
* Once request interception is enabled, every request will stall unless it's
|
383
|
-
* continued, responded or aborted; or completed using the browser cache.
|
384
|
-
*
|
385
|
-
* @example
|
386
|
-
* An example of a naïve request interceptor that aborts all image requests:
|
387
|
-
* ```js
|
388
|
-
* const puppeteer = require('puppeteer');
|
389
|
-
* (async () => {
|
390
|
-
* const browser = await puppeteer.launch();
|
391
|
-
* const page = await browser.newPage();
|
392
|
-
* await page.setRequestInterception(true);
|
393
|
-
* page.on('request', interceptedRequest => {
|
394
|
-
* if (interceptedRequest.url().endsWith('.png') ||
|
395
|
-
* interceptedRequest.url().endsWith('.jpg'))
|
396
|
-
* interceptedRequest.abort();
|
397
|
-
* else
|
398
|
-
* interceptedRequest.continue();
|
399
|
-
* });
|
400
|
-
* await page.goto('https://example.com');
|
401
|
-
* await browser.close();
|
402
|
-
* })();
|
403
|
-
* ```
|
404
|
-
* NOTE: Enabling request interception disables page caching.
|
405
|
-
*/
|
406
|
-
async setRequestInterception(value) {
|
407
|
-
return this._frameManager.networkManager().setRequestInterception(value);
|
408
|
-
}
|
409
|
-
/**
|
410
|
-
* @param enabled - Whether to enable drag interception.
|
411
|
-
*
|
412
|
-
* @remarks
|
413
|
-
* Activating drag interception enables the `Input.drag`,
|
414
|
-
* methods This provides the capability to capture drag events emitted
|
415
|
-
* on the page, which can then be used to simulate drag-and-drop.
|
416
|
-
*/
|
417
|
-
async setDragInterception(enabled) {
|
418
|
-
this._userDragInterceptionEnabled = enabled;
|
419
|
-
return this._client.send('Input.setInterceptDrags', { enabled });
|
420
|
-
}
|
421
|
-
/**
|
422
|
-
* @param enabled - When `true`, enables offline mode for the page.
|
423
|
-
* @remarks
|
424
|
-
* NOTE: while this method sets the network connection to offline, it does
|
425
|
-
* not change the parameters used in [page.emulateNetworkConditions(networkConditions)]
|
426
|
-
* (#pageemulatenetworkconditionsnetworkconditions)
|
427
|
-
*/
|
428
|
-
setOfflineMode(enabled) {
|
429
|
-
return this._frameManager.networkManager().setOfflineMode(enabled);
|
430
|
-
}
|
431
|
-
/**
|
432
|
-
* @param networkConditions - Passing `null` disables network condition emulation.
|
433
|
-
* @example
|
434
|
-
* ```js
|
435
|
-
* const puppeteer = require('puppeteer');
|
436
|
-
* const slow3G = puppeteer.networkConditions['Slow 3G'];
|
437
|
-
*
|
438
|
-
* (async () => {
|
439
|
-
* const browser = await puppeteer.launch();
|
440
|
-
* const page = await browser.newPage();
|
441
|
-
* await page.emulateNetworkConditions(slow3G);
|
442
|
-
* await page.goto('https://www.google.com');
|
443
|
-
* // other actions...
|
444
|
-
* await browser.close();
|
445
|
-
* })();
|
446
|
-
* ```
|
447
|
-
* @remarks
|
448
|
-
* NOTE: This does not affect WebSockets and WebRTC PeerConnections (see
|
449
|
-
* https://crbug.com/563644). To set the page offline, you can use
|
450
|
-
* [page.setOfflineMode(enabled)](#pagesetofflinemodeenabled).
|
451
|
-
*/
|
452
|
-
emulateNetworkConditions(networkConditions) {
|
453
|
-
return this._frameManager
|
454
|
-
.networkManager()
|
455
|
-
.emulateNetworkConditions(networkConditions);
|
456
|
-
}
|
457
|
-
/**
|
458
|
-
* This setting will change the default maximum navigation time for the
|
459
|
-
* following methods and related shortcuts:
|
460
|
-
*
|
461
|
-
* - {@link Page.goBack | page.goBack(options)}
|
462
|
-
*
|
463
|
-
* - {@link Page.goForward | page.goForward(options)}
|
464
|
-
*
|
465
|
-
* - {@link Page.goto | page.goto(url,options)}
|
466
|
-
*
|
467
|
-
* - {@link Page.reload | page.reload(options)}
|
468
|
-
*
|
469
|
-
* - {@link Page.setContent | page.setContent(html,options)}
|
470
|
-
*
|
471
|
-
* - {@link Page.waitForNavigation | page.waitForNavigation(options)}
|
472
|
-
* @param timeout - Maximum navigation time in milliseconds.
|
473
|
-
*/
|
474
|
-
setDefaultNavigationTimeout(timeout) {
|
475
|
-
this._timeoutSettings.setDefaultNavigationTimeout(timeout);
|
476
|
-
}
|
477
|
-
/**
|
478
|
-
* @param timeout - Maximum time in milliseconds.
|
479
|
-
*/
|
480
|
-
setDefaultTimeout(timeout) {
|
481
|
-
this._timeoutSettings.setDefaultTimeout(timeout);
|
482
|
-
}
|
483
|
-
/**
|
484
|
-
* Runs `document.querySelector` within the page. If no element matches the
|
485
|
-
* selector, the return value resolves to `null`.
|
486
|
-
*
|
487
|
-
* @remarks
|
488
|
-
* Shortcut for {@link Frame.$ | Page.mainFrame().$(selector) }.
|
489
|
-
*
|
490
|
-
* @param selector - A `selector` to query page for
|
491
|
-
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | selector}
|
492
|
-
* to query page for.
|
493
|
-
*/
|
494
|
-
async $(selector) {
|
495
|
-
return this.mainFrame().$(selector);
|
496
|
-
}
|
497
|
-
/**
|
498
|
-
* @remarks
|
499
|
-
*
|
500
|
-
* The only difference between {@link Page.evaluate | page.evaluate} and
|
501
|
-
* `page.evaluateHandle` is that `evaluateHandle` will return the value
|
502
|
-
* wrapped in an in-page object.
|
503
|
-
*
|
504
|
-
* If the function passed to `page.evaluteHandle` returns a Promise, the
|
505
|
-
* function will wait for the promise to resolve and return its value.
|
506
|
-
*
|
507
|
-
* You can pass a string instead of a function (although functions are
|
508
|
-
* recommended as they are easier to debug and use with TypeScript):
|
509
|
-
*
|
510
|
-
* @example
|
511
|
-
* ```
|
512
|
-
* const aHandle = await page.evaluateHandle('document')
|
513
|
-
* ```
|
514
|
-
*
|
515
|
-
* @example
|
516
|
-
* {@link JSHandle} instances can be passed as arguments to the `pageFunction`:
|
517
|
-
* ```
|
518
|
-
* const aHandle = await page.evaluateHandle(() => document.body);
|
519
|
-
* const resultHandle = await page.evaluateHandle(body => body.innerHTML, aHandle);
|
520
|
-
* console.log(await resultHandle.jsonValue());
|
521
|
-
* await resultHandle.dispose();
|
522
|
-
* ```
|
523
|
-
*
|
524
|
-
* Most of the time this function returns a {@link JSHandle},
|
525
|
-
* but if `pageFunction` returns a reference to an element,
|
526
|
-
* you instead get an {@link ElementHandle} back:
|
527
|
-
*
|
528
|
-
* @example
|
529
|
-
* ```
|
530
|
-
* const button = await page.evaluateHandle(() => document.querySelector('button'));
|
531
|
-
* // can call `click` because `button` is an `ElementHandle`
|
532
|
-
* await button.click();
|
533
|
-
* ```
|
534
|
-
*
|
535
|
-
* The TypeScript definitions assume that `evaluateHandle` returns
|
536
|
-
* a `JSHandle`, but if you know it's going to return an
|
537
|
-
* `ElementHandle`, pass it as the generic argument:
|
538
|
-
*
|
539
|
-
* ```
|
540
|
-
* const button = await page.evaluateHandle<ElementHandle>(...);
|
541
|
-
* ```
|
542
|
-
*
|
543
|
-
* @param pageFunction - a function that is run within the page
|
544
|
-
* @param args - arguments to be passed to the pageFunction
|
545
|
-
*/
|
546
|
-
async evaluateHandle(pageFunction, ...args) {
|
547
|
-
const context = await this.mainFrame().executionContext();
|
548
|
-
return context.evaluateHandle(pageFunction, ...args);
|
549
|
-
}
|
550
|
-
/**
|
551
|
-
* This method iterates the JavaScript heap and finds all objects with the
|
552
|
-
* given prototype.
|
553
|
-
*
|
554
|
-
* @remarks
|
555
|
-
* Shortcut for
|
556
|
-
* {@link ExecutionContext.queryObjects |
|
557
|
-
* page.mainFrame().executionContext().queryObjects(prototypeHandle)}.
|
558
|
-
*
|
559
|
-
* @example
|
560
|
-
*
|
561
|
-
* ```js
|
562
|
-
* // Create a Map object
|
563
|
-
* await page.evaluate(() => window.map = new Map());
|
564
|
-
* // Get a handle to the Map object prototype
|
565
|
-
* const mapPrototype = await page.evaluateHandle(() => Map.prototype);
|
566
|
-
* // Query all map instances into an array
|
567
|
-
* const mapInstances = await page.queryObjects(mapPrototype);
|
568
|
-
* // Count amount of map objects in heap
|
569
|
-
* const count = await page.evaluate(maps => maps.length, mapInstances);
|
570
|
-
* await mapInstances.dispose();
|
571
|
-
* await mapPrototype.dispose();
|
572
|
-
* ```
|
573
|
-
* @param prototypeHandle - a handle to the object prototype.
|
574
|
-
* @returns Promise which resolves to a handle to an array of objects with
|
575
|
-
* this prototype.
|
576
|
-
*/
|
577
|
-
async queryObjects(prototypeHandle) {
|
578
|
-
const context = await this.mainFrame().executionContext();
|
579
|
-
return context.queryObjects(prototypeHandle);
|
580
|
-
}
|
581
|
-
/**
|
582
|
-
* This method runs `document.querySelector` within the page and passes the
|
583
|
-
* result as the first argument to the `pageFunction`.
|
584
|
-
*
|
585
|
-
* @remarks
|
586
|
-
*
|
587
|
-
* If no element is found matching `selector`, the method will throw an error.
|
588
|
-
*
|
589
|
-
* If `pageFunction` returns a promise `$eval` will wait for the promise to
|
590
|
-
* resolve and then return its value.
|
591
|
-
*
|
592
|
-
* @example
|
593
|
-
*
|
594
|
-
* ```
|
595
|
-
* const searchValue = await page.$eval('#search', el => el.value);
|
596
|
-
* const preloadHref = await page.$eval('link[rel=preload]', el => el.href);
|
597
|
-
* const html = await page.$eval('.main-container', el => el.outerHTML);
|
598
|
-
* ```
|
599
|
-
*
|
600
|
-
* If you are using TypeScript, you may have to provide an explicit type to the
|
601
|
-
* first argument of the `pageFunction`.
|
602
|
-
* By default it is typed as `Element`, but you may need to provide a more
|
603
|
-
* specific sub-type:
|
604
|
-
*
|
605
|
-
* @example
|
606
|
-
*
|
607
|
-
* ```
|
608
|
-
* // if you don't provide HTMLInputElement here, TS will error
|
609
|
-
* // as `value` is not on `Element`
|
610
|
-
* const searchValue = await page.$eval('#search', (el: HTMLInputElement) => el.value);
|
611
|
-
* ```
|
612
|
-
*
|
613
|
-
* The compiler should be able to infer the return type
|
614
|
-
* from the `pageFunction` you provide. If it is unable to, you can use the generic
|
615
|
-
* type to tell the compiler what return type you expect from `$eval`:
|
616
|
-
*
|
617
|
-
* @example
|
618
|
-
*
|
619
|
-
* ```
|
620
|
-
* // The compiler can infer the return type in this case, but if it can't
|
621
|
-
* // or if you want to be more explicit, provide it as the generic type.
|
622
|
-
* const searchValue = await page.$eval<string>(
|
623
|
-
* '#search', (el: HTMLInputElement) => el.value
|
624
|
-
* );
|
625
|
-
* ```
|
626
|
-
*
|
627
|
-
* @param selector - the
|
628
|
-
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | selector}
|
629
|
-
* to query for
|
630
|
-
* @param pageFunction - the function to be evaluated in the page context.
|
631
|
-
* Will be passed the result of `document.querySelector(selector)` as its
|
632
|
-
* first argument.
|
633
|
-
* @param args - any additional arguments to pass through to `pageFunction`.
|
634
|
-
*
|
635
|
-
* @returns The result of calling `pageFunction`. If it returns an element it
|
636
|
-
* is wrapped in an {@link ElementHandle}, else the raw value itself is
|
637
|
-
* returned.
|
638
|
-
*/
|
639
|
-
async $eval(selector, pageFunction, ...args) {
|
640
|
-
return this.mainFrame().$eval(selector, pageFunction, ...args);
|
641
|
-
}
|
642
|
-
/**
|
643
|
-
* This method runs `Array.from(document.querySelectorAll(selector))` within
|
644
|
-
* the page and passes the result as the first argument to the `pageFunction`.
|
645
|
-
*
|
646
|
-
* @remarks
|
647
|
-
*
|
648
|
-
* If `pageFunction` returns a promise `$$eval` will wait for the promise to
|
649
|
-
* resolve and then return its value.
|
650
|
-
*
|
651
|
-
* @example
|
652
|
-
*
|
653
|
-
* ```
|
654
|
-
* // get the amount of divs on the page
|
655
|
-
* const divCount = await page.$$eval('div', divs => divs.length);
|
656
|
-
*
|
657
|
-
* // get the text content of all the `.options` elements:
|
658
|
-
* const options = await page.$$eval('div > span.options', options => {
|
659
|
-
* return options.map(option => option.textContent)
|
660
|
-
* });
|
661
|
-
* ```
|
662
|
-
*
|
663
|
-
* If you are using TypeScript, you may have to provide an explicit type to the
|
664
|
-
* first argument of the `pageFunction`.
|
665
|
-
* By default it is typed as `Element[]`, but you may need to provide a more
|
666
|
-
* specific sub-type:
|
667
|
-
*
|
668
|
-
* @example
|
669
|
-
*
|
670
|
-
* ```
|
671
|
-
* // if you don't provide HTMLInputElement here, TS will error
|
672
|
-
* // as `value` is not on `Element`
|
673
|
-
* await page.$$eval('input', (elements: HTMLInputElement[]) => {
|
674
|
-
* return elements.map(e => e.value);
|
675
|
-
* });
|
676
|
-
* ```
|
677
|
-
*
|
678
|
-
* The compiler should be able to infer the return type
|
679
|
-
* from the `pageFunction` you provide. If it is unable to, you can use the generic
|
680
|
-
* type to tell the compiler what return type you expect from `$$eval`:
|
681
|
-
*
|
682
|
-
* @example
|
683
|
-
*
|
684
|
-
* ```
|
685
|
-
* // The compiler can infer the return type in this case, but if it can't
|
686
|
-
* // or if you want to be more explicit, provide it as the generic type.
|
687
|
-
* const allInputValues = await page.$$eval<string[]>(
|
688
|
-
* 'input', (elements: HTMLInputElement[]) => elements.map(e => e.textContent)
|
689
|
-
* );
|
690
|
-
* ```
|
691
|
-
*
|
692
|
-
* @param selector - the
|
693
|
-
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | selector}
|
694
|
-
* to query for
|
695
|
-
* @param pageFunction - the function to be evaluated in the page context. Will
|
696
|
-
* be passed the result of `Array.from(document.querySelectorAll(selector))`
|
697
|
-
* as its first argument.
|
698
|
-
* @param args - any additional arguments to pass through to `pageFunction`.
|
699
|
-
*
|
700
|
-
* @returns The result of calling `pageFunction`. If it returns an element it
|
701
|
-
* is wrapped in an {@link ElementHandle}, else the raw value itself is
|
702
|
-
* returned.
|
703
|
-
*/
|
704
|
-
async $$eval(selector, pageFunction, ...args) {
|
705
|
-
return this.mainFrame().$$eval(selector, pageFunction, ...args);
|
706
|
-
}
|
707
|
-
/**
|
708
|
-
* The method runs `document.querySelectorAll` within the page. If no elements
|
709
|
-
* match the selector, the return value resolves to `[]`.
|
710
|
-
* @remarks
|
711
|
-
* Shortcut for {@link Frame.$$ | Page.mainFrame().$$(selector) }.
|
712
|
-
* @param selector - A `selector` to query page for
|
713
|
-
*/
|
714
|
-
async $$(selector) {
|
715
|
-
return this.mainFrame().$$(selector);
|
716
|
-
}
|
717
|
-
/**
|
718
|
-
* The method evaluates the XPath expression relative to the page document as
|
719
|
-
* its context node. If there are no such elements, the method resolves to an
|
720
|
-
* empty array.
|
721
|
-
* @remarks
|
722
|
-
* Shortcut for {@link Frame.$x | Page.mainFrame().$x(expression) }.
|
723
|
-
* @param expression - Expression to evaluate
|
724
|
-
*/
|
725
|
-
async $x(expression) {
|
726
|
-
return this.mainFrame().$x(expression);
|
727
|
-
}
|
728
|
-
/**
|
729
|
-
* If no URLs are specified, this method returns cookies for the current page
|
730
|
-
* URL. If URLs are specified, only cookies for those URLs are returned.
|
731
|
-
*/
|
732
|
-
async cookies(...urls) {
|
733
|
-
const originalCookies = (await this._client.send('Network.getCookies', {
|
734
|
-
urls: urls.length ? urls : [this.url()],
|
735
|
-
})).cookies;
|
736
|
-
const unsupportedCookieAttributes = ['priority'];
|
737
|
-
const filterUnsupportedAttributes = (cookie) => {
|
738
|
-
for (const attr of unsupportedCookieAttributes)
|
739
|
-
delete cookie[attr];
|
740
|
-
return cookie;
|
741
|
-
};
|
742
|
-
return originalCookies.map(filterUnsupportedAttributes);
|
743
|
-
}
|
744
|
-
async deleteCookie(...cookies) {
|
745
|
-
const pageURL = this.url();
|
746
|
-
for (const cookie of cookies) {
|
747
|
-
const item = Object.assign({}, cookie);
|
748
|
-
if (!cookie.url && pageURL.startsWith('http'))
|
749
|
-
item.url = pageURL;
|
750
|
-
await this._client.send('Network.deleteCookies', item);
|
751
|
-
}
|
752
|
-
}
|
753
|
-
/**
|
754
|
-
* @example
|
755
|
-
* ```js
|
756
|
-
* await page.setCookie(cookieObject1, cookieObject2);
|
757
|
-
* ```
|
758
|
-
*/
|
759
|
-
async setCookie(...cookies) {
|
760
|
-
const pageURL = this.url();
|
761
|
-
const startsWithHTTP = pageURL.startsWith('http');
|
762
|
-
const items = cookies.map((cookie) => {
|
763
|
-
const item = Object.assign({}, cookie);
|
764
|
-
if (!item.url && startsWithHTTP)
|
765
|
-
item.url = pageURL;
|
766
|
-
(0, assert_js_1.assert)(item.url !== 'about:blank', `Blank page can not have cookie "${item.name}"`);
|
767
|
-
(0, assert_js_1.assert)(!String.prototype.startsWith.call(item.url || '', 'data:'), `Data URL page can not have cookie "${item.name}"`);
|
768
|
-
return item;
|
769
|
-
});
|
770
|
-
await this.deleteCookie(...items);
|
771
|
-
if (items.length)
|
772
|
-
await this._client.send('Network.setCookies', { cookies: items });
|
773
|
-
}
|
774
|
-
/**
|
775
|
-
* Adds a `<script>` tag into the page with the desired URL or content.
|
776
|
-
* @remarks
|
777
|
-
* Shortcut for {@link Frame.addScriptTag | page.mainFrame().addScriptTag(options) }.
|
778
|
-
* @returns Promise which resolves to the added tag when the script's onload fires or
|
779
|
-
* when the script content was injected into frame.
|
780
|
-
*/
|
781
|
-
async addScriptTag(options) {
|
782
|
-
return this.mainFrame().addScriptTag(options);
|
783
|
-
}
|
784
|
-
/**
|
785
|
-
* Adds a `<link rel="stylesheet">` tag into the page with the desired URL or a
|
786
|
-
* `<style type="text/css">` tag with the content.
|
787
|
-
* @returns Promise which resolves to the added tag when the stylesheet's
|
788
|
-
* onload fires or when the CSS content was injected into frame.
|
789
|
-
*/
|
790
|
-
async addStyleTag(options) {
|
791
|
-
return this.mainFrame().addStyleTag(options);
|
792
|
-
}
|
793
|
-
/**
|
794
|
-
* The method adds a function called `name` on the page's `window` object. When
|
795
|
-
* called, the function executes `puppeteerFunction` in node.js and returns a
|
796
|
-
* `Promise` which resolves to the return value of `puppeteerFunction`.
|
797
|
-
*
|
798
|
-
* If the puppeteerFunction returns a `Promise`, it will be awaited.
|
799
|
-
*
|
800
|
-
* NOTE: Functions installed via `page.exposeFunction` survive navigations.
|
801
|
-
* @param name - Name of the function on the window object
|
802
|
-
* @param puppeteerFunction - Callback function which will be called in
|
803
|
-
* Puppeteer's context.
|
804
|
-
* @example
|
805
|
-
* An example of adding an `md5` function into the page:
|
806
|
-
* ```js
|
807
|
-
* const puppeteer = require('puppeteer');
|
808
|
-
* const crypto = require('crypto');
|
809
|
-
*
|
810
|
-
* (async () => {
|
811
|
-
* const browser = await puppeteer.launch();
|
812
|
-
* const page = await browser.newPage();
|
813
|
-
* page.on('console', (msg) => console.log(msg.text()));
|
814
|
-
* await page.exposeFunction('md5', (text) =>
|
815
|
-
* crypto.createHash('md5').update(text).digest('hex')
|
816
|
-
* );
|
817
|
-
* await page.evaluate(async () => {
|
818
|
-
* // use window.md5 to compute hashes
|
819
|
-
* const myString = 'PUPPETEER';
|
820
|
-
* const myHash = await window.md5(myString);
|
821
|
-
* console.log(`md5 of ${myString} is ${myHash}`);
|
822
|
-
* });
|
823
|
-
* await browser.close();
|
824
|
-
* })();
|
825
|
-
* ```
|
826
|
-
* An example of adding a `window.readfile` function into the page:
|
827
|
-
* ```js
|
828
|
-
* const puppeteer = require('puppeteer');
|
829
|
-
* const fs = require('fs');
|
830
|
-
*
|
831
|
-
* (async () => {
|
832
|
-
* const browser = await puppeteer.launch();
|
833
|
-
* const page = await browser.newPage();
|
834
|
-
* page.on('console', (msg) => console.log(msg.text()));
|
835
|
-
* await page.exposeFunction('readfile', async (filePath) => {
|
836
|
-
* return new Promise((resolve, reject) => {
|
837
|
-
* fs.readFile(filePath, 'utf8', (err, text) => {
|
838
|
-
* if (err) reject(err);
|
839
|
-
* else resolve(text);
|
840
|
-
* });
|
841
|
-
* });
|
842
|
-
* });
|
843
|
-
* await page.evaluate(async () => {
|
844
|
-
* // use window.readfile to read contents of a file
|
845
|
-
* const content = await window.readfile('/etc/hosts');
|
846
|
-
* console.log(content);
|
847
|
-
* });
|
848
|
-
* await browser.close();
|
849
|
-
* })();
|
850
|
-
* ```
|
851
|
-
*/
|
852
|
-
async exposeFunction(name, puppeteerFunction) {
|
853
|
-
if (this._pageBindings.has(name))
|
854
|
-
throw new Error(`Failed to add page binding with name ${name}: window['${name}'] already exists!`);
|
855
|
-
let exposedFunction;
|
856
|
-
if (typeof puppeteerFunction === 'function') {
|
857
|
-
exposedFunction = puppeteerFunction;
|
858
|
-
}
|
859
|
-
else if (typeof puppeteerFunction.default === 'function') {
|
860
|
-
exposedFunction = puppeteerFunction.default;
|
861
|
-
}
|
862
|
-
else {
|
863
|
-
throw new Error(`Failed to add page binding with name ${name}: ${puppeteerFunction} is not a function or a module with a default export.`);
|
864
|
-
}
|
865
|
-
this._pageBindings.set(name, exposedFunction);
|
866
|
-
const expression = helper_js_1.helper.pageBindingInitString('exposedFun', name);
|
867
|
-
await this._client.send('Runtime.addBinding', { name: name });
|
868
|
-
await this._client.send('Page.addScriptToEvaluateOnNewDocument', {
|
869
|
-
source: expression,
|
870
|
-
});
|
871
|
-
await Promise.all(this.frames().map((frame) => frame.evaluate(expression).catch(helper_js_1.debugError)));
|
872
|
-
}
|
873
|
-
/**
|
874
|
-
* Provide credentials for `HTTP authentication`.
|
875
|
-
* @remarks To disable authentication, pass `null`.
|
876
|
-
*/
|
877
|
-
async authenticate(credentials) {
|
878
|
-
return this._frameManager.networkManager().authenticate(credentials);
|
879
|
-
}
|
880
|
-
/**
|
881
|
-
* The extra HTTP headers will be sent with every request the page initiates.
|
882
|
-
* NOTE: All HTTP header names are lowercased. (HTTP headers are
|
883
|
-
* case-insensitive, so this shouldn’t impact your server code.)
|
884
|
-
* NOTE: page.setExtraHTTPHeaders does not guarantee the order of headers in
|
885
|
-
* the outgoing requests.
|
886
|
-
* @param headers - An object containing additional HTTP headers to be sent
|
887
|
-
* with every request. All header values must be strings.
|
888
|
-
* @returns
|
889
|
-
*/
|
890
|
-
async setExtraHTTPHeaders(headers) {
|
891
|
-
return this._frameManager.networkManager().setExtraHTTPHeaders(headers);
|
892
|
-
}
|
893
|
-
/**
|
894
|
-
* @param userAgent - Specific user agent to use in this page
|
895
|
-
* @param userAgentData - Specific user agent client hint data to use in this
|
896
|
-
* page
|
897
|
-
* @returns Promise which resolves when the user agent is set.
|
898
|
-
*/
|
899
|
-
async setUserAgent(userAgent, userAgentMetadata) {
|
900
|
-
return this._frameManager
|
901
|
-
.networkManager()
|
902
|
-
.setUserAgent(userAgent, userAgentMetadata);
|
903
|
-
}
|
904
|
-
/**
|
905
|
-
* @returns Object containing metrics as key/value pairs.
|
906
|
-
*
|
907
|
-
* - `Timestamp` : The timestamp when the metrics sample was taken.
|
908
|
-
*
|
909
|
-
* - `Documents` : Number of documents in the page.
|
910
|
-
*
|
911
|
-
* - `Frames` : Number of frames in the page.
|
912
|
-
*
|
913
|
-
* - `JSEventListeners` : Number of events in the page.
|
914
|
-
*
|
915
|
-
* - `Nodes` : Number of DOM nodes in the page.
|
916
|
-
*
|
917
|
-
* - `LayoutCount` : Total number of full or partial page layout.
|
918
|
-
*
|
919
|
-
* - `RecalcStyleCount` : Total number of page style recalculations.
|
920
|
-
*
|
921
|
-
* - `LayoutDuration` : Combined durations of all page layouts.
|
922
|
-
*
|
923
|
-
* - `RecalcStyleDuration` : Combined duration of all page style
|
924
|
-
* recalculations.
|
925
|
-
*
|
926
|
-
* - `ScriptDuration` : Combined duration of JavaScript execution.
|
927
|
-
*
|
928
|
-
* - `TaskDuration` : Combined duration of all tasks performed by the browser.
|
929
|
-
*
|
930
|
-
*
|
931
|
-
* - `JSHeapUsedSize` : Used JavaScript heap size.
|
932
|
-
*
|
933
|
-
* - `JSHeapTotalSize` : Total JavaScript heap size.
|
934
|
-
* @remarks
|
935
|
-
* NOTE: All timestamps are in monotonic time: monotonically increasing time
|
936
|
-
* in seconds since an arbitrary point in the past.
|
937
|
-
*/
|
938
|
-
async metrics() {
|
939
|
-
const response = await this._client.send('Performance.getMetrics');
|
940
|
-
return this._buildMetricsObject(response.metrics);
|
941
|
-
}
|
942
|
-
_emitMetrics(event) {
|
943
|
-
this.emit("metrics" /* Metrics */, {
|
944
|
-
title: event.title,
|
945
|
-
metrics: this._buildMetricsObject(event.metrics),
|
946
|
-
});
|
947
|
-
}
|
948
|
-
_buildMetricsObject(metrics) {
|
949
|
-
const result = {};
|
950
|
-
for (const metric of metrics || []) {
|
951
|
-
if (supportedMetrics.has(metric.name))
|
952
|
-
result[metric.name] = metric.value;
|
953
|
-
}
|
954
|
-
return result;
|
955
|
-
}
|
956
|
-
_handleException(exceptionDetails) {
|
957
|
-
const message = helper_js_1.helper.getExceptionMessage(exceptionDetails);
|
958
|
-
const err = new Error(message);
|
959
|
-
err.stack = ''; // Don't report clientside error with a node stack attached
|
960
|
-
this.emit("pageerror" /* PageError */, err);
|
961
|
-
}
|
962
|
-
async _onConsoleAPI(event) {
|
963
|
-
if (event.executionContextId === 0) {
|
964
|
-
// DevTools protocol stores the last 1000 console messages. These
|
965
|
-
// messages are always reported even for removed execution contexts. In
|
966
|
-
// this case, they are marked with executionContextId = 0 and are
|
967
|
-
// reported upon enabling Runtime agent.
|
968
|
-
//
|
969
|
-
// Ignore these messages since:
|
970
|
-
// - there's no execution context we can use to operate with message
|
971
|
-
// arguments
|
972
|
-
// - these messages are reported before Puppeteer clients can subscribe
|
973
|
-
// to the 'console'
|
974
|
-
// page event.
|
975
|
-
//
|
976
|
-
// @see https://github.com/puppeteer/puppeteer/issues/3865
|
977
|
-
return;
|
978
|
-
}
|
979
|
-
const context = this._frameManager.executionContextById(event.executionContextId, this._client);
|
980
|
-
const values = event.args.map((arg) => (0, JSHandle_js_1.createJSHandle)(context, arg));
|
981
|
-
this._addConsoleMessage(event.type, values, event.stackTrace);
|
982
|
-
}
|
983
|
-
async _onBindingCalled(event) {
|
984
|
-
let payload;
|
985
|
-
try {
|
986
|
-
payload = JSON.parse(event.payload);
|
987
|
-
}
|
988
|
-
catch {
|
989
|
-
// The binding was either called by something in the page or it was
|
990
|
-
// called before our wrapper was initialized.
|
991
|
-
return;
|
992
|
-
}
|
993
|
-
const { type, name, seq, args } = payload;
|
994
|
-
if (type !== 'exposedFun' || !this._pageBindings.has(name))
|
995
|
-
return;
|
996
|
-
let expression = null;
|
997
|
-
try {
|
998
|
-
const result = await this._pageBindings.get(name)(...args);
|
999
|
-
expression = helper_js_1.helper.pageBindingDeliverResultString(name, seq, result);
|
1000
|
-
}
|
1001
|
-
catch (error) {
|
1002
|
-
if (error instanceof Error)
|
1003
|
-
expression = helper_js_1.helper.pageBindingDeliverErrorString(name, seq, error.message, error.stack);
|
1004
|
-
else
|
1005
|
-
expression = helper_js_1.helper.pageBindingDeliverErrorValueString(name, seq, error);
|
1006
|
-
}
|
1007
|
-
this._client
|
1008
|
-
.send('Runtime.evaluate', {
|
1009
|
-
expression,
|
1010
|
-
contextId: event.executionContextId,
|
1011
|
-
})
|
1012
|
-
.catch(helper_js_1.debugError);
|
1013
|
-
}
|
1014
|
-
_addConsoleMessage(type, args, stackTrace) {
|
1015
|
-
if (!this.listenerCount("console" /* Console */)) {
|
1016
|
-
args.forEach((arg) => arg.dispose());
|
1017
|
-
return;
|
1018
|
-
}
|
1019
|
-
const textTokens = [];
|
1020
|
-
for (const arg of args) {
|
1021
|
-
const remoteObject = arg._remoteObject;
|
1022
|
-
if (remoteObject.objectId)
|
1023
|
-
textTokens.push(arg.toString());
|
1024
|
-
else
|
1025
|
-
textTokens.push(helper_js_1.helper.valueFromRemoteObject(remoteObject));
|
1026
|
-
}
|
1027
|
-
const stackTraceLocations = [];
|
1028
|
-
if (stackTrace) {
|
1029
|
-
for (const callFrame of stackTrace.callFrames) {
|
1030
|
-
stackTraceLocations.push({
|
1031
|
-
url: callFrame.url,
|
1032
|
-
lineNumber: callFrame.lineNumber,
|
1033
|
-
columnNumber: callFrame.columnNumber,
|
1034
|
-
});
|
1035
|
-
}
|
1036
|
-
}
|
1037
|
-
const message = new ConsoleMessage_js_1.ConsoleMessage(type, textTokens.join(' '), args, stackTraceLocations);
|
1038
|
-
this.emit("console" /* Console */, message);
|
1039
|
-
}
|
1040
|
-
_onDialog(event) {
|
1041
|
-
let dialogType = null;
|
1042
|
-
const validDialogTypes = new Set([
|
1043
|
-
'alert',
|
1044
|
-
'confirm',
|
1045
|
-
'prompt',
|
1046
|
-
'beforeunload',
|
1047
|
-
]);
|
1048
|
-
if (validDialogTypes.has(event.type)) {
|
1049
|
-
dialogType = event.type;
|
1050
|
-
}
|
1051
|
-
(0, assert_js_1.assert)(dialogType, 'Unknown javascript dialog type: ' + event.type);
|
1052
|
-
const dialog = new Dialog_js_1.Dialog(this._client, dialogType, event.message, event.defaultPrompt);
|
1053
|
-
this.emit("dialog" /* Dialog */, dialog);
|
1054
|
-
}
|
1055
|
-
/**
|
1056
|
-
* Resets default white background
|
1057
|
-
*/
|
1058
|
-
async _resetDefaultBackgroundColor() {
|
1059
|
-
await this._client.send('Emulation.setDefaultBackgroundColorOverride');
|
1060
|
-
}
|
1061
|
-
/**
|
1062
|
-
* Hides default white background
|
1063
|
-
*/
|
1064
|
-
async _setTransparentBackgroundColor() {
|
1065
|
-
await this._client.send('Emulation.setDefaultBackgroundColorOverride', {
|
1066
|
-
color: { r: 0, g: 0, b: 0, a: 0 },
|
1067
|
-
});
|
1068
|
-
}
|
1069
|
-
/**
|
1070
|
-
*
|
1071
|
-
* @returns
|
1072
|
-
* @remarks Shortcut for
|
1073
|
-
* {@link Frame.url | page.mainFrame().url()}.
|
1074
|
-
*/
|
1075
|
-
url() {
|
1076
|
-
return this.mainFrame().url();
|
1077
|
-
}
|
1078
|
-
async content() {
|
1079
|
-
return await this._frameManager.mainFrame().content();
|
1080
|
-
}
|
1081
|
-
/**
|
1082
|
-
* @param html - HTML markup to assign to the page.
|
1083
|
-
* @param options - Parameters that has some properties.
|
1084
|
-
* @remarks
|
1085
|
-
* The parameter `options` might have the following options.
|
1086
|
-
*
|
1087
|
-
* - `timeout` : Maximum time in milliseconds for resources to load, defaults
|
1088
|
-
* to 30 seconds, pass `0` to disable timeout. The default value can be
|
1089
|
-
* changed by using the
|
1090
|
-
* {@link Page.setDefaultNavigationTimeout |
|
1091
|
-
* page.setDefaultNavigationTimeout(timeout)}
|
1092
|
-
* or {@link Page.setDefaultTimeout | page.setDefaultTimeout(timeout)}
|
1093
|
-
* methods.
|
1094
|
-
*
|
1095
|
-
* - `waitUntil`: When to consider setting markup succeeded, defaults to `load`.
|
1096
|
-
* Given an array of event strings, setting content is considered to be
|
1097
|
-
* successful after all events have been fired. Events can be either:<br/>
|
1098
|
-
* - `load` : consider setting content to be finished when the `load` event is
|
1099
|
-
* fired.<br/>
|
1100
|
-
* - `domcontentloaded` : consider setting content to be finished when the
|
1101
|
-
* `DOMContentLoaded` event is fired.<br/>
|
1102
|
-
* - `networkidle0` : consider setting content to be finished when there are no
|
1103
|
-
* more than 0 network connections for at least `500` ms.<br/>
|
1104
|
-
* - `networkidle2` : consider setting content to be finished when there are no
|
1105
|
-
* more than 2 network connections for at least `500` ms.
|
1106
|
-
*/
|
1107
|
-
async setContent(html, options = {}) {
|
1108
|
-
await this._frameManager.mainFrame().setContent(html, options);
|
1109
|
-
}
|
1110
|
-
/**
|
1111
|
-
* @param url - URL to navigate page to. The URL should include scheme, e.g.
|
1112
|
-
* `https://`
|
1113
|
-
* @param options - Navigation Parameter
|
1114
|
-
* @returns Promise which resolves to the main resource response. In case of
|
1115
|
-
* multiple redirects, the navigation will resolve with the response of the
|
1116
|
-
* last redirect.
|
1117
|
-
* @remarks
|
1118
|
-
* The argument `options` might have the following properties:
|
1119
|
-
*
|
1120
|
-
* - `timeout` : Maximum navigation time in milliseconds, defaults to 30
|
1121
|
-
* seconds, pass 0 to disable timeout. The default value can be changed by
|
1122
|
-
* using the
|
1123
|
-
* {@link Page.setDefaultNavigationTimeout |
|
1124
|
-
* page.setDefaultNavigationTimeout(timeout)}
|
1125
|
-
* or {@link Page.setDefaultTimeout | page.setDefaultTimeout(timeout)}
|
1126
|
-
* methods.
|
1127
|
-
*
|
1128
|
-
* - `waitUntil`:When to consider navigation succeeded, defaults to `load`.
|
1129
|
-
* Given an array of event strings, navigation is considered to be successful
|
1130
|
-
* after all events have been fired. Events can be either:<br/>
|
1131
|
-
* - `load` : consider navigation to be finished when the load event is
|
1132
|
-
* fired.<br/>
|
1133
|
-
* - `domcontentloaded` : consider navigation to be finished when the
|
1134
|
-
* DOMContentLoaded event is fired.<br/>
|
1135
|
-
* - `networkidle0` : consider navigation to be finished when there are no
|
1136
|
-
* more than 0 network connections for at least `500` ms.<br/>
|
1137
|
-
* - `networkidle2` : consider navigation to be finished when there are no
|
1138
|
-
* more than 2 network connections for at least `500` ms.
|
1139
|
-
*
|
1140
|
-
* - `referer` : Referer header value. If provided it will take preference
|
1141
|
-
* over the referer header value set by
|
1142
|
-
* {@link Page.setExtraHTTPHeaders |page.setExtraHTTPHeaders()}.
|
1143
|
-
*
|
1144
|
-
* `page.goto` will throw an error if:
|
1145
|
-
* - there's an SSL error (e.g. in case of self-signed certificates).
|
1146
|
-
* - target URL is invalid.
|
1147
|
-
* - the timeout is exceeded during navigation.
|
1148
|
-
* - the remote server does not respond or is unreachable.
|
1149
|
-
* - the main resource failed to load.
|
1150
|
-
*
|
1151
|
-
* `page.goto` will not throw an error when any valid HTTP status code is
|
1152
|
-
* returned by the remote server, including 404 "Not Found" and 500
|
1153
|
-
* "Internal Server Error". The status code for such responses can be
|
1154
|
-
* retrieved by calling response.status().
|
1155
|
-
*
|
1156
|
-
* NOTE: `page.goto` either throws an error or returns a main resource
|
1157
|
-
* response. The only exceptions are navigation to about:blank or navigation
|
1158
|
-
* to the same URL with a different hash, which would succeed and return null.
|
1159
|
-
*
|
1160
|
-
* NOTE: Headless mode doesn't support navigation to a PDF document. See the
|
1161
|
-
* {@link https://bugs.chromium.org/p/chromium/issues/detail?id=761295
|
1162
|
-
* | upstream issue}.
|
1163
|
-
*
|
1164
|
-
* Shortcut for {@link Frame.goto | page.mainFrame().goto(url, options)}.
|
1165
|
-
*/
|
1166
|
-
async goto(url, options = {}) {
|
1167
|
-
return await this._frameManager.mainFrame().goto(url, options);
|
1168
|
-
}
|
1169
|
-
/**
|
1170
|
-
* @param options - Navigation parameters which might have the following
|
1171
|
-
* properties:
|
1172
|
-
* @returns Promise which resolves to the main resource response. In case of
|
1173
|
-
* multiple redirects, the navigation will resolve with the response of the
|
1174
|
-
* last redirect.
|
1175
|
-
* @remarks
|
1176
|
-
* The argument `options` might have the following properties:
|
1177
|
-
*
|
1178
|
-
* - `timeout` : Maximum navigation time in milliseconds, defaults to 30
|
1179
|
-
* seconds, pass 0 to disable timeout. The default value can be changed by
|
1180
|
-
* using the
|
1181
|
-
* {@link Page.setDefaultNavigationTimeout |
|
1182
|
-
* page.setDefaultNavigationTimeout(timeout)}
|
1183
|
-
* or {@link Page.setDefaultTimeout | page.setDefaultTimeout(timeout)}
|
1184
|
-
* methods.
|
1185
|
-
*
|
1186
|
-
* - `waitUntil`: When to consider navigation succeeded, defaults to `load`.
|
1187
|
-
* Given an array of event strings, navigation is considered to be
|
1188
|
-
* successful after all events have been fired. Events can be either:<br/>
|
1189
|
-
* - `load` : consider navigation to be finished when the load event is fired.<br/>
|
1190
|
-
* - `domcontentloaded` : consider navigation to be finished when the
|
1191
|
-
* DOMContentLoaded event is fired.<br/>
|
1192
|
-
* - `networkidle0` : consider navigation to be finished when there are no
|
1193
|
-
* more than 0 network connections for at least `500` ms.<br/>
|
1194
|
-
* - `networkidle2` : consider navigation to be finished when there are no
|
1195
|
-
* more than 2 network connections for at least `500` ms.
|
1196
|
-
*/
|
1197
|
-
async reload(options) {
|
1198
|
-
const result = await Promise.all([
|
1199
|
-
this.waitForNavigation(options),
|
1200
|
-
this._client.send('Page.reload'),
|
1201
|
-
]);
|
1202
|
-
return result[0];
|
1203
|
-
}
|
1204
|
-
/**
|
1205
|
-
* This resolves when the page navigates to a new URL or reloads. It is useful
|
1206
|
-
* when you run code that will indirectly cause the page to navigate. Consider
|
1207
|
-
* this example:
|
1208
|
-
* ```js
|
1209
|
-
* const [response] = await Promise.all([
|
1210
|
-
* page.waitForNavigation(), // The promise resolves after navigation has finished
|
1211
|
-
* page.click('a.my-link'), // Clicking the link will indirectly cause a navigation
|
1212
|
-
* ]);
|
1213
|
-
* ```
|
1214
|
-
*
|
1215
|
-
* @param options - Navigation parameters which might have the following properties:
|
1216
|
-
* @returns Promise which resolves to the main resource response. In case of
|
1217
|
-
* multiple redirects, the navigation will resolve with the response of the
|
1218
|
-
* last redirect. In case of navigation to a different anchor or navigation
|
1219
|
-
* due to History API usage, the navigation will resolve with `null`.
|
1220
|
-
* @remarks
|
1221
|
-
* NOTE: Usage of the
|
1222
|
-
* {@link https://developer.mozilla.org/en-US/docs/Web/API/History_API | History API}
|
1223
|
-
* to change the URL is considered a navigation.
|
1224
|
-
*
|
1225
|
-
* Shortcut for
|
1226
|
-
* {@link Frame.waitForNavigation | page.mainFrame().waitForNavigation(options)}.
|
1227
|
-
*/
|
1228
|
-
async waitForNavigation(options = {}) {
|
1229
|
-
return await this._frameManager.mainFrame().waitForNavigation(options);
|
1230
|
-
}
|
1231
|
-
_sessionClosePromise() {
|
1232
|
-
if (!this._disconnectPromise)
|
1233
|
-
this._disconnectPromise = new Promise((fulfill) => this._client.once(Connection_js_1.CDPSessionEmittedEvents.Disconnected, () => fulfill(new Error('Target closed'))));
|
1234
|
-
return this._disconnectPromise;
|
1235
|
-
}
|
1236
|
-
/**
|
1237
|
-
* @param urlOrPredicate - A URL or predicate to wait for
|
1238
|
-
* @param options - Optional waiting parameters
|
1239
|
-
* @returns Promise which resolves to the matched response
|
1240
|
-
* @example
|
1241
|
-
* ```js
|
1242
|
-
* const firstResponse = await page.waitForResponse(
|
1243
|
-
* 'https://example.com/resource'
|
1244
|
-
* );
|
1245
|
-
* const finalResponse = await page.waitForResponse(
|
1246
|
-
* (response) =>
|
1247
|
-
* response.url() === 'https://example.com' && response.status() === 200
|
1248
|
-
* );
|
1249
|
-
* const finalResponse = await page.waitForResponse(async (response) => {
|
1250
|
-
* return (await response.text()).includes('<html>');
|
1251
|
-
* });
|
1252
|
-
* return finalResponse.ok();
|
1253
|
-
* ```
|
1254
|
-
* @remarks
|
1255
|
-
* Optional Waiting Parameters have:
|
1256
|
-
*
|
1257
|
-
* - `timeout`: Maximum wait time in milliseconds, defaults to `30` seconds, pass
|
1258
|
-
* `0` to disable the timeout. The default value can be changed by using the
|
1259
|
-
* {@link Page.setDefaultTimeout} method.
|
1260
|
-
*/
|
1261
|
-
async waitForRequest(urlOrPredicate, options = {}) {
|
1262
|
-
const { timeout = this._timeoutSettings.timeout() } = options;
|
1263
|
-
return helper_js_1.helper.waitForEvent(this._frameManager.networkManager(), NetworkManager_js_1.NetworkManagerEmittedEvents.Request, (request) => {
|
1264
|
-
if (helper_js_1.helper.isString(urlOrPredicate))
|
1265
|
-
return urlOrPredicate === request.url();
|
1266
|
-
if (typeof urlOrPredicate === 'function')
|
1267
|
-
return !!urlOrPredicate(request);
|
1268
|
-
return false;
|
1269
|
-
}, timeout, this._sessionClosePromise());
|
1270
|
-
}
|
1271
|
-
/**
|
1272
|
-
* @param urlOrPredicate - A URL or predicate to wait for.
|
1273
|
-
* @param options - Optional waiting parameters
|
1274
|
-
* @returns Promise which resolves to the matched response.
|
1275
|
-
* @example
|
1276
|
-
* ```js
|
1277
|
-
* const firstResponse = await page.waitForResponse(
|
1278
|
-
* 'https://example.com/resource'
|
1279
|
-
* );
|
1280
|
-
* const finalResponse = await page.waitForResponse(
|
1281
|
-
* (response) =>
|
1282
|
-
* response.url() === 'https://example.com' && response.status() === 200
|
1283
|
-
* );
|
1284
|
-
* const finalResponse = await page.waitForResponse(async (response) => {
|
1285
|
-
* return (await response.text()).includes('<html>');
|
1286
|
-
* });
|
1287
|
-
* return finalResponse.ok();
|
1288
|
-
* ```
|
1289
|
-
* @remarks
|
1290
|
-
* Optional Parameter have:
|
1291
|
-
*
|
1292
|
-
* - `timeout`: Maximum wait time in milliseconds, defaults to `30` seconds,
|
1293
|
-
* pass `0` to disable the timeout. The default value can be changed by using
|
1294
|
-
* the {@link Page.setDefaultTimeout} method.
|
1295
|
-
*/
|
1296
|
-
async waitForResponse(urlOrPredicate, options = {}) {
|
1297
|
-
const { timeout = this._timeoutSettings.timeout() } = options;
|
1298
|
-
return helper_js_1.helper.waitForEvent(this._frameManager.networkManager(), NetworkManager_js_1.NetworkManagerEmittedEvents.Response, async (response) => {
|
1299
|
-
if (helper_js_1.helper.isString(urlOrPredicate))
|
1300
|
-
return urlOrPredicate === response.url();
|
1301
|
-
if (typeof urlOrPredicate === 'function')
|
1302
|
-
return !!(await urlOrPredicate(response));
|
1303
|
-
return false;
|
1304
|
-
}, timeout, this._sessionClosePromise());
|
1305
|
-
}
|
1306
|
-
/**
|
1307
|
-
* @param options - Optional waiting parameters
|
1308
|
-
* @returns Promise which resolves when network is idle
|
1309
|
-
*/
|
1310
|
-
async waitForNetworkIdle(options = {}) {
|
1311
|
-
const { idleTime = 500, timeout = this._timeoutSettings.timeout() } = options;
|
1312
|
-
const networkManager = this._frameManager.networkManager();
|
1313
|
-
let idleResolveCallback;
|
1314
|
-
const idlePromise = new Promise((resolve) => {
|
1315
|
-
idleResolveCallback = resolve;
|
1316
|
-
});
|
1317
|
-
let abortRejectCallback;
|
1318
|
-
const abortPromise = new Promise((_, reject) => {
|
1319
|
-
abortRejectCallback = reject;
|
1320
|
-
});
|
1321
|
-
let idleTimer;
|
1322
|
-
const onIdle = () => idleResolveCallback();
|
1323
|
-
const cleanup = () => {
|
1324
|
-
idleTimer && clearTimeout(idleTimer);
|
1325
|
-
abortRejectCallback(new Error('abort'));
|
1326
|
-
};
|
1327
|
-
const evaluate = () => {
|
1328
|
-
idleTimer && clearTimeout(idleTimer);
|
1329
|
-
if (networkManager.numRequestsInProgress() === 0)
|
1330
|
-
idleTimer = setTimeout(onIdle, idleTime);
|
1331
|
-
};
|
1332
|
-
evaluate();
|
1333
|
-
const eventHandler = () => {
|
1334
|
-
evaluate();
|
1335
|
-
return false;
|
1336
|
-
};
|
1337
|
-
const listenToEvent = (event) => helper_js_1.helper.waitForEvent(networkManager, event, eventHandler, timeout, abortPromise);
|
1338
|
-
const eventPromises = [
|
1339
|
-
listenToEvent(NetworkManager_js_1.NetworkManagerEmittedEvents.Request),
|
1340
|
-
listenToEvent(NetworkManager_js_1.NetworkManagerEmittedEvents.Response),
|
1341
|
-
];
|
1342
|
-
await Promise.race([
|
1343
|
-
idlePromise,
|
1344
|
-
...eventPromises,
|
1345
|
-
this._sessionClosePromise(),
|
1346
|
-
]).then((r) => {
|
1347
|
-
cleanup();
|
1348
|
-
return r;
|
1349
|
-
}, (error) => {
|
1350
|
-
cleanup();
|
1351
|
-
throw error;
|
1352
|
-
});
|
1353
|
-
}
|
1354
|
-
/**
|
1355
|
-
* @param urlOrPredicate - A URL or predicate to wait for.
|
1356
|
-
* @param options - Optional waiting parameters
|
1357
|
-
* @returns Promise which resolves to the matched frame.
|
1358
|
-
* @example
|
1359
|
-
* ```js
|
1360
|
-
* const frame = await page.waitForFrame(async (frame) => {
|
1361
|
-
* return frame.name() === 'Test';
|
1362
|
-
* });
|
1363
|
-
* ```
|
1364
|
-
* @remarks
|
1365
|
-
* Optional Parameter have:
|
1366
|
-
*
|
1367
|
-
* - `timeout`: Maximum wait time in milliseconds, defaults to `30` seconds,
|
1368
|
-
* pass `0` to disable the timeout. The default value can be changed by using
|
1369
|
-
* the {@link Page.setDefaultTimeout} method.
|
1370
|
-
*/
|
1371
|
-
async waitForFrame(urlOrPredicate, options = {}) {
|
1372
|
-
const { timeout = this._timeoutSettings.timeout() } = options;
|
1373
|
-
async function predicate(frame) {
|
1374
|
-
if (helper_js_1.helper.isString(urlOrPredicate))
|
1375
|
-
return urlOrPredicate === frame.url();
|
1376
|
-
if (typeof urlOrPredicate === 'function')
|
1377
|
-
return !!(await urlOrPredicate(frame));
|
1378
|
-
return false;
|
1379
|
-
}
|
1380
|
-
return Promise.race([
|
1381
|
-
helper_js_1.helper.waitForEvent(this._frameManager, FrameManager_js_1.FrameManagerEmittedEvents.FrameAttached, predicate, timeout, this._sessionClosePromise()),
|
1382
|
-
helper_js_1.helper.waitForEvent(this._frameManager, FrameManager_js_1.FrameManagerEmittedEvents.FrameNavigated, predicate, timeout, this._sessionClosePromise()),
|
1383
|
-
]);
|
1384
|
-
}
|
1385
|
-
/**
|
1386
|
-
* This method navigate to the previous page in history.
|
1387
|
-
* @param options - Navigation parameters
|
1388
|
-
* @returns Promise which resolves to the main resource response. In case of
|
1389
|
-
* multiple redirects, the navigation will resolve with the response of the
|
1390
|
-
* last redirect. If can not go back, resolves to `null`.
|
1391
|
-
* @remarks
|
1392
|
-
* The argument `options` might have the following properties:
|
1393
|
-
*
|
1394
|
-
* - `timeout` : Maximum navigation time in milliseconds, defaults to 30
|
1395
|
-
* seconds, pass 0 to disable timeout. The default value can be changed by
|
1396
|
-
* using the
|
1397
|
-
* {@link Page.setDefaultNavigationTimeout
|
1398
|
-
* | page.setDefaultNavigationTimeout(timeout)}
|
1399
|
-
* or {@link Page.setDefaultTimeout | page.setDefaultTimeout(timeout)}
|
1400
|
-
* methods.
|
1401
|
-
*
|
1402
|
-
* - `waitUntil` : When to consider navigation succeeded, defaults to `load`.
|
1403
|
-
* Given an array of event strings, navigation is considered to be
|
1404
|
-
* successful after all events have been fired. Events can be either:<br/>
|
1405
|
-
* - `load` : consider navigation to be finished when the load event is fired.<br/>
|
1406
|
-
* - `domcontentloaded` : consider navigation to be finished when the
|
1407
|
-
* DOMContentLoaded event is fired.<br/>
|
1408
|
-
* - `networkidle0` : consider navigation to be finished when there are no
|
1409
|
-
* more than 0 network connections for at least `500` ms.<br/>
|
1410
|
-
* - `networkidle2` : consider navigation to be finished when there are no
|
1411
|
-
* more than 2 network connections for at least `500` ms.
|
1412
|
-
*/
|
1413
|
-
async goBack(options = {}) {
|
1414
|
-
return this._go(-1, options);
|
1415
|
-
}
|
1416
|
-
/**
|
1417
|
-
* This method navigate to the next page in history.
|
1418
|
-
* @param options - Navigation Parameter
|
1419
|
-
* @returns Promise which resolves to the main resource response. In case of
|
1420
|
-
* multiple redirects, the navigation will resolve with the response of the
|
1421
|
-
* last redirect. If can not go forward, resolves to `null`.
|
1422
|
-
* @remarks
|
1423
|
-
* The argument `options` might have the following properties:
|
1424
|
-
*
|
1425
|
-
* - `timeout` : Maximum navigation time in milliseconds, defaults to 30
|
1426
|
-
* seconds, pass 0 to disable timeout. The default value can be changed by
|
1427
|
-
* using the
|
1428
|
-
* {@link Page.setDefaultNavigationTimeout
|
1429
|
-
* | page.setDefaultNavigationTimeout(timeout)}
|
1430
|
-
* or {@link Page.setDefaultTimeout | page.setDefaultTimeout(timeout)}
|
1431
|
-
* methods.
|
1432
|
-
*
|
1433
|
-
* - `waitUntil`: When to consider navigation succeeded, defaults to `load`.
|
1434
|
-
* Given an array of event strings, navigation is considered to be
|
1435
|
-
* successful after all events have been fired. Events can be either:<br/>
|
1436
|
-
* - `load` : consider navigation to be finished when the load event is fired.<br/>
|
1437
|
-
* - `domcontentloaded` : consider navigation to be finished when the
|
1438
|
-
* DOMContentLoaded event is fired.<br/>
|
1439
|
-
* - `networkidle0` : consider navigation to be finished when there are no
|
1440
|
-
* more than 0 network connections for at least `500` ms.<br/>
|
1441
|
-
* - `networkidle2` : consider navigation to be finished when there are no
|
1442
|
-
* more than 2 network connections for at least `500` ms.
|
1443
|
-
*/
|
1444
|
-
async goForward(options = {}) {
|
1445
|
-
return this._go(+1, options);
|
1446
|
-
}
|
1447
|
-
async _go(delta, options) {
|
1448
|
-
const history = await this._client.send('Page.getNavigationHistory');
|
1449
|
-
const entry = history.entries[history.currentIndex + delta];
|
1450
|
-
if (!entry)
|
1451
|
-
return null;
|
1452
|
-
const result = await Promise.all([
|
1453
|
-
this.waitForNavigation(options),
|
1454
|
-
this._client.send('Page.navigateToHistoryEntry', { entryId: entry.id }),
|
1455
|
-
]);
|
1456
|
-
return result[0];
|
1457
|
-
}
|
1458
|
-
/**
|
1459
|
-
* Brings page to front (activates tab).
|
1460
|
-
*/
|
1461
|
-
async bringToFront() {
|
1462
|
-
await this._client.send('Page.bringToFront');
|
1463
|
-
}
|
1464
|
-
/**
|
1465
|
-
* Emulates given device metrics and user agent. This method is a shortcut for
|
1466
|
-
* calling two methods: {@link Page.setUserAgent} and {@link Page.setViewport}
|
1467
|
-
* To aid emulation, Puppeteer provides a list of device descriptors that can
|
1468
|
-
* be obtained via the {@link Puppeteer.devices} `page.emulate` will resize
|
1469
|
-
* the page. A lot of websites don't expect phones to change size, so you
|
1470
|
-
* should emulate before navigating to the page.
|
1471
|
-
* @example
|
1472
|
-
* ```js
|
1473
|
-
* const puppeteer = require('puppeteer');
|
1474
|
-
* const iPhone = puppeteer.devices['iPhone 6'];
|
1475
|
-
* (async () => {
|
1476
|
-
* const browser = await puppeteer.launch();
|
1477
|
-
* const page = await browser.newPage();
|
1478
|
-
* await page.emulate(iPhone);
|
1479
|
-
* await page.goto('https://www.google.com');
|
1480
|
-
* // other actions...
|
1481
|
-
* await browser.close();
|
1482
|
-
* })();
|
1483
|
-
* ```
|
1484
|
-
* @remarks List of all available devices is available in the source code:
|
1485
|
-
* {@link https://github.com/puppeteer/puppeteer/blob/main/src/common/DeviceDescriptors.ts | src/common/DeviceDescriptors.ts}.
|
1486
|
-
*/
|
1487
|
-
async emulate(options) {
|
1488
|
-
await Promise.all([
|
1489
|
-
this.setViewport(options.viewport),
|
1490
|
-
this.setUserAgent(options.userAgent),
|
1491
|
-
]);
|
1492
|
-
}
|
1493
|
-
/**
|
1494
|
-
* @param enabled - Whether or not to enable JavaScript on the page.
|
1495
|
-
* @returns
|
1496
|
-
* @remarks
|
1497
|
-
* NOTE: changing this value won't affect scripts that have already been run.
|
1498
|
-
* It will take full effect on the next navigation.
|
1499
|
-
*/
|
1500
|
-
async setJavaScriptEnabled(enabled) {
|
1501
|
-
if (this._javascriptEnabled === enabled)
|
1502
|
-
return;
|
1503
|
-
this._javascriptEnabled = enabled;
|
1504
|
-
await this._client.send('Emulation.setScriptExecutionDisabled', {
|
1505
|
-
value: !enabled,
|
1506
|
-
});
|
1507
|
-
}
|
1508
|
-
/**
|
1509
|
-
* Toggles bypassing page's Content-Security-Policy.
|
1510
|
-
* @param enabled - sets bypassing of page's Content-Security-Policy.
|
1511
|
-
* @remarks
|
1512
|
-
* NOTE: CSP bypassing happens at the moment of CSP initialization rather than
|
1513
|
-
* evaluation. Usually, this means that `page.setBypassCSP` should be called
|
1514
|
-
* before navigating to the domain.
|
1515
|
-
*/
|
1516
|
-
async setBypassCSP(enabled) {
|
1517
|
-
await this._client.send('Page.setBypassCSP', { enabled });
|
1518
|
-
}
|
1519
|
-
/**
|
1520
|
-
* @param type - Changes the CSS media type of the page. The only allowed
|
1521
|
-
* values are `screen`, `print` and `null`. Passing `null` disables CSS media
|
1522
|
-
* emulation.
|
1523
|
-
* @example
|
1524
|
-
* ```
|
1525
|
-
* await page.evaluate(() => matchMedia('screen').matches);
|
1526
|
-
* // → true
|
1527
|
-
* await page.evaluate(() => matchMedia('print').matches);
|
1528
|
-
* // → false
|
1529
|
-
*
|
1530
|
-
* await page.emulateMediaType('print');
|
1531
|
-
* await page.evaluate(() => matchMedia('screen').matches);
|
1532
|
-
* // → false
|
1533
|
-
* await page.evaluate(() => matchMedia('print').matches);
|
1534
|
-
* // → true
|
1535
|
-
*
|
1536
|
-
* await page.emulateMediaType(null);
|
1537
|
-
* await page.evaluate(() => matchMedia('screen').matches);
|
1538
|
-
* // → true
|
1539
|
-
* await page.evaluate(() => matchMedia('print').matches);
|
1540
|
-
* // → false
|
1541
|
-
* ```
|
1542
|
-
*/
|
1543
|
-
async emulateMediaType(type) {
|
1544
|
-
(0, assert_js_1.assert)(type === 'screen' || type === 'print' || type === null, 'Unsupported media type: ' + type);
|
1545
|
-
await this._client.send('Emulation.setEmulatedMedia', {
|
1546
|
-
media: type || '',
|
1547
|
-
});
|
1548
|
-
}
|
1549
|
-
/**
|
1550
|
-
* Enables CPU throttling to emulate slow CPUs.
|
1551
|
-
* @param factor - slowdown factor (1 is no throttle, 2 is 2x slowdown, etc).
|
1552
|
-
*/
|
1553
|
-
async emulateCPUThrottling(factor) {
|
1554
|
-
(0, assert_js_1.assert)(factor === null || factor >= 1, 'Throttling rate should be greater or equal to 1');
|
1555
|
-
await this._client.send('Emulation.setCPUThrottlingRate', {
|
1556
|
-
rate: factor !== null ? factor : 1,
|
1557
|
-
});
|
1558
|
-
}
|
1559
|
-
/**
|
1560
|
-
* @param features - `<?Array<Object>>` Given an array of media feature
|
1561
|
-
* objects, emulates CSS media features on the page. Each media feature object
|
1562
|
-
* must have the following properties:
|
1563
|
-
* @example
|
1564
|
-
* ```js
|
1565
|
-
* await page.emulateMediaFeatures([
|
1566
|
-
* { name: 'prefers-color-scheme', value: 'dark' },
|
1567
|
-
* ]);
|
1568
|
-
* await page.evaluate(() => matchMedia('(prefers-color-scheme: dark)').matches);
|
1569
|
-
* // → true
|
1570
|
-
* await page.evaluate(() => matchMedia('(prefers-color-scheme: light)').matches);
|
1571
|
-
* // → false
|
1572
|
-
*
|
1573
|
-
* await page.emulateMediaFeatures([
|
1574
|
-
* { name: 'prefers-reduced-motion', value: 'reduce' },
|
1575
|
-
* ]);
|
1576
|
-
* await page.evaluate(
|
1577
|
-
* () => matchMedia('(prefers-reduced-motion: reduce)').matches
|
1578
|
-
* );
|
1579
|
-
* // → true
|
1580
|
-
* await page.evaluate(
|
1581
|
-
* () => matchMedia('(prefers-reduced-motion: no-preference)').matches
|
1582
|
-
* );
|
1583
|
-
* // → false
|
1584
|
-
*
|
1585
|
-
* await page.emulateMediaFeatures([
|
1586
|
-
* { name: 'prefers-color-scheme', value: 'dark' },
|
1587
|
-
* { name: 'prefers-reduced-motion', value: 'reduce' },
|
1588
|
-
* ]);
|
1589
|
-
* await page.evaluate(() => matchMedia('(prefers-color-scheme: dark)').matches);
|
1590
|
-
* // → true
|
1591
|
-
* await page.evaluate(() => matchMedia('(prefers-color-scheme: light)').matches);
|
1592
|
-
* // → false
|
1593
|
-
* await page.evaluate(
|
1594
|
-
* () => matchMedia('(prefers-reduced-motion: reduce)').matches
|
1595
|
-
* );
|
1596
|
-
* // → true
|
1597
|
-
* await page.evaluate(
|
1598
|
-
* () => matchMedia('(prefers-reduced-motion: no-preference)').matches
|
1599
|
-
* );
|
1600
|
-
* // → false
|
1601
|
-
*
|
1602
|
-
* await page.emulateMediaFeatures([{ name: 'color-gamut', value: 'p3' }]);
|
1603
|
-
* await page.evaluate(() => matchMedia('(color-gamut: srgb)').matches);
|
1604
|
-
* // → true
|
1605
|
-
* await page.evaluate(() => matchMedia('(color-gamut: p3)').matches);
|
1606
|
-
* // → true
|
1607
|
-
* await page.evaluate(() => matchMedia('(color-gamut: rec2020)').matches);
|
1608
|
-
* // → false
|
1609
|
-
* ```
|
1610
|
-
*/
|
1611
|
-
async emulateMediaFeatures(features) {
|
1612
|
-
if (features === null)
|
1613
|
-
await this._client.send('Emulation.setEmulatedMedia', { features: null });
|
1614
|
-
if (Array.isArray(features)) {
|
1615
|
-
features.every((mediaFeature) => {
|
1616
|
-
const name = mediaFeature.name;
|
1617
|
-
(0, assert_js_1.assert)(/^(?:prefers-(?:color-scheme|reduced-motion)|color-gamut)$/.test(name), 'Unsupported media feature: ' + name);
|
1618
|
-
return true;
|
1619
|
-
});
|
1620
|
-
await this._client.send('Emulation.setEmulatedMedia', {
|
1621
|
-
features: features,
|
1622
|
-
});
|
1623
|
-
}
|
1624
|
-
}
|
1625
|
-
/**
|
1626
|
-
* @param timezoneId - Changes the timezone of the page. See
|
1627
|
-
* {@link https://source.chromium.org/chromium/chromium/deps/icu.git/+/faee8bc70570192d82d2978a71e2a615788597d1:source/data/misc/metaZones.txt | ICU’s metaZones.txt}
|
1628
|
-
* for a list of supported timezone IDs. Passing
|
1629
|
-
* `null` disables timezone emulation.
|
1630
|
-
*/
|
1631
|
-
async emulateTimezone(timezoneId) {
|
1632
|
-
try {
|
1633
|
-
await this._client.send('Emulation.setTimezoneOverride', {
|
1634
|
-
timezoneId: timezoneId || '',
|
1635
|
-
});
|
1636
|
-
}
|
1637
|
-
catch (error) {
|
1638
|
-
if (error.message.includes('Invalid timezone'))
|
1639
|
-
throw new Error(`Invalid timezone ID: ${timezoneId}`);
|
1640
|
-
throw error;
|
1641
|
-
}
|
1642
|
-
}
|
1643
|
-
/**
|
1644
|
-
* Emulates the idle state.
|
1645
|
-
* If no arguments set, clears idle state emulation.
|
1646
|
-
*
|
1647
|
-
* @example
|
1648
|
-
* ```js
|
1649
|
-
* // set idle emulation
|
1650
|
-
* await page.emulateIdleState({isUserActive: true, isScreenUnlocked: false});
|
1651
|
-
*
|
1652
|
-
* // do some checks here
|
1653
|
-
* ...
|
1654
|
-
*
|
1655
|
-
* // clear idle emulation
|
1656
|
-
* await page.emulateIdleState();
|
1657
|
-
* ```
|
1658
|
-
*
|
1659
|
-
* @param overrides - Mock idle state. If not set, clears idle overrides
|
1660
|
-
*/
|
1661
|
-
async emulateIdleState(overrides) {
|
1662
|
-
if (overrides) {
|
1663
|
-
await this._client.send('Emulation.setIdleOverride', {
|
1664
|
-
isUserActive: overrides.isUserActive,
|
1665
|
-
isScreenUnlocked: overrides.isScreenUnlocked,
|
1666
|
-
});
|
1667
|
-
}
|
1668
|
-
else {
|
1669
|
-
await this._client.send('Emulation.clearIdleOverride');
|
1670
|
-
}
|
1671
|
-
}
|
1672
|
-
/**
|
1673
|
-
* Simulates the given vision deficiency on the page.
|
1674
|
-
*
|
1675
|
-
* @example
|
1676
|
-
* ```js
|
1677
|
-
* const puppeteer = require('puppeteer');
|
1678
|
-
*
|
1679
|
-
* (async () => {
|
1680
|
-
* const browser = await puppeteer.launch();
|
1681
|
-
* const page = await browser.newPage();
|
1682
|
-
* await page.goto('https://v8.dev/blog/10-years');
|
1683
|
-
*
|
1684
|
-
* await page.emulateVisionDeficiency('achromatopsia');
|
1685
|
-
* await page.screenshot({ path: 'achromatopsia.png' });
|
1686
|
-
*
|
1687
|
-
* await page.emulateVisionDeficiency('deuteranopia');
|
1688
|
-
* await page.screenshot({ path: 'deuteranopia.png' });
|
1689
|
-
*
|
1690
|
-
* await page.emulateVisionDeficiency('blurredVision');
|
1691
|
-
* await page.screenshot({ path: 'blurred-vision.png' });
|
1692
|
-
*
|
1693
|
-
* await browser.close();
|
1694
|
-
* })();
|
1695
|
-
* ```
|
1696
|
-
*
|
1697
|
-
* @param type - the type of deficiency to simulate, or `'none'` to reset.
|
1698
|
-
*/
|
1699
|
-
async emulateVisionDeficiency(type) {
|
1700
|
-
const visionDeficiencies = new Set([
|
1701
|
-
'none',
|
1702
|
-
'achromatopsia',
|
1703
|
-
'blurredVision',
|
1704
|
-
'deuteranopia',
|
1705
|
-
'protanopia',
|
1706
|
-
'tritanopia',
|
1707
|
-
]);
|
1708
|
-
try {
|
1709
|
-
(0, assert_js_1.assert)(!type || visionDeficiencies.has(type), `Unsupported vision deficiency: ${type}`);
|
1710
|
-
await this._client.send('Emulation.setEmulatedVisionDeficiency', {
|
1711
|
-
type: type || 'none',
|
1712
|
-
});
|
1713
|
-
}
|
1714
|
-
catch (error) {
|
1715
|
-
throw error;
|
1716
|
-
}
|
1717
|
-
}
|
1718
|
-
/**
|
1719
|
-
* `page.setViewport` will resize the page. A lot of websites don't expect
|
1720
|
-
* phones to change size, so you should set the viewport before navigating to
|
1721
|
-
* the page.
|
1722
|
-
*
|
1723
|
-
* In the case of multiple pages in a single browser, each page can have its
|
1724
|
-
* own viewport size.
|
1725
|
-
* @example
|
1726
|
-
* ```js
|
1727
|
-
* const page = await browser.newPage();
|
1728
|
-
* await page.setViewport({
|
1729
|
-
* width: 640,
|
1730
|
-
* height: 480,
|
1731
|
-
* deviceScaleFactor: 1,
|
1732
|
-
* });
|
1733
|
-
* await page.goto('https://example.com');
|
1734
|
-
* ```
|
1735
|
-
*
|
1736
|
-
* @param viewport -
|
1737
|
-
* @remarks
|
1738
|
-
* Argument viewport have following properties:
|
1739
|
-
*
|
1740
|
-
* - `width`: page width in pixels. required
|
1741
|
-
*
|
1742
|
-
* - `height`: page height in pixels. required
|
1743
|
-
*
|
1744
|
-
* - `deviceScaleFactor`: Specify device scale factor (can be thought of as
|
1745
|
-
* DPR). Defaults to `1`.
|
1746
|
-
*
|
1747
|
-
* - `isMobile`: Whether the meta viewport tag is taken into account. Defaults
|
1748
|
-
* to `false`.
|
1749
|
-
*
|
1750
|
-
* - `hasTouch`: Specifies if viewport supports touch events. Defaults to `false`
|
1751
|
-
*
|
1752
|
-
* - `isLandScape`: Specifies if viewport is in landscape mode. Defaults to false.
|
1753
|
-
*
|
1754
|
-
* NOTE: in certain cases, setting viewport will reload the page in order to
|
1755
|
-
* set the isMobile or hasTouch properties.
|
1756
|
-
*/
|
1757
|
-
async setViewport(viewport) {
|
1758
|
-
const needsReload = await this._emulationManager.emulateViewport(viewport);
|
1759
|
-
this._viewport = viewport;
|
1760
|
-
if (needsReload)
|
1761
|
-
await this.reload();
|
1762
|
-
}
|
1763
|
-
/**
|
1764
|
-
* @returns
|
1765
|
-
*
|
1766
|
-
* - `width`: page's width in pixels
|
1767
|
-
*
|
1768
|
-
* - `height`: page's height in pixels
|
1769
|
-
*
|
1770
|
-
* - `deviceScalarFactor`: Specify device scale factor (can be though of as
|
1771
|
-
* dpr). Defaults to `1`.
|
1772
|
-
*
|
1773
|
-
* - `isMobile`: Whether the meta viewport tag is taken into account. Defaults
|
1774
|
-
* to `false`.
|
1775
|
-
*
|
1776
|
-
* - `hasTouch`: Specifies if viewport supports touch events. Defaults to
|
1777
|
-
* `false`.
|
1778
|
-
*
|
1779
|
-
* - `isLandScape`: Specifies if viewport is in landscape mode. Defaults to
|
1780
|
-
* `false`.
|
1781
|
-
*/
|
1782
|
-
viewport() {
|
1783
|
-
return this._viewport;
|
1784
|
-
}
|
1785
|
-
/**
|
1786
|
-
* @remarks
|
1787
|
-
*
|
1788
|
-
* Evaluates a function in the page's context and returns the result.
|
1789
|
-
*
|
1790
|
-
* If the function passed to `page.evaluteHandle` returns a Promise, the
|
1791
|
-
* function will wait for the promise to resolve and return its value.
|
1792
|
-
*
|
1793
|
-
* @example
|
1794
|
-
*
|
1795
|
-
* ```js
|
1796
|
-
* const result = await frame.evaluate(() => {
|
1797
|
-
* return Promise.resolve(8 * 7);
|
1798
|
-
* });
|
1799
|
-
* console.log(result); // prints "56"
|
1800
|
-
* ```
|
1801
|
-
*
|
1802
|
-
* You can pass a string instead of a function (although functions are
|
1803
|
-
* recommended as they are easier to debug and use with TypeScript):
|
1804
|
-
*
|
1805
|
-
* @example
|
1806
|
-
* ```
|
1807
|
-
* const aHandle = await page.evaluate('1 + 2');
|
1808
|
-
* ```
|
1809
|
-
*
|
1810
|
-
* To get the best TypeScript experience, you should pass in as the
|
1811
|
-
* generic the type of `pageFunction`:
|
1812
|
-
*
|
1813
|
-
* ```
|
1814
|
-
* const aHandle = await page.evaluate<() => number>(() => 2);
|
1815
|
-
* ```
|
1816
|
-
*
|
1817
|
-
* @example
|
1818
|
-
*
|
1819
|
-
* {@link ElementHandle} instances (including {@link JSHandle}s) can be passed
|
1820
|
-
* as arguments to the `pageFunction`:
|
1821
|
-
*
|
1822
|
-
* ```
|
1823
|
-
* const bodyHandle = await page.$('body');
|
1824
|
-
* const html = await page.evaluate(body => body.innerHTML, bodyHandle);
|
1825
|
-
* await bodyHandle.dispose();
|
1826
|
-
* ```
|
1827
|
-
*
|
1828
|
-
* @param pageFunction - a function that is run within the page
|
1829
|
-
* @param args - arguments to be passed to the pageFunction
|
1830
|
-
*
|
1831
|
-
* @returns the return value of `pageFunction`.
|
1832
|
-
*/
|
1833
|
-
async evaluate(pageFunction, ...args) {
|
1834
|
-
return this._frameManager.mainFrame().evaluate(pageFunction, ...args);
|
1835
|
-
}
|
1836
|
-
/**
|
1837
|
-
* Adds a function which would be invoked in one of the following scenarios:
|
1838
|
-
*
|
1839
|
-
* - whenever the page is navigated
|
1840
|
-
*
|
1841
|
-
* - whenever the child frame is attached or navigated. In this case, the
|
1842
|
-
* function is invoked in the context of the newly attached frame.
|
1843
|
-
*
|
1844
|
-
* The function is invoked after the document was created but before any of
|
1845
|
-
* its scripts were run. This is useful to amend the JavaScript environment,
|
1846
|
-
* e.g. to seed `Math.random`.
|
1847
|
-
* @param pageFunction - Function to be evaluated in browser context
|
1848
|
-
* @param args - Arguments to pass to `pageFunction`
|
1849
|
-
* @example
|
1850
|
-
* An example of overriding the navigator.languages property before the page loads:
|
1851
|
-
* ```js
|
1852
|
-
* // preload.js
|
1853
|
-
*
|
1854
|
-
* // overwrite the `languages` property to use a custom getter
|
1855
|
-
* Object.defineProperty(navigator, 'languages', {
|
1856
|
-
* get: function () {
|
1857
|
-
* return ['en-US', 'en', 'bn'];
|
1858
|
-
* },
|
1859
|
-
* });
|
1860
|
-
*
|
1861
|
-
* // In your puppeteer script, assuming the preload.js file is
|
1862
|
-
* in same folder of our script
|
1863
|
-
* const preloadFile = fs.readFileSync('./preload.js', 'utf8');
|
1864
|
-
* await page.evaluateOnNewDocument(preloadFile);
|
1865
|
-
* ```
|
1866
|
-
*/
|
1867
|
-
async evaluateOnNewDocument(pageFunction, ...args) {
|
1868
|
-
const source = helper_js_1.helper.evaluationString(pageFunction, ...args);
|
1869
|
-
await this._client.send('Page.addScriptToEvaluateOnNewDocument', {
|
1870
|
-
source,
|
1871
|
-
});
|
1872
|
-
}
|
1873
|
-
/**
|
1874
|
-
* Toggles ignoring cache for each request based on the enabled state. By
|
1875
|
-
* default, caching is enabled.
|
1876
|
-
* @param enabled - sets the `enabled` state of cache
|
1877
|
-
*/
|
1878
|
-
async setCacheEnabled(enabled = true) {
|
1879
|
-
await this._frameManager.networkManager().setCacheEnabled(enabled);
|
1880
|
-
}
|
1881
|
-
/**
|
1882
|
-
* @remarks
|
1883
|
-
* Options object which might have the following properties:
|
1884
|
-
*
|
1885
|
-
* - `path` : The file path to save the image to. The screenshot type
|
1886
|
-
* will be inferred from file extension. If `path` is a relative path, then
|
1887
|
-
* it is resolved relative to
|
1888
|
-
* {@link https://nodejs.org/api/process.html#process_process_cwd
|
1889
|
-
* | current working directory}.
|
1890
|
-
* If no path is provided, the image won't be saved to the disk.
|
1891
|
-
*
|
1892
|
-
* - `type` : Specify screenshot type, can be either `jpeg` or `png`.
|
1893
|
-
* Defaults to 'png'.
|
1894
|
-
*
|
1895
|
-
* - `quality` : The quality of the image, between 0-100. Not
|
1896
|
-
* applicable to `png` images.
|
1897
|
-
*
|
1898
|
-
* - `fullPage` : When true, takes a screenshot of the full
|
1899
|
-
* scrollable page. Defaults to `false`
|
1900
|
-
*
|
1901
|
-
* - `clip` : An object which specifies clipping region of the page.
|
1902
|
-
* Should have the following fields:<br/>
|
1903
|
-
* - `x` : x-coordinate of top-left corner of clip area.<br/>
|
1904
|
-
* - `y` : y-coordinate of top-left corner of clip area.<br/>
|
1905
|
-
* - `width` : width of clipping area.<br/>
|
1906
|
-
* - `height` : height of clipping area.
|
1907
|
-
*
|
1908
|
-
* - `omitBackground` : Hides default white background and allows
|
1909
|
-
* capturing screenshots with transparency. Defaults to `false`
|
1910
|
-
*
|
1911
|
-
* - `encoding` : The encoding of the image, can be either base64 or
|
1912
|
-
* binary. Defaults to `binary`.
|
1913
|
-
*
|
1914
|
-
*
|
1915
|
-
* NOTE: Screenshots take at least 1/6 second on OS X. See
|
1916
|
-
* {@link https://crbug.com/741689} for discussion.
|
1917
|
-
* @returns Promise which resolves to buffer or a base64 string (depending on
|
1918
|
-
* the value of `encoding`) with captured screenshot.
|
1919
|
-
*/
|
1920
|
-
async screenshot(options = {}) {
|
1921
|
-
let screenshotType = null;
|
1922
|
-
// options.type takes precedence over inferring the type from options.path
|
1923
|
-
// because it may be a 0-length file with no extension created beforehand
|
1924
|
-
// (i.e. as a temp file).
|
1925
|
-
if (options.type) {
|
1926
|
-
const type = options.type;
|
1927
|
-
if (type !== 'png' && type !== 'jpeg' && type !== 'webp') {
|
1928
|
-
(0, assert_js_1.assertNever)(type, 'Unknown options.type value: ' + type);
|
1929
|
-
}
|
1930
|
-
screenshotType = options.type;
|
1931
|
-
}
|
1932
|
-
else if (options.path) {
|
1933
|
-
const filePath = options.path;
|
1934
|
-
const extension = filePath
|
1935
|
-
.slice(filePath.lastIndexOf('.') + 1)
|
1936
|
-
.toLowerCase();
|
1937
|
-
if (extension === 'png')
|
1938
|
-
screenshotType = 'png';
|
1939
|
-
else if (extension === 'jpg' || extension === 'jpeg')
|
1940
|
-
screenshotType = 'jpeg';
|
1941
|
-
else if (extension === 'webp')
|
1942
|
-
screenshotType = 'webp';
|
1943
|
-
(0, assert_js_1.assert)(screenshotType, `Unsupported screenshot type for extension \`.${extension}\``);
|
1944
|
-
}
|
1945
|
-
if (!screenshotType)
|
1946
|
-
screenshotType = 'png';
|
1947
|
-
if (options.quality) {
|
1948
|
-
(0, assert_js_1.assert)(screenshotType === 'jpeg' || screenshotType === 'webp', 'options.quality is unsupported for the ' +
|
1949
|
-
screenshotType +
|
1950
|
-
' screenshots');
|
1951
|
-
(0, assert_js_1.assert)(typeof options.quality === 'number', 'Expected options.quality to be a number but found ' +
|
1952
|
-
typeof options.quality);
|
1953
|
-
(0, assert_js_1.assert)(Number.isInteger(options.quality), 'Expected options.quality to be an integer');
|
1954
|
-
(0, assert_js_1.assert)(options.quality >= 0 && options.quality <= 100, 'Expected options.quality to be between 0 and 100 (inclusive), got ' +
|
1955
|
-
options.quality);
|
1956
|
-
}
|
1957
|
-
(0, assert_js_1.assert)(!options.clip || !options.fullPage, 'options.clip and options.fullPage are exclusive');
|
1958
|
-
if (options.clip) {
|
1959
|
-
(0, assert_js_1.assert)(typeof options.clip.x === 'number', 'Expected options.clip.x to be a number but found ' +
|
1960
|
-
typeof options.clip.x);
|
1961
|
-
(0, assert_js_1.assert)(typeof options.clip.y === 'number', 'Expected options.clip.y to be a number but found ' +
|
1962
|
-
typeof options.clip.y);
|
1963
|
-
(0, assert_js_1.assert)(typeof options.clip.width === 'number', 'Expected options.clip.width to be a number but found ' +
|
1964
|
-
typeof options.clip.width);
|
1965
|
-
(0, assert_js_1.assert)(typeof options.clip.height === 'number', 'Expected options.clip.height to be a number but found ' +
|
1966
|
-
typeof options.clip.height);
|
1967
|
-
(0, assert_js_1.assert)(options.clip.width !== 0, 'Expected options.clip.width not to be 0.');
|
1968
|
-
(0, assert_js_1.assert)(options.clip.height !== 0, 'Expected options.clip.height not to be 0.');
|
1969
|
-
}
|
1970
|
-
return this._screenshotTaskQueue.postTask(() => this._screenshotTask(screenshotType, options));
|
1971
|
-
}
|
1972
|
-
async _screenshotTask(format, options) {
|
1973
|
-
await this._client.send('Target.activateTarget', {
|
1974
|
-
targetId: this._target._targetId,
|
1975
|
-
});
|
1976
|
-
let clip = options.clip ? processClip(options.clip) : undefined;
|
1977
|
-
let { captureBeyondViewport = true } = options;
|
1978
|
-
captureBeyondViewport =
|
1979
|
-
typeof captureBeyondViewport === 'boolean' ? captureBeyondViewport : true;
|
1980
|
-
if (options.fullPage) {
|
1981
|
-
const metrics = await this._client.send('Page.getLayoutMetrics');
|
1982
|
-
// Fallback to `contentSize` in case of using Firefox.
|
1983
|
-
const { width, height } = metrics.cssContentSize || metrics.contentSize;
|
1984
|
-
// Overwrite clip for full page.
|
1985
|
-
clip = { x: 0, y: 0, width, height, scale: 1 };
|
1986
|
-
if (!captureBeyondViewport) {
|
1987
|
-
const { isMobile = false, deviceScaleFactor = 1, isLandscape = false, } = this._viewport || {};
|
1988
|
-
const screenOrientation = isLandscape
|
1989
|
-
? { angle: 90, type: 'landscapePrimary' }
|
1990
|
-
: { angle: 0, type: 'portraitPrimary' };
|
1991
|
-
await this._client.send('Emulation.setDeviceMetricsOverride', {
|
1992
|
-
mobile: isMobile,
|
1993
|
-
width,
|
1994
|
-
height,
|
1995
|
-
deviceScaleFactor,
|
1996
|
-
screenOrientation,
|
1997
|
-
});
|
1998
|
-
}
|
1999
|
-
}
|
2000
|
-
const shouldSetDefaultBackground = options.omitBackground && (format === 'png' || format === 'webp');
|
2001
|
-
if (shouldSetDefaultBackground) {
|
2002
|
-
await this._setTransparentBackgroundColor();
|
2003
|
-
}
|
2004
|
-
const result = await this._client.send('Page.captureScreenshot', {
|
2005
|
-
format,
|
2006
|
-
quality: options.quality,
|
2007
|
-
clip,
|
2008
|
-
captureBeyondViewport,
|
2009
|
-
});
|
2010
|
-
if (shouldSetDefaultBackground) {
|
2011
|
-
await this._resetDefaultBackgroundColor();
|
2012
|
-
}
|
2013
|
-
if (options.fullPage && this._viewport)
|
2014
|
-
await this.setViewport(this._viewport);
|
2015
|
-
const buffer = options.encoding === 'base64'
|
2016
|
-
? result.data
|
2017
|
-
: Buffer.from(result.data, 'base64');
|
2018
|
-
if (options.path) {
|
2019
|
-
if (!environment_js_1.isNode) {
|
2020
|
-
throw new Error('Screenshots can only be written to a file path in a Node environment.');
|
2021
|
-
}
|
2022
|
-
const fs = await helper_js_1.helper.importFSModule();
|
2023
|
-
await fs.promises.writeFile(options.path, buffer);
|
2024
|
-
}
|
2025
|
-
return buffer;
|
2026
|
-
function processClip(clip) {
|
2027
|
-
const x = Math.round(clip.x);
|
2028
|
-
const y = Math.round(clip.y);
|
2029
|
-
const width = Math.round(clip.width + clip.x - x);
|
2030
|
-
const height = Math.round(clip.height + clip.y - y);
|
2031
|
-
return { x, y, width, height, scale: 1 };
|
2032
|
-
}
|
2033
|
-
}
|
2034
|
-
/**
|
2035
|
-
* Generatees a PDF of the page with the `print` CSS media type.
|
2036
|
-
* @remarks
|
2037
|
-
*
|
2038
|
-
* NOTE: PDF generation is only supported in Chrome headless mode.
|
2039
|
-
*
|
2040
|
-
* To generate a PDF with the `screen` media type, call
|
2041
|
-
* {@link Page.emulateMediaType | `page.emulateMediaType('screen')`} before
|
2042
|
-
* calling `page.pdf()`.
|
2043
|
-
*
|
2044
|
-
* By default, `page.pdf()` generates a pdf with modified colors for printing.
|
2045
|
-
* Use the
|
2046
|
-
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-print-color-adjust | `-webkit-print-color-adjust`}
|
2047
|
-
* property to force rendering of exact colors.
|
2048
|
-
*
|
2049
|
-
*
|
2050
|
-
* @param options - options for generating the PDF.
|
2051
|
-
*/
|
2052
|
-
async createPDFStream(options = {}) {
|
2053
|
-
const { scale = 1, displayHeaderFooter = false, headerTemplate = '', footerTemplate = '', printBackground = false, landscape = false, pageRanges = '', preferCSSPageSize = false, margin = {}, omitBackground = false, timeout = 30000, } = options;
|
2054
|
-
let paperWidth = 8.5;
|
2055
|
-
let paperHeight = 11;
|
2056
|
-
if (options.format) {
|
2057
|
-
const format = PDFOptions_js_1.paperFormats[options.format.toLowerCase()];
|
2058
|
-
(0, assert_js_1.assert)(format, 'Unknown paper format: ' + options.format);
|
2059
|
-
paperWidth = format.width;
|
2060
|
-
paperHeight = format.height;
|
2061
|
-
}
|
2062
|
-
else {
|
2063
|
-
paperWidth = convertPrintParameterToInches(options.width) || paperWidth;
|
2064
|
-
paperHeight =
|
2065
|
-
convertPrintParameterToInches(options.height) || paperHeight;
|
2066
|
-
}
|
2067
|
-
const marginTop = convertPrintParameterToInches(margin.top) || 0;
|
2068
|
-
const marginLeft = convertPrintParameterToInches(margin.left) || 0;
|
2069
|
-
const marginBottom = convertPrintParameterToInches(margin.bottom) || 0;
|
2070
|
-
const marginRight = convertPrintParameterToInches(margin.right) || 0;
|
2071
|
-
if (omitBackground) {
|
2072
|
-
await this._setTransparentBackgroundColor();
|
2073
|
-
}
|
2074
|
-
const printCommandPromise = this._client.send('Page.printToPDF', {
|
2075
|
-
transferMode: 'ReturnAsStream',
|
2076
|
-
landscape,
|
2077
|
-
displayHeaderFooter,
|
2078
|
-
headerTemplate,
|
2079
|
-
footerTemplate,
|
2080
|
-
printBackground,
|
2081
|
-
scale,
|
2082
|
-
paperWidth,
|
2083
|
-
paperHeight,
|
2084
|
-
marginTop,
|
2085
|
-
marginBottom,
|
2086
|
-
marginLeft,
|
2087
|
-
marginRight,
|
2088
|
-
pageRanges,
|
2089
|
-
preferCSSPageSize,
|
2090
|
-
});
|
2091
|
-
const result = await helper_js_1.helper.waitWithTimeout(printCommandPromise, 'Page.printToPDF', timeout);
|
2092
|
-
if (omitBackground) {
|
2093
|
-
await this._resetDefaultBackgroundColor();
|
2094
|
-
}
|
2095
|
-
return helper_js_1.helper.getReadableFromProtocolStream(this._client, result.stream);
|
2096
|
-
}
|
2097
|
-
/**
|
2098
|
-
* @param options -
|
2099
|
-
* @returns
|
2100
|
-
*/
|
2101
|
-
async pdf(options = {}) {
|
2102
|
-
const { path = undefined } = options;
|
2103
|
-
const readable = await this.createPDFStream(options);
|
2104
|
-
return await helper_js_1.helper.getReadableAsBuffer(readable, path);
|
2105
|
-
}
|
2106
|
-
/**
|
2107
|
-
* @returns The page's title
|
2108
|
-
* @remarks
|
2109
|
-
* Shortcut for {@link Frame.title | page.mainFrame().title()}.
|
2110
|
-
*/
|
2111
|
-
async title() {
|
2112
|
-
return this.mainFrame().title();
|
2113
|
-
}
|
2114
|
-
async close(options = { runBeforeUnload: undefined }) {
|
2115
|
-
(0, assert_js_1.assert)(!!this._client._connection, 'Protocol error: Connection closed. Most likely the page has been closed.');
|
2116
|
-
const runBeforeUnload = !!options.runBeforeUnload;
|
2117
|
-
if (runBeforeUnload) {
|
2118
|
-
await this._client.send('Page.close');
|
2119
|
-
}
|
2120
|
-
else {
|
2121
|
-
await this._client._connection.send('Target.closeTarget', {
|
2122
|
-
targetId: this._target._targetId,
|
2123
|
-
});
|
2124
|
-
await this._target._isClosedPromise;
|
2125
|
-
}
|
2126
|
-
}
|
2127
|
-
/**
|
2128
|
-
* Indicates that the page has been closed.
|
2129
|
-
* @returns
|
2130
|
-
*/
|
2131
|
-
isClosed() {
|
2132
|
-
return this._closed;
|
2133
|
-
}
|
2134
|
-
get mouse() {
|
2135
|
-
return this._mouse;
|
2136
|
-
}
|
2137
|
-
/**
|
2138
|
-
* This method fetches an element with `selector`, scrolls it into view if
|
2139
|
-
* needed, and then uses {@link Page.mouse} to click in the center of the
|
2140
|
-
* element. If there's no element matching `selector`, the method throws an
|
2141
|
-
* error.
|
2142
|
-
* @remarks Bear in mind that if `click()` triggers a navigation event and
|
2143
|
-
* there's a separate `page.waitForNavigation()` promise to be resolved, you
|
2144
|
-
* may end up with a race condition that yields unexpected results. The
|
2145
|
-
* correct pattern for click and wait for navigation is the following:
|
2146
|
-
* ```js
|
2147
|
-
* const [response] = await Promise.all([
|
2148
|
-
* page.waitForNavigation(waitOptions),
|
2149
|
-
* page.click(selector, clickOptions),
|
2150
|
-
* ]);
|
2151
|
-
* ```
|
2152
|
-
* Shortcut for {@link Frame.click | page.mainFrame().click(selector[, options]) }.
|
2153
|
-
* @param selector - A `selector` to search for element to click. If there are
|
2154
|
-
* multiple elements satisfying the `selector`, the first will be clicked
|
2155
|
-
* @param options - `Object`
|
2156
|
-
* @returns Promise which resolves when the element matching `selector` is
|
2157
|
-
* successfully clicked. The Promise will be rejected if there is no element
|
2158
|
-
* matching `selector`.
|
2159
|
-
*/
|
2160
|
-
click(selector, options = {}) {
|
2161
|
-
return this.mainFrame().click(selector, options);
|
2162
|
-
}
|
2163
|
-
/**
|
2164
|
-
* This method fetches an element with `selector` and focuses it. If there's no
|
2165
|
-
* element matching `selector`, the method throws an error.
|
2166
|
-
* @param selector - A
|
2167
|
-
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | selector }
|
2168
|
-
* of an element to focus. If there are multiple elements satisfying the
|
2169
|
-
* selector, the first will be focused.
|
2170
|
-
* @returns Promise which resolves when the element matching selector is
|
2171
|
-
* successfully focused. The promise will be rejected if there is no element
|
2172
|
-
* matching selector.
|
2173
|
-
* @remarks
|
2174
|
-
* Shortcut for {@link Frame.focus | page.mainFrame().focus(selector)}.
|
2175
|
-
*/
|
2176
|
-
focus(selector) {
|
2177
|
-
return this.mainFrame().focus(selector);
|
2178
|
-
}
|
2179
|
-
/**
|
2180
|
-
* This method fetches an element with `selector`, scrolls it into view if
|
2181
|
-
* needed, and then uses {@link Page.mouse} to hover over the center of the element.
|
2182
|
-
* If there's no element matching `selector`, the method throws an error.
|
2183
|
-
* @param selector - A
|
2184
|
-
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | selector}
|
2185
|
-
* to search for element to hover. If there are multiple elements satisfying
|
2186
|
-
* the selector, the first will be hovered.
|
2187
|
-
* @returns Promise which resolves when the element matching `selector` is
|
2188
|
-
* successfully hovered. Promise gets rejected if there's no element matching
|
2189
|
-
* `selector`.
|
2190
|
-
* @remarks
|
2191
|
-
* Shortcut for {@link Page.hover | page.mainFrame().hover(selector)}.
|
2192
|
-
*/
|
2193
|
-
hover(selector) {
|
2194
|
-
return this.mainFrame().hover(selector);
|
2195
|
-
}
|
2196
|
-
/**
|
2197
|
-
* Triggers a `change` and `input` event once all the provided options have been
|
2198
|
-
* selected. If there's no `<select>` element matching `selector`, the method
|
2199
|
-
* throws an error.
|
2200
|
-
*
|
2201
|
-
* @example
|
2202
|
-
* ```js
|
2203
|
-
* page.select('select#colors', 'blue'); // single selection
|
2204
|
-
* page.select('select#colors', 'red', 'green', 'blue'); // multiple selections
|
2205
|
-
* ```
|
2206
|
-
* @param selector - A
|
2207
|
-
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | Selector}
|
2208
|
-
* to query the page for
|
2209
|
-
* @param values - Values of options to select. If the `<select>` has the
|
2210
|
-
* `multiple` attribute, all values are considered, otherwise only the first one
|
2211
|
-
* is taken into account.
|
2212
|
-
* @returns
|
2213
|
-
*
|
2214
|
-
* @remarks
|
2215
|
-
* Shortcut for {@link Frame.select | page.mainFrame().select()}
|
2216
|
-
*/
|
2217
|
-
select(selector, ...values) {
|
2218
|
-
return this.mainFrame().select(selector, ...values);
|
2219
|
-
}
|
2220
|
-
/**
|
2221
|
-
* This method fetches an element with `selector`, scrolls it into view if
|
2222
|
-
* needed, and then uses {@link Page.touchscreen} to tap in the center of the element.
|
2223
|
-
* If there's no element matching `selector`, the method throws an error.
|
2224
|
-
* @param selector - A
|
2225
|
-
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | Selector}
|
2226
|
-
* to search for element to tap. If there are multiple elements satisfying the
|
2227
|
-
* selector, the first will be tapped.
|
2228
|
-
* @returns
|
2229
|
-
* @remarks
|
2230
|
-
* Shortcut for {@link Frame.tap | page.mainFrame().tap(selector)}.
|
2231
|
-
*/
|
2232
|
-
tap(selector) {
|
2233
|
-
return this.mainFrame().tap(selector);
|
2234
|
-
}
|
2235
|
-
/**
|
2236
|
-
* Sends a `keydown`, `keypress/input`, and `keyup` event for each character
|
2237
|
-
* in the text.
|
2238
|
-
*
|
2239
|
-
* To press a special key, like `Control` or `ArrowDown`, use {@link Keyboard.press}.
|
2240
|
-
* @example
|
2241
|
-
* ```
|
2242
|
-
* await page.type('#mytextarea', 'Hello');
|
2243
|
-
* // Types instantly
|
2244
|
-
* await page.type('#mytextarea', 'World', { delay: 100 });
|
2245
|
-
* // Types slower, like a user
|
2246
|
-
* ```
|
2247
|
-
* @param selector - A
|
2248
|
-
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | selector}
|
2249
|
-
* of an element to type into. If there are multiple elements satisfying the
|
2250
|
-
* selector, the first will be used.
|
2251
|
-
* @param text - A text to type into a focused element.
|
2252
|
-
* @param options - have property `delay` which is the Time to wait between
|
2253
|
-
* key presses in milliseconds. Defaults to `0`.
|
2254
|
-
* @returns
|
2255
|
-
* @remarks
|
2256
|
-
*/
|
2257
|
-
type(selector, text, options) {
|
2258
|
-
return this.mainFrame().type(selector, text, options);
|
2259
|
-
}
|
2260
|
-
/**
|
2261
|
-
* @remarks
|
2262
|
-
*
|
2263
|
-
* This method behaves differently depending on the first parameter. If it's a
|
2264
|
-
* `string`, it will be treated as a `selector` or `xpath` (if the string
|
2265
|
-
* starts with `//`). This method then is a shortcut for
|
2266
|
-
* {@link Page.waitForSelector} or {@link Page.waitForXPath}.
|
2267
|
-
*
|
2268
|
-
* If the first argument is a function this method is a shortcut for
|
2269
|
-
* {@link Page.waitForFunction}.
|
2270
|
-
*
|
2271
|
-
* If the first argument is a `number`, it's treated as a timeout in
|
2272
|
-
* milliseconds and the method returns a promise which resolves after the
|
2273
|
-
* timeout.
|
2274
|
-
*
|
2275
|
-
* @param selectorOrFunctionOrTimeout - a selector, predicate or timeout to
|
2276
|
-
* wait for.
|
2277
|
-
* @param options - optional waiting parameters.
|
2278
|
-
* @param args - arguments to pass to `pageFunction`.
|
2279
|
-
*
|
2280
|
-
* @deprecated Don't use this method directly. Instead use the more explicit
|
2281
|
-
* methods available: {@link Page.waitForSelector},
|
2282
|
-
* {@link Page.waitForXPath}, {@link Page.waitForFunction} or
|
2283
|
-
* {@link Page.waitForTimeout}.
|
2284
|
-
*/
|
2285
|
-
waitFor(selectorOrFunctionOrTimeout, options = {}, ...args) {
|
2286
|
-
return this.mainFrame().waitFor(selectorOrFunctionOrTimeout, options, ...args);
|
2287
|
-
}
|
2288
|
-
/**
|
2289
|
-
* Causes your script to wait for the given number of milliseconds.
|
2290
|
-
*
|
2291
|
-
* @remarks
|
2292
|
-
*
|
2293
|
-
* It's generally recommended to not wait for a number of seconds, but instead
|
2294
|
-
* use {@link Page.waitForSelector}, {@link Page.waitForXPath} or
|
2295
|
-
* {@link Page.waitForFunction} to wait for exactly the conditions you want.
|
2296
|
-
*
|
2297
|
-
* @example
|
2298
|
-
*
|
2299
|
-
* Wait for 1 second:
|
2300
|
-
*
|
2301
|
-
* ```
|
2302
|
-
* await page.waitForTimeout(1000);
|
2303
|
-
* ```
|
2304
|
-
*
|
2305
|
-
* @param milliseconds - the number of milliseconds to wait.
|
2306
|
-
*/
|
2307
|
-
waitForTimeout(milliseconds) {
|
2308
|
-
return this.mainFrame().waitForTimeout(milliseconds);
|
2309
|
-
}
|
2310
|
-
/**
|
2311
|
-
* Wait for the `selector` to appear in page. If at the moment of calling the
|
2312
|
-
* method the `selector` already exists, the method will return immediately. If
|
2313
|
-
* the `selector` doesn't appear after the `timeout` milliseconds of waiting, the
|
2314
|
-
* function will throw.
|
2315
|
-
*
|
2316
|
-
* This method works across navigations:
|
2317
|
-
* ```js
|
2318
|
-
* const puppeteer = require('puppeteer');
|
2319
|
-
* (async () => {
|
2320
|
-
* const browser = await puppeteer.launch();
|
2321
|
-
* const page = await browser.newPage();
|
2322
|
-
* let currentURL;
|
2323
|
-
* page
|
2324
|
-
* .waitForSelector('img')
|
2325
|
-
* .then(() => console.log('First URL with image: ' + currentURL));
|
2326
|
-
* for (currentURL of [
|
2327
|
-
* 'https://example.com',
|
2328
|
-
* 'https://google.com',
|
2329
|
-
* 'https://bbc.com',
|
2330
|
-
* ]) {
|
2331
|
-
* await page.goto(currentURL);
|
2332
|
-
* }
|
2333
|
-
* await browser.close();
|
2334
|
-
* })();
|
2335
|
-
* ```
|
2336
|
-
* @param selector - A
|
2337
|
-
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | selector}
|
2338
|
-
* of an element to wait for
|
2339
|
-
* @param options - Optional waiting parameters
|
2340
|
-
* @returns Promise which resolves when element specified by selector string
|
2341
|
-
* is added to DOM. Resolves to `null` if waiting for hidden: `true` and
|
2342
|
-
* selector is not found in DOM.
|
2343
|
-
* @remarks
|
2344
|
-
* The optional Parameter in Arguments `options` are :
|
2345
|
-
*
|
2346
|
-
* - `Visible`: A boolean wait for element to be present in DOM and to be
|
2347
|
-
* visible, i.e. to not have `display: none` or `visibility: hidden` CSS
|
2348
|
-
* properties. Defaults to `false`.
|
2349
|
-
*
|
2350
|
-
* - `hidden`: ait for element to not be found in the DOM or to be hidden,
|
2351
|
-
* i.e. have `display: none` or `visibility: hidden` CSS properties. Defaults to
|
2352
|
-
* `false`.
|
2353
|
-
*
|
2354
|
-
* - `timeout`: maximum time to wait for in milliseconds. Defaults to `30000`
|
2355
|
-
* (30 seconds). Pass `0` to disable timeout. The default value can be changed
|
2356
|
-
* by using the {@link Page.setDefaultTimeout} method.
|
2357
|
-
*/
|
2358
|
-
waitForSelector(selector, options = {}) {
|
2359
|
-
return this.mainFrame().waitForSelector(selector, options);
|
2360
|
-
}
|
2361
|
-
/**
|
2362
|
-
* Wait for the `xpath` to appear in page. If at the moment of calling the
|
2363
|
-
* method the `xpath` already exists, the method will return immediately. If
|
2364
|
-
* the `xpath` doesn't appear after the `timeout` milliseconds of waiting, the
|
2365
|
-
* function will throw.
|
2366
|
-
*
|
2367
|
-
* This method works across navigation
|
2368
|
-
* ```js
|
2369
|
-
* const puppeteer = require('puppeteer');
|
2370
|
-
* (async () => {
|
2371
|
-
* const browser = await puppeteer.launch();
|
2372
|
-
* const page = await browser.newPage();
|
2373
|
-
* let currentURL;
|
2374
|
-
* page
|
2375
|
-
* .waitForXPath('//img')
|
2376
|
-
* .then(() => console.log('First URL with image: ' + currentURL));
|
2377
|
-
* for (currentURL of [
|
2378
|
-
* 'https://example.com',
|
2379
|
-
* 'https://google.com',
|
2380
|
-
* 'https://bbc.com',
|
2381
|
-
* ]) {
|
2382
|
-
* await page.goto(currentURL);
|
2383
|
-
* }
|
2384
|
-
* await browser.close();
|
2385
|
-
* })();
|
2386
|
-
* ```
|
2387
|
-
* @param xpath - A
|
2388
|
-
* {@link https://developer.mozilla.org/en-US/docs/Web/XPath | xpath} of an
|
2389
|
-
* element to wait for
|
2390
|
-
* @param options - Optional waiting parameters
|
2391
|
-
* @returns Promise which resolves when element specified by xpath string is
|
2392
|
-
* added to DOM. Resolves to `null` if waiting for `hidden: true` and xpath is
|
2393
|
-
* not found in DOM.
|
2394
|
-
* @remarks
|
2395
|
-
* The optional Argument `options` have properties:
|
2396
|
-
*
|
2397
|
-
* - `visible`: A boolean to wait for element to be present in DOM and to be
|
2398
|
-
* visible, i.e. to not have `display: none` or `visibility: hidden` CSS
|
2399
|
-
* properties. Defaults to `false`.
|
2400
|
-
*
|
2401
|
-
* - `hidden`: A boolean wait for element to not be found in the DOM or to be
|
2402
|
-
* hidden, i.e. have `display: none` or `visibility: hidden` CSS properties.
|
2403
|
-
* Defaults to `false`.
|
2404
|
-
*
|
2405
|
-
* - `timeout`: A number which is maximum time to wait for in milliseconds.
|
2406
|
-
* Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default
|
2407
|
-
* value can be changed by using the {@link Page.setDefaultTimeout} method.
|
2408
|
-
*/
|
2409
|
-
waitForXPath(xpath, options = {}) {
|
2410
|
-
return this.mainFrame().waitForXPath(xpath, options);
|
2411
|
-
}
|
2412
|
-
/**
|
2413
|
-
* The `waitForFunction` can be used to observe viewport size change:
|
2414
|
-
*
|
2415
|
-
* ```
|
2416
|
-
* const puppeteer = require('puppeteer');
|
2417
|
-
* (async () => {
|
2418
|
-
* const browser = await puppeteer.launch();
|
2419
|
-
* const page = await browser.newPage();
|
2420
|
-
* const watchDog = page.waitForFunction('window.innerWidth < 100');
|
2421
|
-
* await page.setViewport({ width: 50, height: 50 });
|
2422
|
-
* await watchDog;
|
2423
|
-
* await browser.close();
|
2424
|
-
* })();
|
2425
|
-
* ```
|
2426
|
-
* To pass arguments from node.js to the predicate of `page.waitForFunction` function:
|
2427
|
-
* ```
|
2428
|
-
* const selector = '.foo';
|
2429
|
-
* await page.waitForFunction(
|
2430
|
-
* (selector) => !!document.querySelector(selector),
|
2431
|
-
* {},
|
2432
|
-
* selector
|
2433
|
-
* );
|
2434
|
-
* ```
|
2435
|
-
* The predicate of `page.waitForFunction` can be asynchronous too:
|
2436
|
-
* ```
|
2437
|
-
* const username = 'github-username';
|
2438
|
-
* await page.waitForFunction(
|
2439
|
-
* async (username) => {
|
2440
|
-
* const githubResponse = await fetch(
|
2441
|
-
* `https://api.github.com/users/${username}`
|
2442
|
-
* );
|
2443
|
-
* const githubUser = await githubResponse.json();
|
2444
|
-
* // show the avatar
|
2445
|
-
* const img = document.createElement('img');
|
2446
|
-
* img.src = githubUser.avatar_url;
|
2447
|
-
* // wait 3 seconds
|
2448
|
-
* await new Promise((resolve, reject) => setTimeout(resolve, 3000));
|
2449
|
-
* img.remove();
|
2450
|
-
* },
|
2451
|
-
* {},
|
2452
|
-
* username
|
2453
|
-
* );
|
2454
|
-
* ```
|
2455
|
-
* @param pageFunction - Function to be evaluated in browser context
|
2456
|
-
* @param options - Optional waiting parameters
|
2457
|
-
* @param args - Arguments to pass to `pageFunction`
|
2458
|
-
* @returns Promise which resolves when the `pageFunction` returns a truthy
|
2459
|
-
* value. It resolves to a JSHandle of the truthy value.
|
2460
|
-
*
|
2461
|
-
* The optional waiting parameter can be:
|
2462
|
-
*
|
2463
|
-
* - `Polling`: An interval at which the `pageFunction` is executed, defaults to
|
2464
|
-
* `raf`. If `polling` is a number, then it is treated as an interval in
|
2465
|
-
* milliseconds at which the function would be executed. If polling is a
|
2466
|
-
* string, then it can be one of the following values:<br/>
|
2467
|
-
* - `raf`: to constantly execute `pageFunction` in `requestAnimationFrame`
|
2468
|
-
* callback. This is the tightest polling mode which is suitable to
|
2469
|
-
* observe styling changes.<br/>
|
2470
|
-
* - `mutation`: to execute pageFunction on every DOM mutation.
|
2471
|
-
*
|
2472
|
-
* - `timeout`: maximum time to wait for in milliseconds. Defaults to `30000`
|
2473
|
-
* (30 seconds). Pass `0` to disable timeout. The default value can be changed
|
2474
|
-
* by using the
|
2475
|
-
* {@link Page.setDefaultTimeout | page.setDefaultTimeout(timeout)} method.
|
2476
|
-
*
|
2477
|
-
*/
|
2478
|
-
waitForFunction(pageFunction, options = {}, ...args) {
|
2479
|
-
return this.mainFrame().waitForFunction(pageFunction, options, ...args);
|
2480
|
-
}
|
2481
|
-
}
|
2482
|
-
exports.Page = Page;
|
2483
|
-
const supportedMetrics = new Set([
|
2484
|
-
'Timestamp',
|
2485
|
-
'Documents',
|
2486
|
-
'Frames',
|
2487
|
-
'JSEventListeners',
|
2488
|
-
'Nodes',
|
2489
|
-
'LayoutCount',
|
2490
|
-
'RecalcStyleCount',
|
2491
|
-
'LayoutDuration',
|
2492
|
-
'RecalcStyleDuration',
|
2493
|
-
'ScriptDuration',
|
2494
|
-
'TaskDuration',
|
2495
|
-
'JSHeapUsedSize',
|
2496
|
-
'JSHeapTotalSize',
|
2497
|
-
]);
|
2498
|
-
const unitToPixels = {
|
2499
|
-
px: 1,
|
2500
|
-
in: 96,
|
2501
|
-
cm: 37.8,
|
2502
|
-
mm: 3.78,
|
2503
|
-
};
|
2504
|
-
function convertPrintParameterToInches(parameter) {
|
2505
|
-
if (typeof parameter === 'undefined')
|
2506
|
-
return undefined;
|
2507
|
-
let pixels;
|
2508
|
-
if (helper_js_1.helper.isNumber(parameter)) {
|
2509
|
-
// Treat numbers as pixel values to be aligned with phantom's paperSize.
|
2510
|
-
pixels = /** @type {number} */ parameter;
|
2511
|
-
}
|
2512
|
-
else if (helper_js_1.helper.isString(parameter)) {
|
2513
|
-
const text = /** @type {string} */ parameter;
|
2514
|
-
let unit = text.substring(text.length - 2).toLowerCase();
|
2515
|
-
let valueText = '';
|
2516
|
-
if (unitToPixels.hasOwnProperty(unit)) {
|
2517
|
-
valueText = text.substring(0, text.length - 2);
|
2518
|
-
}
|
2519
|
-
else {
|
2520
|
-
// In case of unknown unit try to parse the whole parameter as number of pixels.
|
2521
|
-
// This is consistent with phantom's paperSize behavior.
|
2522
|
-
unit = 'px';
|
2523
|
-
valueText = text;
|
2524
|
-
}
|
2525
|
-
const value = Number(valueText);
|
2526
|
-
(0, assert_js_1.assert)(!isNaN(value), 'Failed to parse parameter value: ' + text);
|
2527
|
-
pixels = value * unitToPixels[unit];
|
2528
|
-
}
|
2529
|
-
else {
|
2530
|
-
throw new Error('page.pdf() Cannot handle parameter type: ' + typeof parameter);
|
2531
|
-
}
|
2532
|
-
return pixels / 96;
|
2533
|
-
}
|
2534
|
-
//# sourceMappingURL=Page.js.map
|