isomorfeus-puppetmaster 0.4.1 → 0.5.3

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