isomorfeus-puppetmaster 0.5.5 → 0.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (710) hide show
  1. checksums.yaml +4 -4
  2. data/lib/isomorfeus/puppetmaster/console_message.rb +18 -18
  3. data/lib/isomorfeus/puppetmaster/cookie.rb +46 -46
  4. data/lib/isomorfeus/puppetmaster/driver/puppeteer.rb +413 -415
  5. data/lib/isomorfeus/puppetmaster/driver/puppeteer_document.rb +953 -953
  6. data/lib/isomorfeus/puppetmaster/driver/puppeteer_node.rb +851 -851
  7. data/lib/isomorfeus/puppetmaster/errors.rb +90 -90
  8. data/lib/isomorfeus/puppetmaster/iframe.rb +16 -16
  9. data/lib/isomorfeus/puppetmaster/node/content_editable.rb +17 -17
  10. data/lib/isomorfeus/puppetmaster/node/input.rb +20 -20
  11. data/lib/isomorfeus/puppetmaster/node/select.rb +35 -35
  12. data/lib/isomorfeus/puppetmaster/node.rb +279 -279
  13. data/lib/isomorfeus/puppetmaster/request.rb +16 -16
  14. data/lib/isomorfeus/puppetmaster/response.rb +25 -25
  15. data/lib/isomorfeus/puppetmaster/self_forwardable.rb +38 -38
  16. data/lib/isomorfeus/puppetmaster/version.rb +3 -3
  17. data/lib/isomorfeus/puppetmaster.rb +85 -85
  18. data/lib/isomorfeus-puppetmaster.rb +1 -0
  19. data/node_modules/.bin/extract-zip +12 -12
  20. data/node_modules/.bin/extract-zip.ps1 +28 -28
  21. data/node_modules/.bin/rimraf +12 -12
  22. data/node_modules/.bin/rimraf.ps1 +28 -28
  23. data/node_modules/.package-lock.json +530 -585
  24. data/node_modules/@types/node/LICENSE +21 -21
  25. data/node_modules/@types/node/assert/strict.d.ts +8 -8
  26. data/node_modules/@types/node/assert.d.ts +912 -912
  27. data/node_modules/@types/node/async_hooks.d.ts +497 -497
  28. data/node_modules/@types/node/buffer.d.ts +2142 -2142
  29. data/node_modules/@types/node/child_process.d.ts +1355 -1355
  30. data/node_modules/@types/node/cluster.d.ts +414 -414
  31. data/node_modules/@types/node/console.d.ts +407 -407
  32. data/node_modules/@types/node/constants.d.ts +18 -18
  33. data/node_modules/@types/node/crypto.d.ts +3224 -3224
  34. data/node_modules/@types/node/dgram.d.ts +545 -545
  35. data/node_modules/@types/node/diagnostics_channel.d.ts +128 -128
  36. data/node_modules/@types/node/dns/promises.d.ts +357 -357
  37. data/node_modules/@types/node/dns.d.ts +643 -643
  38. data/node_modules/@types/node/domain.d.ts +169 -169
  39. data/node_modules/@types/node/events.d.ts +623 -623
  40. data/node_modules/@types/node/fs/promises.d.ts +997 -997
  41. data/node_modules/@types/node/fs.d.ts +3723 -3723
  42. data/node_modules/@types/node/globals.d.ts +285 -285
  43. data/node_modules/@types/node/globals.global.d.ts +1 -1
  44. data/node_modules/@types/node/http.d.ts +1358 -1358
  45. data/node_modules/@types/node/http2.d.ts +2100 -2100
  46. data/node_modules/@types/node/https.d.ts +391 -391
  47. data/node_modules/@types/node/index.d.ts +131 -131
  48. data/node_modules/@types/node/inspector.d.ts +2738 -2738
  49. data/node_modules/@types/node/module.d.ts +114 -114
  50. data/node_modules/@types/node/net.d.ts +783 -783
  51. data/node_modules/@types/node/os.d.ts +455 -455
  52. data/node_modules/@types/node/package.json +229 -229
  53. data/node_modules/@types/node/path.d.ts +172 -172
  54. data/node_modules/@types/node/perf_hooks.d.ts +555 -555
  55. data/node_modules/@types/node/process.d.ts +1477 -1477
  56. data/node_modules/@types/node/punycode.d.ts +117 -117
  57. data/node_modules/@types/node/querystring.d.ts +131 -131
  58. data/node_modules/@types/node/readline.d.ts +542 -542
  59. data/node_modules/@types/node/repl.d.ts +424 -424
  60. data/node_modules/@types/node/stream/consumers.d.ts +24 -24
  61. data/node_modules/@types/node/stream/promises.d.ts +42 -42
  62. data/node_modules/@types/node/stream/web.d.ts +6 -6
  63. data/node_modules/@types/node/stream.d.ts +1181 -1181
  64. data/node_modules/@types/node/string_decoder.d.ts +67 -67
  65. data/node_modules/@types/node/timers/promises.d.ts +68 -68
  66. data/node_modules/@types/node/timers.d.ts +94 -94
  67. data/node_modules/@types/node/tls.d.ts +1019 -1019
  68. data/node_modules/@types/node/trace_events.d.ts +161 -161
  69. data/node_modules/@types/node/tty.d.ts +206 -206
  70. data/node_modules/@types/node/url.d.ts +798 -798
  71. data/node_modules/@types/node/util.d.ts +1556 -1556
  72. data/node_modules/@types/node/v8.d.ts +378 -378
  73. data/node_modules/@types/node/vm.d.ts +504 -504
  74. data/node_modules/@types/node/wasi.d.ts +153 -153
  75. data/node_modules/@types/node/worker_threads.d.ts +649 -649
  76. data/node_modules/@types/node/zlib.d.ts +517 -517
  77. data/node_modules/@types/yauzl/LICENSE +21 -21
  78. data/node_modules/@types/yauzl/index.d.ts +98 -98
  79. data/node_modules/@types/yauzl/package.json +26 -26
  80. data/node_modules/agent-base/README.md +145 -145
  81. data/node_modules/agent-base/dist/src/index.d.ts +78 -78
  82. data/node_modules/agent-base/dist/src/index.js +202 -202
  83. data/node_modules/agent-base/dist/src/promisify.d.ts +4 -4
  84. data/node_modules/agent-base/dist/src/promisify.js +17 -17
  85. data/node_modules/agent-base/package.json +64 -64
  86. data/node_modules/agent-base/src/index.ts +345 -345
  87. data/node_modules/agent-base/src/promisify.ts +33 -33
  88. data/node_modules/balanced-match/.github/FUNDING.yml +2 -2
  89. data/node_modules/balanced-match/LICENSE.md +21 -21
  90. data/node_modules/balanced-match/README.md +97 -97
  91. data/node_modules/balanced-match/index.js +62 -62
  92. data/node_modules/balanced-match/package.json +48 -48
  93. data/node_modules/base64-js/LICENSE +21 -21
  94. data/node_modules/base64-js/README.md +34 -34
  95. data/node_modules/base64-js/index.d.ts +3 -3
  96. data/node_modules/base64-js/index.js +150 -150
  97. data/node_modules/base64-js/package.json +47 -47
  98. data/node_modules/bl/.travis.yml +17 -17
  99. data/node_modules/bl/BufferList.js +396 -396
  100. data/node_modules/bl/LICENSE.md +13 -13
  101. data/node_modules/bl/README.md +247 -247
  102. data/node_modules/bl/bl.js +84 -84
  103. data/node_modules/bl/package.json +37 -37
  104. data/node_modules/bl/test/convert.js +21 -21
  105. data/node_modules/bl/test/indexOf.js +492 -492
  106. data/node_modules/bl/test/isBufferList.js +32 -32
  107. data/node_modules/bl/test/test.js +869 -869
  108. data/node_modules/brace-expansion/LICENSE +21 -21
  109. data/node_modules/brace-expansion/README.md +129 -129
  110. data/node_modules/brace-expansion/index.js +201 -201
  111. data/node_modules/brace-expansion/package.json +47 -47
  112. data/node_modules/buffer/AUTHORS.md +70 -70
  113. data/node_modules/buffer/LICENSE +21 -21
  114. data/node_modules/buffer/README.md +410 -410
  115. data/node_modules/buffer/index.d.ts +186 -186
  116. data/node_modules/buffer/index.js +1817 -1817
  117. data/node_modules/buffer/package.json +96 -96
  118. data/node_modules/buffer-crc32/LICENSE +19 -19
  119. data/node_modules/buffer-crc32/README.md +47 -47
  120. data/node_modules/buffer-crc32/index.js +111 -111
  121. data/node_modules/buffer-crc32/package.json +39 -39
  122. data/node_modules/chownr/LICENSE +15 -15
  123. data/node_modules/chownr/README.md +3 -3
  124. data/node_modules/chownr/chownr.js +167 -167
  125. data/node_modules/chownr/package.json +29 -29
  126. data/node_modules/concat-map/.travis.yml +4 -4
  127. data/node_modules/concat-map/LICENSE +18 -18
  128. data/node_modules/concat-map/README.markdown +62 -62
  129. data/node_modules/concat-map/example/map.js +6 -6
  130. data/node_modules/concat-map/index.js +13 -13
  131. data/node_modules/concat-map/package.json +43 -43
  132. data/node_modules/concat-map/test/map.js +39 -39
  133. data/node_modules/debug/LICENSE +19 -19
  134. data/node_modules/debug/README.md +455 -455
  135. data/node_modules/debug/package.json +59 -59
  136. data/node_modules/debug/src/browser.js +269 -269
  137. data/node_modules/debug/src/common.js +274 -274
  138. data/node_modules/debug/src/index.js +10 -10
  139. data/node_modules/debug/src/node.js +263 -263
  140. data/node_modules/devtools-protocol/LICENSE +27 -27
  141. data/node_modules/devtools-protocol/README.md +12 -12
  142. data/node_modules/devtools-protocol/json/browser_protocol.json +20985 -20640
  143. data/node_modules/devtools-protocol/json/js_protocol.json +3531 -3580
  144. data/node_modules/devtools-protocol/package.json +17 -18
  145. data/node_modules/devtools-protocol/pdl/browser_protocol.pdl +9849 -9637
  146. data/node_modules/devtools-protocol/pdl/js_protocol.pdl +1653 -1678
  147. data/node_modules/devtools-protocol/types/protocol-mapping.d.ts +4333 -4321
  148. data/node_modules/devtools-protocol/types/protocol-proxy-api.d.ts +3695 -3683
  149. data/node_modules/devtools-protocol/types/protocol.d.ts +15714 -15538
  150. data/node_modules/end-of-stream/LICENSE +20 -20
  151. data/node_modules/end-of-stream/README.md +54 -54
  152. data/node_modules/end-of-stream/index.js +94 -94
  153. data/node_modules/end-of-stream/package.json +37 -37
  154. data/node_modules/extract-zip/LICENSE +23 -23
  155. data/node_modules/extract-zip/cli.js +19 -19
  156. data/node_modules/extract-zip/index.d.ts +21 -21
  157. data/node_modules/extract-zip/index.js +173 -173
  158. data/node_modules/extract-zip/package.json +80 -80
  159. data/node_modules/extract-zip/readme.md +57 -57
  160. data/node_modules/fd-slicer/.npmignore +2 -2
  161. data/node_modules/fd-slicer/.travis.yml +7 -7
  162. data/node_modules/fd-slicer/CHANGELOG.md +49 -49
  163. data/node_modules/fd-slicer/LICENSE +21 -21
  164. data/node_modules/fd-slicer/README.md +199 -199
  165. data/node_modules/fd-slicer/index.js +296 -296
  166. data/node_modules/fd-slicer/package.json +36 -36
  167. data/node_modules/fd-slicer/test/test.js +350 -350
  168. data/node_modules/find-up/index.d.ts +137 -137
  169. data/node_modules/find-up/index.js +89 -89
  170. data/node_modules/find-up/license +9 -9
  171. data/node_modules/find-up/package.json +53 -53
  172. data/node_modules/find-up/readme.md +156 -156
  173. data/node_modules/fs-constants/LICENSE +21 -21
  174. data/node_modules/fs-constants/README.md +26 -26
  175. data/node_modules/fs-constants/browser.js +1 -1
  176. data/node_modules/fs-constants/index.js +1 -1
  177. data/node_modules/fs-constants/package.json +19 -19
  178. data/node_modules/fs.realpath/LICENSE +43 -43
  179. data/node_modules/fs.realpath/README.md +33 -33
  180. data/node_modules/fs.realpath/index.js +66 -66
  181. data/node_modules/fs.realpath/old.js +303 -303
  182. data/node_modules/fs.realpath/package.json +26 -26
  183. data/node_modules/get-stream/buffer-stream.js +52 -52
  184. data/node_modules/get-stream/index.d.ts +108 -108
  185. data/node_modules/get-stream/index.js +60 -60
  186. data/node_modules/get-stream/license +9 -9
  187. data/node_modules/get-stream/package.json +50 -50
  188. data/node_modules/get-stream/readme.md +124 -124
  189. data/node_modules/glob/LICENSE +21 -21
  190. data/node_modules/glob/README.md +375 -375
  191. data/node_modules/glob/changelog.md +67 -67
  192. data/node_modules/glob/common.js +234 -234
  193. data/node_modules/glob/glob.js +788 -788
  194. data/node_modules/glob/package.json +51 -51
  195. data/node_modules/glob/sync.js +484 -484
  196. data/node_modules/https-proxy-agent/README.md +137 -137
  197. data/node_modules/https-proxy-agent/dist/agent.d.ts +30 -30
  198. data/node_modules/https-proxy-agent/dist/agent.js +179 -179
  199. data/node_modules/https-proxy-agent/dist/index.d.ts +23 -23
  200. data/node_modules/https-proxy-agent/dist/index.js +13 -13
  201. data/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts +7 -7
  202. data/node_modules/https-proxy-agent/dist/parse-proxy-response.js +65 -65
  203. data/node_modules/https-proxy-agent/package.json +56 -56
  204. data/node_modules/ieee754/LICENSE +11 -11
  205. data/node_modules/ieee754/README.md +51 -51
  206. data/node_modules/ieee754/index.d.ts +9 -9
  207. data/node_modules/ieee754/index.js +85 -85
  208. data/node_modules/ieee754/package.json +52 -52
  209. data/node_modules/inflight/LICENSE +15 -15
  210. data/node_modules/inflight/README.md +37 -37
  211. data/node_modules/inflight/inflight.js +54 -54
  212. data/node_modules/inflight/package.json +29 -29
  213. data/node_modules/inherits/LICENSE +16 -16
  214. data/node_modules/inherits/README.md +42 -42
  215. data/node_modules/inherits/inherits.js +9 -9
  216. data/node_modules/inherits/inherits_browser.js +27 -27
  217. data/node_modules/inherits/package.json +29 -29
  218. data/node_modules/locate-path/index.d.ts +83 -83
  219. data/node_modules/locate-path/index.js +65 -65
  220. data/node_modules/locate-path/license +9 -9
  221. data/node_modules/locate-path/package.json +45 -45
  222. data/node_modules/locate-path/readme.md +122 -122
  223. data/node_modules/minimatch/LICENSE +15 -15
  224. data/node_modules/minimatch/README.md +209 -209
  225. data/node_modules/minimatch/minimatch.js +923 -923
  226. data/node_modules/minimatch/package.json +30 -30
  227. data/node_modules/mkdirp-classic/LICENSE +21 -21
  228. data/node_modules/mkdirp-classic/README.md +18 -18
  229. data/node_modules/mkdirp-classic/index.js +98 -98
  230. data/node_modules/mkdirp-classic/package.json +18 -18
  231. data/node_modules/ms/index.js +162 -162
  232. data/node_modules/ms/license.md +21 -21
  233. data/node_modules/ms/package.json +37 -37
  234. data/node_modules/ms/readme.md +60 -60
  235. data/node_modules/node-fetch/LICENSE.md +22 -22
  236. data/node_modules/node-fetch/README.md +590 -590
  237. data/node_modules/node-fetch/browser.js +24 -24
  238. data/node_modules/node-fetch/lib/index.es.js +1662 -1662
  239. data/node_modules/node-fetch/lib/index.js +1671 -1671
  240. data/node_modules/node-fetch/lib/index.mjs +1660 -1660
  241. data/node_modules/node-fetch/package.json +68 -68
  242. data/node_modules/once/LICENSE +15 -15
  243. data/node_modules/once/README.md +79 -79
  244. data/node_modules/once/once.js +42 -42
  245. data/node_modules/once/package.json +33 -33
  246. data/node_modules/p-limit/index.d.ts +38 -38
  247. data/node_modules/p-limit/index.js +57 -57
  248. data/node_modules/p-limit/license +9 -9
  249. data/node_modules/p-limit/package.json +52 -52
  250. data/node_modules/p-limit/readme.md +101 -101
  251. data/node_modules/p-locate/index.d.ts +64 -64
  252. data/node_modules/p-locate/index.js +52 -52
  253. data/node_modules/p-locate/license +9 -9
  254. data/node_modules/p-locate/package.json +53 -53
  255. data/node_modules/p-locate/readme.md +90 -90
  256. data/node_modules/p-try/index.d.ts +39 -39
  257. data/node_modules/p-try/index.js +9 -9
  258. data/node_modules/p-try/license +9 -9
  259. data/node_modules/p-try/package.json +42 -42
  260. data/node_modules/p-try/readme.md +58 -58
  261. data/node_modules/path-exists/index.d.ts +28 -28
  262. data/node_modules/path-exists/index.js +23 -23
  263. data/node_modules/path-exists/license +9 -9
  264. data/node_modules/path-exists/package.json +39 -39
  265. data/node_modules/path-exists/readme.md +52 -52
  266. data/node_modules/path-is-absolute/index.js +20 -20
  267. data/node_modules/path-is-absolute/license +21 -21
  268. data/node_modules/path-is-absolute/package.json +43 -43
  269. data/node_modules/path-is-absolute/readme.md +59 -59
  270. data/node_modules/pend/LICENSE +23 -23
  271. data/node_modules/pend/README.md +41 -41
  272. data/node_modules/pend/index.js +55 -55
  273. data/node_modules/pend/package.json +18 -18
  274. data/node_modules/pend/test.js +137 -137
  275. data/node_modules/pkg-dir/index.d.ts +44 -44
  276. data/node_modules/pkg-dir/index.js +17 -17
  277. data/node_modules/pkg-dir/license +9 -9
  278. data/node_modules/pkg-dir/package.json +56 -56
  279. data/node_modules/pkg-dir/readme.md +66 -66
  280. data/node_modules/progress/CHANGELOG.md +115 -115
  281. data/node_modules/progress/LICENSE +22 -22
  282. data/node_modules/progress/Makefile +8 -8
  283. data/node_modules/progress/Readme.md +146 -146
  284. data/node_modules/progress/index.js +1 -1
  285. data/node_modules/progress/lib/node-progress.js +236 -236
  286. data/node_modules/progress/package.json +26 -26
  287. data/node_modules/proxy-from-env/.eslintrc +29 -29
  288. data/node_modules/proxy-from-env/.travis.yml +10 -10
  289. data/node_modules/proxy-from-env/LICENSE +20 -20
  290. data/node_modules/proxy-from-env/README.md +131 -131
  291. data/node_modules/proxy-from-env/index.js +108 -108
  292. data/node_modules/proxy-from-env/package.json +34 -34
  293. data/node_modules/proxy-from-env/test.js +483 -483
  294. data/node_modules/pump/.travis.yml +5 -5
  295. data/node_modules/pump/LICENSE +20 -20
  296. data/node_modules/pump/README.md +65 -65
  297. data/node_modules/pump/index.js +82 -82
  298. data/node_modules/pump/package.json +24 -24
  299. data/node_modules/pump/test-browser.js +66 -66
  300. data/node_modules/pump/test-node.js +53 -53
  301. data/node_modules/puppeteer-core/CHANGELOG.md +319 -290
  302. data/node_modules/puppeteer-core/LICENSE +202 -202
  303. data/node_modules/puppeteer-core/README.md +481 -481
  304. data/node_modules/puppeteer-core/cjs-entry-core.js +29 -29
  305. data/node_modules/puppeteer-core/cjs-entry.js +29 -29
  306. data/node_modules/puppeteer-core/install.js +89 -89
  307. data/node_modules/puppeteer-core/lib/cjs/puppeteer/api-docs-entry.d.ts +110 -110
  308. data/node_modules/puppeteer-core/lib/cjs/puppeteer/api-docs-entry.js +80 -80
  309. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Accessibility.d.ts +175 -175
  310. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Accessibility.js +360 -360
  311. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/AriaQueryHandler.d.ts +20 -20
  312. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/AriaQueryHandler.js +84 -84
  313. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/AriaQueryHandler.js.map +1 -1
  314. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Browser.d.ts +455 -455
  315. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Browser.js +540 -540
  316. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/BrowserConnector.d.ts +53 -53
  317. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/BrowserConnector.js +97 -97
  318. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/BrowserWebSocketTransport.d.ts +25 -25
  319. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/BrowserWebSocketTransport.js +34 -34
  320. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.d.ts +135 -135
  321. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js +298 -298
  322. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ConnectionTransport.d.ts +24 -24
  323. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ConnectionTransport.js +17 -17
  324. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ConsoleMessage.d.ts +72 -72
  325. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ConsoleMessage.js +64 -64
  326. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Coverage.d.ts +204 -204
  327. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Coverage.js +335 -335
  328. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/DOMWorld.d.ts +175 -175
  329. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/DOMWorld.js +662 -662
  330. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Debug.d.ts +52 -52
  331. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Debug.js +81 -81
  332. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/DeviceDescriptors.d.ts +40 -40
  333. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/DeviceDescriptors.js +1070 -1070
  334. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Dialog.d.ts +74 -74
  335. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Dialog.js +97 -97
  336. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EmulationManager.d.ts +24 -24
  337. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EmulationManager.js +37 -37
  338. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Errors.d.ts +50 -50
  339. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Errors.js +56 -56
  340. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EvalTypes.d.ts +60 -60
  341. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EvalTypes.js +17 -17
  342. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EventEmitter.d.ts +92 -92
  343. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EventEmitter.js +116 -116
  344. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Events.d.ts +81 -81
  345. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Events.js +86 -86
  346. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ExecutionContext.d.ts +193 -193
  347. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ExecutionContext.js +321 -321
  348. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/FileChooser.d.ts +58 -58
  349. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/FileChooser.js +71 -71
  350. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/FrameManager.d.ts +744 -744
  351. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/FrameManager.js +1047 -1047
  352. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/FrameManager.js.map +1 -1
  353. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/HTTPRequest.d.ts +350 -345
  354. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/HTTPRequest.d.ts.map +1 -1
  355. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/HTTPRequest.js +549 -549
  356. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/HTTPRequest.js.map +1 -1
  357. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/HTTPResponse.d.ts +134 -125
  358. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/HTTPResponse.d.ts.map +1 -1
  359. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/HTTPResponse.js +184 -164
  360. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/HTTPResponse.js.map +1 -1
  361. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Input.d.ts +358 -358
  362. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Input.js +543 -543
  363. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/JSHandle.d.ts +490 -490
  364. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/JSHandle.js +827 -827
  365. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/LifecycleWatcher.d.ts +65 -65
  366. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/LifecycleWatcher.d.ts.map +1 -1
  367. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/LifecycleWatcher.js +149 -148
  368. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/LifecycleWatcher.js.map +1 -1
  369. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/NetworkConditions.d.ts +26 -26
  370. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/NetworkConditions.js +33 -33
  371. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/NetworkManager.d.ts +126 -97
  372. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/NetworkManager.d.ts.map +1 -1
  373. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/NetworkManager.js +467 -342
  374. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/NetworkManager.js.map +1 -1
  375. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/PDFOptions.d.ts +161 -161
  376. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/PDFOptions.js +34 -34
  377. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Page.d.ts +2055 -2055
  378. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Page.js +2533 -2533
  379. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Product.d.ts +20 -20
  380. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Product.js +17 -17
  381. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Puppeteer.d.ts +159 -159
  382. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Puppeteer.js +161 -161
  383. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/PuppeteerViewport.d.ts +51 -51
  384. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/PuppeteerViewport.js +2 -2
  385. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/QueryHandler.d.ts +64 -64
  386. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/QueryHandler.js +165 -165
  387. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/SecurityDetails.d.ts +60 -60
  388. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/SecurityDetails.js +76 -76
  389. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Target.d.ts +100 -100
  390. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Target.js +145 -145
  391. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/TaskQueue.d.ts +20 -20
  392. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/TaskQueue.js +29 -29
  393. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/TimeoutSettings.d.ts +27 -27
  394. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/TimeoutSettings.js +47 -47
  395. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Tracing.d.ts +46 -46
  396. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Tracing.js +109 -109
  397. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/USKeyboardLayout.d.ts +39 -39
  398. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/USKeyboardLayout.js +406 -406
  399. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/WebWorker.d.ts +98 -98
  400. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/WebWorker.js +112 -112
  401. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/assert.d.ts +22 -22
  402. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/assert.js +33 -33
  403. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/fetch.d.ts +16 -16
  404. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/fetch.js +43 -43
  405. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/helper.d.ts +84 -84
  406. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/helper.js +327 -327
  407. data/node_modules/puppeteer-core/lib/cjs/puppeteer/environment.d.ts +16 -16
  408. data/node_modules/puppeteer-core/lib/cjs/puppeteer/environment.js +19 -19
  409. data/node_modules/puppeteer-core/lib/cjs/puppeteer/global.d.ts +16 -16
  410. data/node_modules/puppeteer-core/lib/cjs/puppeteer/global.js +2 -2
  411. data/node_modules/puppeteer-core/lib/cjs/puppeteer/initialize-node.d.ts +17 -17
  412. data/node_modules/puppeteer-core/lib/cjs/puppeteer/initialize-node.js +44 -44
  413. data/node_modules/puppeteer-core/lib/cjs/puppeteer/initialize-web.d.ts +17 -17
  414. data/node_modules/puppeteer-core/lib/cjs/puppeteer/initialize-web.js +26 -26
  415. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserFetcher.d.ts +133 -133
  416. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserFetcher.js +500 -500
  417. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.d.ts +40 -39
  418. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.d.ts.map +1 -1
  419. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.js +256 -230
  420. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.js.map +1 -1
  421. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/LaunchOptions.d.ts +134 -134
  422. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/LaunchOptions.js +17 -17
  423. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/Launcher.d.ts +16 -16
  424. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/Launcher.d.ts.map +1 -1
  425. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/Launcher.js +655 -588
  426. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/Launcher.js.map +1 -1
  427. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/NodeWebSocketTransport.d.ts +26 -26
  428. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/NodeWebSocketTransport.js +47 -47
  429. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/PipeTransport.d.ts +29 -29
  430. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/PipeTransport.js +64 -64
  431. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/Puppeteer.d.ts +153 -153
  432. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/Puppeteer.js +188 -188
  433. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/install.d.ts +17 -17
  434. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/install.js +173 -173
  435. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node-puppeteer-core.d.ts +17 -17
  436. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node-puppeteer-core.js +24 -24
  437. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node.d.ts +17 -17
  438. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node.js +23 -23
  439. data/node_modules/puppeteer-core/lib/cjs/puppeteer/revisions.d.ts +21 -21
  440. data/node_modules/puppeteer-core/lib/cjs/puppeteer/revisions.js +22 -22
  441. data/node_modules/puppeteer-core/lib/cjs/puppeteer/web.d.ts +17 -17
  442. data/node_modules/puppeteer-core/lib/cjs/puppeteer/web.js +23 -23
  443. data/node_modules/puppeteer-core/lib/cjs/vendor/mitt/src/index.d.ts +27 -27
  444. data/node_modules/puppeteer-core/lib/cjs/vendor/mitt/src/index.js +56 -56
  445. data/node_modules/puppeteer-core/lib/esm/puppeteer/api-docs-entry.d.ts +110 -110
  446. data/node_modules/puppeteer-core/lib/esm/puppeteer/api-docs-entry.js +80 -80
  447. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Accessibility.d.ts +175 -175
  448. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Accessibility.js +356 -356
  449. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/AriaQueryHandler.d.ts +20 -20
  450. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/AriaQueryHandler.js +81 -81
  451. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/AriaQueryHandler.js.map +1 -1
  452. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Browser.d.ts +455 -455
  453. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Browser.js +535 -535
  454. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/BrowserConnector.d.ts +53 -53
  455. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/BrowserConnector.js +74 -74
  456. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/BrowserWebSocketTransport.d.ts +25 -25
  457. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/BrowserWebSocketTransport.js +30 -30
  458. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Connection.d.ts +135 -135
  459. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Connection.js +293 -293
  460. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/ConnectionTransport.d.ts +24 -24
  461. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/ConnectionTransport.js +16 -16
  462. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/ConsoleMessage.d.ts +72 -72
  463. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/ConsoleMessage.js +60 -60
  464. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Coverage.d.ts +204 -204
  465. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Coverage.js +329 -329
  466. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/DOMWorld.d.ts +175 -175
  467. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/DOMWorld.js +657 -657
  468. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Debug.d.ts +52 -52
  469. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Debug.js +77 -77
  470. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/DeviceDescriptors.d.ts +40 -40
  471. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/DeviceDescriptors.js +1067 -1067
  472. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Dialog.d.ts +74 -74
  473. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Dialog.js +93 -93
  474. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/EmulationManager.d.ts +24 -24
  475. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/EmulationManager.js +33 -33
  476. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Errors.d.ts +50 -50
  477. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Errors.js +50 -50
  478. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/EvalTypes.d.ts +60 -60
  479. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/EvalTypes.js +16 -16
  480. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/EventEmitter.d.ts +92 -92
  481. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/EventEmitter.js +109 -109
  482. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Events.d.ts +81 -81
  483. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Events.js +83 -83
  484. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/ExecutionContext.d.ts +193 -193
  485. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/ExecutionContext.js +317 -317
  486. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/FileChooser.d.ts +58 -58
  487. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/FileChooser.js +67 -67
  488. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/FrameManager.d.ts +744 -744
  489. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/FrameManager.js +1042 -1042
  490. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/FrameManager.js.map +1 -1
  491. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/HTTPRequest.d.ts +350 -345
  492. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/HTTPRequest.d.ts.map +1 -1
  493. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/HTTPRequest.js +545 -545
  494. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/HTTPRequest.js.map +1 -1
  495. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/HTTPResponse.d.ts +134 -125
  496. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/HTTPResponse.d.ts.map +1 -1
  497. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/HTTPResponse.js +180 -160
  498. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/HTTPResponse.js.map +1 -1
  499. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Input.d.ts +358 -358
  500. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Input.js +537 -537
  501. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/JSHandle.d.ts +490 -490
  502. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/JSHandle.js +802 -802
  503. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/LifecycleWatcher.d.ts +65 -65
  504. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/LifecycleWatcher.d.ts.map +1 -1
  505. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/LifecycleWatcher.js +145 -144
  506. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/LifecycleWatcher.js.map +1 -1
  507. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/NetworkConditions.d.ts +26 -26
  508. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/NetworkConditions.js +30 -30
  509. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/NetworkManager.d.ts +126 -97
  510. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/NetworkManager.d.ts.map +1 -1
  511. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/NetworkManager.js +463 -338
  512. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/NetworkManager.js.map +1 -1
  513. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/PDFOptions.d.ts +161 -161
  514. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/PDFOptions.js +31 -31
  515. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Page.d.ts +2055 -2055
  516. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Page.js +2529 -2529
  517. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Product.d.ts +20 -20
  518. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Product.js +16 -16
  519. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Puppeteer.d.ts +159 -159
  520. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Puppeteer.js +157 -157
  521. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/PuppeteerViewport.d.ts +51 -51
  522. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/PuppeteerViewport.js +1 -1
  523. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/QueryHandler.d.ts +64 -64
  524. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/QueryHandler.js +157 -157
  525. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/SecurityDetails.d.ts +60 -60
  526. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/SecurityDetails.js +72 -72
  527. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Target.d.ts +100 -100
  528. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Target.js +141 -141
  529. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/TaskQueue.d.ts +20 -20
  530. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/TaskQueue.js +25 -25
  531. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/TimeoutSettings.d.ts +27 -27
  532. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/TimeoutSettings.js +43 -43
  533. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Tracing.d.ts +46 -46
  534. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Tracing.js +105 -105
  535. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/USKeyboardLayout.d.ts +39 -39
  536. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/USKeyboardLayout.js +403 -403
  537. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/WebWorker.d.ts +98 -98
  538. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/WebWorker.js +108 -108
  539. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/assert.d.ts +22 -22
  540. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/assert.js +28 -28
  541. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/fetch.d.ts +16 -16
  542. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/fetch.js +20 -20
  543. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/helper.d.ts +84 -84
  544. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/helper.js +305 -305
  545. data/node_modules/puppeteer-core/lib/esm/puppeteer/environment.d.ts +16 -16
  546. data/node_modules/puppeteer-core/lib/esm/puppeteer/environment.js +16 -16
  547. data/node_modules/puppeteer-core/lib/esm/puppeteer/global.d.ts +16 -16
  548. data/node_modules/puppeteer-core/lib/esm/puppeteer/global.js +1 -1
  549. data/node_modules/puppeteer-core/lib/esm/puppeteer/initialize-node.d.ts +17 -17
  550. data/node_modules/puppeteer-core/lib/esm/puppeteer/initialize-node.js +37 -37
  551. data/node_modules/puppeteer-core/lib/esm/puppeteer/initialize-web.d.ts +17 -17
  552. data/node_modules/puppeteer-core/lib/esm/puppeteer/initialize-web.js +22 -22
  553. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserFetcher.d.ts +133 -133
  554. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserFetcher.js +474 -474
  555. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserRunner.d.ts +40 -39
  556. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserRunner.d.ts.map +1 -1
  557. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserRunner.js +230 -204
  558. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserRunner.js.map +1 -1
  559. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/LaunchOptions.d.ts +134 -134
  560. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/LaunchOptions.js +16 -16
  561. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/Launcher.d.ts +16 -16
  562. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/Launcher.d.ts.map +1 -1
  563. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/Launcher.js +633 -566
  564. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/Launcher.js.map +1 -1
  565. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/NodeWebSocketTransport.d.ts +26 -26
  566. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/NodeWebSocketTransport.js +40 -40
  567. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/PipeTransport.d.ts +29 -29
  568. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/PipeTransport.js +60 -60
  569. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/Puppeteer.d.ts +153 -153
  570. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/Puppeteer.js +181 -181
  571. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/install.d.ts +17 -17
  572. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/install.js +165 -165
  573. data/node_modules/puppeteer-core/lib/esm/puppeteer/node-puppeteer-core.d.ts +17 -17
  574. data/node_modules/puppeteer-core/lib/esm/puppeteer/node-puppeteer-core.js +22 -22
  575. data/node_modules/puppeteer-core/lib/esm/puppeteer/node.d.ts +17 -17
  576. data/node_modules/puppeteer-core/lib/esm/puppeteer/node.js +21 -21
  577. data/node_modules/puppeteer-core/lib/esm/puppeteer/revisions.d.ts +21 -21
  578. data/node_modules/puppeteer-core/lib/esm/puppeteer/revisions.js +19 -19
  579. data/node_modules/puppeteer-core/lib/esm/puppeteer/web.d.ts +17 -17
  580. data/node_modules/puppeteer-core/lib/esm/puppeteer/web.js +21 -21
  581. data/node_modules/puppeteer-core/lib/esm/vendor/mitt/src/index.d.ts +27 -27
  582. data/node_modules/puppeteer-core/lib/esm/vendor/mitt/src/index.js +53 -53
  583. data/node_modules/puppeteer-core/lib/types.d.ts +67 -25
  584. data/node_modules/puppeteer-core/package.json +115 -115
  585. data/node_modules/puppeteer-core/typescript-if-required.js +61 -61
  586. data/node_modules/readable-stream/CONTRIBUTING.md +38 -38
  587. data/node_modules/readable-stream/GOVERNANCE.md +136 -136
  588. data/node_modules/readable-stream/LICENSE +47 -47
  589. data/node_modules/readable-stream/README.md +106 -106
  590. data/node_modules/readable-stream/errors-browser.js +127 -127
  591. data/node_modules/readable-stream/errors.js +116 -116
  592. data/node_modules/readable-stream/experimentalWarning.js +17 -17
  593. data/node_modules/readable-stream/lib/_stream_duplex.js +138 -138
  594. data/node_modules/readable-stream/lib/_stream_passthrough.js +38 -38
  595. data/node_modules/readable-stream/lib/_stream_readable.js +1123 -1123
  596. data/node_modules/readable-stream/lib/_stream_transform.js +200 -200
  597. data/node_modules/readable-stream/lib/_stream_writable.js +696 -696
  598. data/node_modules/readable-stream/lib/internal/streams/async_iterator.js +206 -206
  599. data/node_modules/readable-stream/lib/internal/streams/buffer_list.js +209 -209
  600. data/node_modules/readable-stream/lib/internal/streams/destroy.js +104 -104
  601. data/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +103 -103
  602. data/node_modules/readable-stream/lib/internal/streams/from-browser.js +3 -3
  603. data/node_modules/readable-stream/lib/internal/streams/from.js +63 -63
  604. data/node_modules/readable-stream/lib/internal/streams/pipeline.js +96 -96
  605. data/node_modules/readable-stream/lib/internal/streams/state.js +26 -26
  606. data/node_modules/readable-stream/lib/internal/streams/stream-browser.js +1 -1
  607. data/node_modules/readable-stream/lib/internal/streams/stream.js +1 -1
  608. data/node_modules/readable-stream/package.json +68 -68
  609. data/node_modules/readable-stream/readable-browser.js +9 -9
  610. data/node_modules/readable-stream/readable.js +16 -16
  611. data/node_modules/rimraf/CHANGELOG.md +65 -65
  612. data/node_modules/rimraf/LICENSE +15 -15
  613. data/node_modules/rimraf/README.md +101 -101
  614. data/node_modules/rimraf/bin.js +68 -68
  615. data/node_modules/rimraf/package.json +32 -32
  616. data/node_modules/rimraf/rimraf.js +360 -360
  617. data/node_modules/safe-buffer/LICENSE +21 -21
  618. data/node_modules/safe-buffer/README.md +584 -584
  619. data/node_modules/safe-buffer/index.d.ts +186 -186
  620. data/node_modules/safe-buffer/index.js +65 -65
  621. data/node_modules/safe-buffer/package.json +51 -51
  622. data/node_modules/string_decoder/LICENSE +48 -48
  623. data/node_modules/string_decoder/README.md +47 -47
  624. data/node_modules/string_decoder/lib/string_decoder.js +295 -295
  625. data/node_modules/string_decoder/package.json +34 -34
  626. data/node_modules/tar-fs/.travis.yml +6 -6
  627. data/node_modules/tar-fs/LICENSE +20 -20
  628. data/node_modules/tar-fs/README.md +165 -165
  629. data/node_modules/tar-fs/index.js +351 -351
  630. data/node_modules/tar-fs/package.json +41 -41
  631. data/node_modules/tar-fs/test/fixtures/a/hello.txt +1 -1
  632. data/node_modules/tar-fs/test/fixtures/b/a/test.txt +1 -1
  633. data/node_modules/tar-fs/test/index.js +346 -346
  634. data/node_modules/tar-stream/LICENSE +20 -20
  635. data/node_modules/tar-stream/README.md +168 -168
  636. data/node_modules/tar-stream/extract.js +257 -257
  637. data/node_modules/tar-stream/headers.js +295 -295
  638. data/node_modules/tar-stream/index.js +2 -2
  639. data/node_modules/tar-stream/pack.js +255 -255
  640. data/node_modules/tar-stream/package.json +58 -58
  641. data/node_modules/tar-stream/sandbox.js +11 -11
  642. data/node_modules/through/.travis.yml +5 -5
  643. data/node_modules/through/LICENSE.APACHE2 +15 -15
  644. data/node_modules/through/LICENSE.MIT +24 -24
  645. data/node_modules/through/index.js +108 -108
  646. data/node_modules/through/package.json +36 -36
  647. data/node_modules/through/readme.markdown +64 -64
  648. data/node_modules/through/test/async.js +28 -28
  649. data/node_modules/through/test/auto-destroy.js +30 -30
  650. data/node_modules/through/test/buffering.js +71 -71
  651. data/node_modules/through/test/end.js +45 -45
  652. data/node_modules/through/test/index.js +133 -133
  653. data/node_modules/tr46/.npmignore +4 -4
  654. data/node_modules/tr46/index.js +193 -193
  655. data/node_modules/tr46/package.json +31 -31
  656. data/node_modules/unbzip2-stream/LICENSE +24 -24
  657. data/node_modules/unbzip2-stream/README.md +59 -59
  658. data/node_modules/unbzip2-stream/dist/unbzip2-stream.min.js +1 -1
  659. data/node_modules/unbzip2-stream/index.js +93 -93
  660. data/node_modules/unbzip2-stream/lib/bit_iterator.js +39 -39
  661. data/node_modules/unbzip2-stream/lib/bzip2.js +365 -365
  662. data/node_modules/unbzip2-stream/package.json +51 -51
  663. data/node_modules/util-deprecate/History.md +16 -16
  664. data/node_modules/util-deprecate/LICENSE +24 -24
  665. data/node_modules/util-deprecate/README.md +53 -53
  666. data/node_modules/util-deprecate/browser.js +67 -67
  667. data/node_modules/util-deprecate/node.js +6 -6
  668. data/node_modules/util-deprecate/package.json +27 -27
  669. data/node_modules/webidl-conversions/LICENSE.md +12 -12
  670. data/node_modules/webidl-conversions/README.md +53 -53
  671. data/node_modules/webidl-conversions/lib/index.js +189 -189
  672. data/node_modules/webidl-conversions/package.json +23 -23
  673. data/node_modules/whatwg-url/LICENSE.txt +21 -21
  674. data/node_modules/whatwg-url/README.md +67 -67
  675. data/node_modules/whatwg-url/lib/URL-impl.js +200 -200
  676. data/node_modules/whatwg-url/lib/URL.js +196 -196
  677. data/node_modules/whatwg-url/lib/public-api.js +11 -11
  678. data/node_modules/whatwg-url/lib/utils.js +20 -20
  679. data/node_modules/whatwg-url/package.json +32 -32
  680. data/node_modules/wrappy/LICENSE +15 -15
  681. data/node_modules/wrappy/README.md +36 -36
  682. data/node_modules/wrappy/package.json +29 -29
  683. data/node_modules/wrappy/wrappy.js +33 -33
  684. data/node_modules/ws/LICENSE +19 -19
  685. data/node_modules/ws/README.md +493 -493
  686. data/node_modules/ws/browser.js +8 -8
  687. data/node_modules/ws/index.js +13 -13
  688. data/node_modules/ws/lib/buffer-util.js +126 -126
  689. data/node_modules/ws/lib/constants.js +12 -12
  690. data/node_modules/ws/lib/event-target.js +266 -266
  691. data/node_modules/ws/lib/extension.js +203 -203
  692. data/node_modules/ws/lib/limiter.js +55 -55
  693. data/node_modules/ws/lib/permessage-deflate.js +511 -511
  694. data/node_modules/ws/lib/receiver.js +612 -612
  695. data/node_modules/ws/lib/sender.js +422 -422
  696. data/node_modules/ws/lib/stream.js +180 -180
  697. data/node_modules/ws/lib/subprotocol.js +62 -62
  698. data/node_modules/ws/lib/validation.js +124 -124
  699. data/node_modules/ws/lib/websocket-server.js +485 -485
  700. data/node_modules/ws/lib/websocket.js +1149 -1149
  701. data/node_modules/ws/package.json +61 -61
  702. data/node_modules/ws/wrapper.mjs +8 -8
  703. data/node_modules/yauzl/LICENSE +21 -21
  704. data/node_modules/yauzl/README.md +658 -658
  705. data/node_modules/yauzl/index.js +796 -796
  706. data/node_modules/yauzl/package.json +40 -40
  707. data/package.json +1 -1
  708. metadata +23 -25
  709. data/node_modules/devtools-protocol/changelog.md +0 -10491
  710. data/node_modules/devtools-protocol/externs/protocol_externs.js +0 -9734
@@ -1,2056 +1,2056 @@
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
- /// <reference types="node" />
17
- import type { Readable } from 'stream';
18
- import { EventEmitter } from './EventEmitter.js';
19
- import { CDPSession } from './Connection.js';
20
- import { Dialog } from './Dialog.js';
21
- import { Frame } from './FrameManager.js';
22
- import { Keyboard, Mouse, Touchscreen, MouseButton } from './Input.js';
23
- import { Tracing } from './Tracing.js';
24
- import { Coverage } from './Coverage.js';
25
- import { WebWorker } from './WebWorker.js';
26
- import { Browser, BrowserContext } from './Browser.js';
27
- import { Target } from './Target.js';
28
- import { JSHandle, ElementHandle } from './JSHandle.js';
29
- import { Viewport } from './PuppeteerViewport.js';
30
- import { Credentials, NetworkConditions } from './NetworkManager.js';
31
- import { HTTPRequest } from './HTTPRequest.js';
32
- import { HTTPResponse } from './HTTPResponse.js';
33
- import { Accessibility } from './Accessibility.js';
34
- import { FileChooser } from './FileChooser.js';
35
- import { ConsoleMessage } from './ConsoleMessage.js';
36
- import { PuppeteerLifeCycleEvent } from './LifecycleWatcher.js';
37
- import { Protocol } from 'devtools-protocol';
38
- import { SerializableOrJSHandle, EvaluateHandleFn, WrapElementHandle, EvaluateFn, EvaluateFnReturnType, UnwrapPromiseLike } from './EvalTypes.js';
39
- import { PDFOptions } from './PDFOptions.js';
40
- import { TaskQueue } from './TaskQueue.js';
41
- /**
42
- * @public
43
- */
44
- export interface Metrics {
45
- Timestamp?: number;
46
- Documents?: number;
47
- Frames?: number;
48
- JSEventListeners?: number;
49
- Nodes?: number;
50
- LayoutCount?: number;
51
- RecalcStyleCount?: number;
52
- LayoutDuration?: number;
53
- RecalcStyleDuration?: number;
54
- ScriptDuration?: number;
55
- TaskDuration?: number;
56
- JSHeapUsedSize?: number;
57
- JSHeapTotalSize?: number;
58
- }
59
- /**
60
- * @public
61
- */
62
- export interface WaitTimeoutOptions {
63
- /**
64
- * Maximum wait time in milliseconds, defaults to 30 seconds, pass `0` to
65
- * disable the timeout.
66
- *
67
- * @remarks
68
- * The default value can be changed by using the
69
- * {@link Page.setDefaultTimeout} method.
70
- */
71
- timeout?: number;
72
- }
73
- /**
74
- * @public
75
- */
76
- export interface WaitForOptions {
77
- /**
78
- * Maximum wait time in milliseconds, defaults to 30 seconds, pass `0` to
79
- * disable the timeout.
80
- *
81
- * @remarks
82
- * The default value can be changed by using the
83
- * {@link Page.setDefaultTimeout} or {@link Page.setDefaultNavigationTimeout}
84
- * methods.
85
- */
86
- timeout?: number;
87
- waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[];
88
- }
89
- /**
90
- * @public
91
- */
92
- export interface GeolocationOptions {
93
- /**
94
- * Latitude between -90 and 90.
95
- */
96
- longitude: number;
97
- /**
98
- * Longitude between -180 and 180.
99
- */
100
- latitude: number;
101
- /**
102
- * Optional non-negative accuracy value.
103
- */
104
- accuracy?: number;
105
- }
106
- /**
107
- * @public
108
- */
109
- export interface MediaFeature {
110
- name: string;
111
- value: string;
112
- }
113
- /**
114
- * @public
115
- */
116
- export interface ScreenshotClip {
117
- x: number;
118
- y: number;
119
- width: number;
120
- height: number;
121
- }
122
- /**
123
- * @public
124
- */
125
- export interface ScreenshotOptions {
126
- /**
127
- * @defaultValue 'png'
128
- */
129
- type?: 'png' | 'jpeg' | 'webp';
130
- /**
131
- * The file path to save the image to. The screenshot type will be inferred
132
- * from file extension. If path is a relative path, then it is resolved
133
- * relative to current working directory. If no path is provided, the image
134
- * won't be saved to the disk.
135
- */
136
- path?: string;
137
- /**
138
- * When true, takes a screenshot of the full page.
139
- * @defaultValue false
140
- */
141
- fullPage?: boolean;
142
- /**
143
- * An object which specifies the clipping region of the page.
144
- */
145
- clip?: ScreenshotClip;
146
- /**
147
- * Quality of the image, between 0-100. Not applicable to `png` images.
148
- */
149
- quality?: number;
150
- /**
151
- * Hides default white background and allows capturing screenshots with transparency.
152
- * @defaultValue false
153
- */
154
- omitBackground?: boolean;
155
- /**
156
- * Encoding of the image.
157
- * @defaultValue 'binary'
158
- */
159
- encoding?: 'base64' | 'binary';
160
- /**
161
- * If you need a screenshot bigger than the Viewport
162
- * @defaultValue true
163
- */
164
- captureBeyondViewport?: boolean;
165
- }
166
- /**
167
- * All the events that a page instance may emit.
168
- *
169
- * @public
170
- */
171
- export declare const enum PageEmittedEvents {
172
- /** Emitted when the page closes.
173
- * @eventProperty
174
- */
175
- Close = "close",
176
- /**
177
- * Emitted when JavaScript within the page calls one of console API methods,
178
- * e.g. `console.log` or `console.dir`. Also emitted if the page throws an
179
- * error or a warning.
180
- *
181
- * @remarks
182
- *
183
- * A `console` event provides a {@link ConsoleMessage} representing the
184
- * console message that was logged.
185
- *
186
- * @example
187
- * An example of handling `console` event:
188
- * ```js
189
- * page.on('console', msg => {
190
- * for (let i = 0; i < msg.args().length; ++i)
191
- * console.log(`${i}: ${msg.args()[i]}`);
192
- * });
193
- * page.evaluate(() => console.log('hello', 5, {foo: 'bar'}));
194
- * ```
195
- */
196
- Console = "console",
197
- /**
198
- * Emitted when a JavaScript dialog appears, such as `alert`, `prompt`,
199
- * `confirm` or `beforeunload`. Puppeteer can respond to the dialog via
200
- * {@link Dialog.accept} or {@link Dialog.dismiss}.
201
- */
202
- Dialog = "dialog",
203
- /**
204
- * Emitted when the JavaScript
205
- * {@link https://developer.mozilla.org/en-US/docs/Web/Events/DOMContentLoaded | DOMContentLoaded } event is dispatched.
206
- */
207
- DOMContentLoaded = "domcontentloaded",
208
- /**
209
- * Emitted when the page crashes. Will contain an `Error`.
210
- */
211
- Error = "error",
212
- /** Emitted when a frame is attached. Will contain a {@link Frame}. */
213
- FrameAttached = "frameattached",
214
- /** Emitted when a frame is detached. Will contain a {@link Frame}. */
215
- FrameDetached = "framedetached",
216
- /** Emitted when a frame is navigated to a new URL. Will contain a {@link Frame}. */
217
- FrameNavigated = "framenavigated",
218
- /**
219
- * Emitted when the JavaScript
220
- * {@link https://developer.mozilla.org/en-US/docs/Web/Events/load | load}
221
- * event is dispatched.
222
- */
223
- Load = "load",
224
- /**
225
- * Emitted when the JavaScript code makes a call to `console.timeStamp`. For
226
- * the list of metrics see {@link Page.metrics | page.metrics}.
227
- *
228
- * @remarks
229
- * Contains an object with two properties:
230
- * - `title`: the title passed to `console.timeStamp`
231
- * - `metrics`: objec containing metrics as key/value pairs. The values will
232
- * be `number`s.
233
- */
234
- Metrics = "metrics",
235
- /**
236
- * Emitted when an uncaught exception happens within the page.
237
- * Contains an `Error`.
238
- */
239
- PageError = "pageerror",
240
- /**
241
- * Emitted when the page opens a new tab or window.
242
- *
243
- * Contains a {@link Page} corresponding to the popup window.
244
- *
245
- * @example
246
- *
247
- * ```js
248
- * const [popup] = await Promise.all([
249
- * new Promise(resolve => page.once('popup', resolve)),
250
- * page.click('a[target=_blank]'),
251
- * ]);
252
- * ```
253
- *
254
- * ```js
255
- * const [popup] = await Promise.all([
256
- * new Promise(resolve => page.once('popup', resolve)),
257
- * page.evaluate(() => window.open('https://example.com')),
258
- * ]);
259
- * ```
260
- */
261
- Popup = "popup",
262
- /**
263
- * Emitted when a page issues a request and contains a {@link HTTPRequest}.
264
- *
265
- * @remarks
266
- * The object is readonly. See {@link Page.setRequestInterception} for intercepting
267
- * and mutating requests.
268
- */
269
- Request = "request",
270
- /**
271
- * Emitted when a request ended up loading from cache. Contains a {@link HTTPRequest}.
272
- *
273
- * @remarks
274
- * For certain requests, might contain undefined.
275
- * {@link https://crbug.com/750469}
276
- */
277
- RequestServedFromCache = "requestservedfromcache",
278
- /**
279
- * Emitted when a request fails, for example by timing out.
280
- *
281
- * Contains a {@link HTTPRequest}.
282
- *
283
- * @remarks
284
- *
285
- * NOTE: HTTP Error responses, such as 404 or 503, are still successful
286
- * responses from HTTP standpoint, so request will complete with
287
- * `requestfinished` event and not with `requestfailed`.
288
- */
289
- RequestFailed = "requestfailed",
290
- /**
291
- * Emitted when a request finishes successfully. Contains a {@link HTTPRequest}.
292
- */
293
- RequestFinished = "requestfinished",
294
- /**
295
- * Emitted when a response is received. Contains a {@link HTTPResponse}.
296
- */
297
- Response = "response",
298
- /**
299
- * Emitted when a dedicated
300
- * {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API | WebWorker}
301
- * is spawned by the page.
302
- */
303
- WorkerCreated = "workercreated",
304
- /**
305
- * Emitted when a dedicated
306
- * {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API | WebWorker}
307
- * is destroyed by the page.
308
- */
309
- WorkerDestroyed = "workerdestroyed"
310
- }
311
- /**
312
- * Denotes the objects received by callback functions for page events.
313
- *
314
- * See {@link PageEmittedEvents} for more detail on the events and when they are
315
- * emitted.
316
- * @public
317
- */
318
- export interface PageEventObject {
319
- close: never;
320
- console: ConsoleMessage;
321
- dialog: Dialog;
322
- domcontentloaded: never;
323
- error: Error;
324
- frameattached: Frame;
325
- framedetached: Frame;
326
- framenavigated: Frame;
327
- load: never;
328
- metrics: {
329
- title: string;
330
- metrics: Metrics;
331
- };
332
- pageerror: Error;
333
- popup: Page;
334
- request: HTTPRequest;
335
- response: HTTPResponse;
336
- requestfailed: HTTPRequest;
337
- requestfinished: HTTPRequest;
338
- requestservedfromcache: HTTPRequest;
339
- workercreated: WebWorker;
340
- workerdestroyed: WebWorker;
341
- }
342
- /**
343
- * Page provides methods to interact with a single tab or
344
- * {@link https://developer.chrome.com/extensions/background_pages | extension background page} in Chromium.
345
- *
346
- * @remarks
347
- *
348
- * One Browser instance might have multiple Page instances.
349
- *
350
- * @example
351
- * This example creates a page, navigates it to a URL, and then * saves a screenshot:
352
- * ```js
353
- * const puppeteer = require('puppeteer');
354
- *
355
- * (async () => {
356
- * const browser = await puppeteer.launch();
357
- * const page = await browser.newPage();
358
- * await page.goto('https://example.com');
359
- * await page.screenshot({path: 'screenshot.png'});
360
- * await browser.close();
361
- * })();
362
- * ```
363
- *
364
- * The Page class extends from Puppeteer's {@link EventEmitter} class and will
365
- * emit various events which are documented in the {@link PageEmittedEvents} enum.
366
- *
367
- * @example
368
- * This example logs a message for a single page `load` event:
369
- * ```js
370
- * page.once('load', () => console.log('Page loaded!'));
371
- * ```
372
- *
373
- * To unsubscribe from events use the `off` method:
374
- *
375
- * ```js
376
- * function logRequest(interceptedRequest) {
377
- * console.log('A request was made:', interceptedRequest.url());
378
- * }
379
- * page.on('request', logRequest);
380
- * // Sometime later...
381
- * page.off('request', logRequest);
382
- * ```
383
- * @public
384
- */
385
- export declare class Page extends EventEmitter {
386
- /**
387
- * @internal
388
- */
389
- static create(client: CDPSession, target: Target, ignoreHTTPSErrors: boolean, defaultViewport: Viewport | null, screenshotTaskQueue: TaskQueue): Promise<Page>;
390
- private _closed;
391
- private _client;
392
- private _target;
393
- private _keyboard;
394
- private _mouse;
395
- private _timeoutSettings;
396
- private _touchscreen;
397
- private _accessibility;
398
- private _frameManager;
399
- private _emulationManager;
400
- private _tracing;
401
- private _pageBindings;
402
- private _coverage;
403
- private _javascriptEnabled;
404
- private _viewport;
405
- private _screenshotTaskQueue;
406
- private _workers;
407
- private _fileChooserInterceptors;
408
- private _disconnectPromise?;
409
- private _userDragInterceptionEnabled;
410
- private _handlerMap;
411
- /**
412
- * @internal
413
- */
414
- constructor(client: CDPSession, target: Target, ignoreHTTPSErrors: boolean, screenshotTaskQueue: TaskQueue);
415
- private _initialize;
416
- private _onFileChooser;
417
- /**
418
- * @returns `true` if drag events are being intercepted, `false` otherwise.
419
- */
420
- isDragInterceptionEnabled(): boolean;
421
- /**
422
- * @returns `true` if the page has JavaScript enabled, `false` otherwise.
423
- */
424
- isJavaScriptEnabled(): boolean;
425
- /**
426
- * Listen to page events.
427
- */
428
- on<K extends keyof PageEventObject>(eventName: K, handler: (event: PageEventObject[K]) => void): EventEmitter;
429
- once<K extends keyof PageEventObject>(eventName: K, handler: (event: PageEventObject[K]) => void): EventEmitter;
430
- off<K extends keyof PageEventObject>(eventName: K, handler: (event: PageEventObject[K]) => void): EventEmitter;
431
- /**
432
- * This method is typically coupled with an action that triggers file
433
- * choosing. The following example clicks a button that issues a file chooser
434
- * and then responds with `/tmp/myfile.pdf` as if a user has selected this file.
435
- *
436
- * ```js
437
- * const [fileChooser] = await Promise.all([
438
- * page.waitForFileChooser(),
439
- * page.click('#upload-file-button'),
440
- * // some button that triggers file selection
441
- * ]);
442
- * await fileChooser.accept(['/tmp/myfile.pdf']);
443
- * ```
444
- *
445
- * NOTE: This must be called before the file chooser is launched. It will not
446
- * return a currently active file chooser.
447
- * @param options - Optional waiting parameters
448
- * @returns Resolves after a page requests a file picker.
449
- * @remarks
450
- * NOTE: In non-headless Chromium, this method results in the native file picker
451
- * dialog `not showing up` for the user.
452
- */
453
- waitForFileChooser(options?: WaitTimeoutOptions): Promise<FileChooser>;
454
- /**
455
- * Sets the page's geolocation.
456
- * @remarks
457
- * NOTE: Consider using {@link BrowserContext.overridePermissions} to grant
458
- * permissions for the page to read its geolocation.
459
- * @example
460
- * ```js
461
- * await page.setGeolocation({latitude: 59.95, longitude: 30.31667});
462
- * ```
463
- */
464
- setGeolocation(options: GeolocationOptions): Promise<void>;
465
- /**
466
- * @returns A target this page was created from.
467
- */
468
- target(): Target;
469
- /**
470
- * Get the CDP session client the page belongs to.
471
- * @internal
472
- */
473
- client(): CDPSession;
474
- /**
475
- * Get the browser the page belongs to.
476
- */
477
- browser(): Browser;
478
- /**
479
- * Get the browser context that the page belongs to.
480
- */
481
- browserContext(): BrowserContext;
482
- private _onTargetCrashed;
483
- private _onLogEntryAdded;
484
- /**
485
- * @returns The page's main frame.
486
- * @remarks
487
- * Page is guaranteed to have a main frame which persists during navigations.
488
- */
489
- mainFrame(): Frame;
490
- get keyboard(): Keyboard;
491
- get touchscreen(): Touchscreen;
492
- get coverage(): Coverage;
493
- get tracing(): Tracing;
494
- get accessibility(): Accessibility;
495
- /**
496
- * @returns An array of all frames attached to the page.
497
- */
498
- frames(): Frame[];
499
- /**
500
- * @returns all of the dedicated
501
- * {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API |
502
- * WebWorkers}
503
- * associated with the page.
504
- * @remarks
505
- * NOTE: This does not contain ServiceWorkers
506
- */
507
- workers(): WebWorker[];
508
- /**
509
- * @param value - Whether to enable request interception.
510
- *
511
- * @remarks
512
- * Activating request interception enables {@link HTTPRequest.abort},
513
- * {@link HTTPRequest.continue} and {@link HTTPRequest.respond} methods. This
514
- * provides the capability to modify network requests that are made by a page.
515
- *
516
- * Once request interception is enabled, every request will stall unless it's
517
- * continued, responded or aborted; or completed using the browser cache.
518
- *
519
- * @example
520
- * An example of a naïve request interceptor that aborts all image requests:
521
- * ```js
522
- * const puppeteer = require('puppeteer');
523
- * (async () => {
524
- * const browser = await puppeteer.launch();
525
- * const page = await browser.newPage();
526
- * await page.setRequestInterception(true);
527
- * page.on('request', interceptedRequest => {
528
- * if (interceptedRequest.url().endsWith('.png') ||
529
- * interceptedRequest.url().endsWith('.jpg'))
530
- * interceptedRequest.abort();
531
- * else
532
- * interceptedRequest.continue();
533
- * });
534
- * await page.goto('https://example.com');
535
- * await browser.close();
536
- * })();
537
- * ```
538
- * NOTE: Enabling request interception disables page caching.
539
- */
540
- setRequestInterception(value: boolean): Promise<void>;
541
- /**
542
- * @param enabled - Whether to enable drag interception.
543
- *
544
- * @remarks
545
- * Activating drag interception enables the `Input.drag`,
546
- * methods This provides the capability to capture drag events emitted
547
- * on the page, which can then be used to simulate drag-and-drop.
548
- */
549
- setDragInterception(enabled: boolean): Promise<void>;
550
- /**
551
- * @param enabled - When `true`, enables offline mode for the page.
552
- * @remarks
553
- * NOTE: while this method sets the network connection to offline, it does
554
- * not change the parameters used in [page.emulateNetworkConditions(networkConditions)]
555
- * (#pageemulatenetworkconditionsnetworkconditions)
556
- */
557
- setOfflineMode(enabled: boolean): Promise<void>;
558
- /**
559
- * @param networkConditions - Passing `null` disables network condition emulation.
560
- * @example
561
- * ```js
562
- * const puppeteer = require('puppeteer');
563
- * const slow3G = puppeteer.networkConditions['Slow 3G'];
564
- *
565
- * (async () => {
566
- * const browser = await puppeteer.launch();
567
- * const page = await browser.newPage();
568
- * await page.emulateNetworkConditions(slow3G);
569
- * await page.goto('https://www.google.com');
570
- * // other actions...
571
- * await browser.close();
572
- * })();
573
- * ```
574
- * @remarks
575
- * NOTE: This does not affect WebSockets and WebRTC PeerConnections (see
576
- * https://crbug.com/563644). To set the page offline, you can use
577
- * [page.setOfflineMode(enabled)](#pagesetofflinemodeenabled).
578
- */
579
- emulateNetworkConditions(networkConditions: NetworkConditions | null): Promise<void>;
580
- /**
581
- * This setting will change the default maximum navigation time for the
582
- * following methods and related shortcuts:
583
- *
584
- * - {@link Page.goBack | page.goBack(options)}
585
- *
586
- * - {@link Page.goForward | page.goForward(options)}
587
- *
588
- * - {@link Page.goto | page.goto(url,options)}
589
- *
590
- * - {@link Page.reload | page.reload(options)}
591
- *
592
- * - {@link Page.setContent | page.setContent(html,options)}
593
- *
594
- * - {@link Page.waitForNavigation | page.waitForNavigation(options)}
595
- * @param timeout - Maximum navigation time in milliseconds.
596
- */
597
- setDefaultNavigationTimeout(timeout: number): void;
598
- /**
599
- * @param timeout - Maximum time in milliseconds.
600
- */
601
- setDefaultTimeout(timeout: number): void;
602
- /**
603
- * Runs `document.querySelector` within the page. If no element matches the
604
- * selector, the return value resolves to `null`.
605
- *
606
- * @remarks
607
- * Shortcut for {@link Frame.$ | Page.mainFrame().$(selector) }.
608
- *
609
- * @param selector - A `selector` to query page for
610
- * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | selector}
611
- * to query page for.
612
- */
613
- $<T extends Element = Element>(selector: string): Promise<ElementHandle<T> | null>;
614
- /**
615
- * @remarks
616
- *
617
- * The only difference between {@link Page.evaluate | page.evaluate} and
618
- * `page.evaluateHandle` is that `evaluateHandle` will return the value
619
- * wrapped in an in-page object.
620
- *
621
- * If the function passed to `page.evaluteHandle` returns a Promise, the
622
- * function will wait for the promise to resolve and return its value.
623
- *
624
- * You can pass a string instead of a function (although functions are
625
- * recommended as they are easier to debug and use with TypeScript):
626
- *
627
- * @example
628
- * ```
629
- * const aHandle = await page.evaluateHandle('document')
630
- * ```
631
- *
632
- * @example
633
- * {@link JSHandle} instances can be passed as arguments to the `pageFunction`:
634
- * ```
635
- * const aHandle = await page.evaluateHandle(() => document.body);
636
- * const resultHandle = await page.evaluateHandle(body => body.innerHTML, aHandle);
637
- * console.log(await resultHandle.jsonValue());
638
- * await resultHandle.dispose();
639
- * ```
640
- *
641
- * Most of the time this function returns a {@link JSHandle},
642
- * but if `pageFunction` returns a reference to an element,
643
- * you instead get an {@link ElementHandle} back:
644
- *
645
- * @example
646
- * ```
647
- * const button = await page.evaluateHandle(() => document.querySelector('button'));
648
- * // can call `click` because `button` is an `ElementHandle`
649
- * await button.click();
650
- * ```
651
- *
652
- * The TypeScript definitions assume that `evaluateHandle` returns
653
- * a `JSHandle`, but if you know it's going to return an
654
- * `ElementHandle`, pass it as the generic argument:
655
- *
656
- * ```
657
- * const button = await page.evaluateHandle<ElementHandle>(...);
658
- * ```
659
- *
660
- * @param pageFunction - a function that is run within the page
661
- * @param args - arguments to be passed to the pageFunction
662
- */
663
- evaluateHandle<HandlerType extends JSHandle = JSHandle>(pageFunction: EvaluateHandleFn, ...args: SerializableOrJSHandle[]): Promise<HandlerType>;
664
- /**
665
- * This method iterates the JavaScript heap and finds all objects with the
666
- * given prototype.
667
- *
668
- * @remarks
669
- * Shortcut for
670
- * {@link ExecutionContext.queryObjects |
671
- * page.mainFrame().executionContext().queryObjects(prototypeHandle)}.
672
- *
673
- * @example
674
- *
675
- * ```js
676
- * // Create a Map object
677
- * await page.evaluate(() => window.map = new Map());
678
- * // Get a handle to the Map object prototype
679
- * const mapPrototype = await page.evaluateHandle(() => Map.prototype);
680
- * // Query all map instances into an array
681
- * const mapInstances = await page.queryObjects(mapPrototype);
682
- * // Count amount of map objects in heap
683
- * const count = await page.evaluate(maps => maps.length, mapInstances);
684
- * await mapInstances.dispose();
685
- * await mapPrototype.dispose();
686
- * ```
687
- * @param prototypeHandle - a handle to the object prototype.
688
- * @returns Promise which resolves to a handle to an array of objects with
689
- * this prototype.
690
- */
691
- queryObjects(prototypeHandle: JSHandle): Promise<JSHandle>;
692
- /**
693
- * This method runs `document.querySelector` within the page and passes the
694
- * result as the first argument to the `pageFunction`.
695
- *
696
- * @remarks
697
- *
698
- * If no element is found matching `selector`, the method will throw an error.
699
- *
700
- * If `pageFunction` returns a promise `$eval` will wait for the promise to
701
- * resolve and then return its value.
702
- *
703
- * @example
704
- *
705
- * ```
706
- * const searchValue = await page.$eval('#search', el => el.value);
707
- * const preloadHref = await page.$eval('link[rel=preload]', el => el.href);
708
- * const html = await page.$eval('.main-container', el => el.outerHTML);
709
- * ```
710
- *
711
- * If you are using TypeScript, you may have to provide an explicit type to the
712
- * first argument of the `pageFunction`.
713
- * By default it is typed as `Element`, but you may need to provide a more
714
- * specific sub-type:
715
- *
716
- * @example
717
- *
718
- * ```
719
- * // if you don't provide HTMLInputElement here, TS will error
720
- * // as `value` is not on `Element`
721
- * const searchValue = await page.$eval('#search', (el: HTMLInputElement) => el.value);
722
- * ```
723
- *
724
- * The compiler should be able to infer the return type
725
- * from the `pageFunction` you provide. If it is unable to, you can use the generic
726
- * type to tell the compiler what return type you expect from `$eval`:
727
- *
728
- * @example
729
- *
730
- * ```
731
- * // The compiler can infer the return type in this case, but if it can't
732
- * // or if you want to be more explicit, provide it as the generic type.
733
- * const searchValue = await page.$eval<string>(
734
- * '#search', (el: HTMLInputElement) => el.value
735
- * );
736
- * ```
737
- *
738
- * @param selector - the
739
- * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | selector}
740
- * to query for
741
- * @param pageFunction - the function to be evaluated in the page context.
742
- * Will be passed the result of `document.querySelector(selector)` as its
743
- * first argument.
744
- * @param args - any additional arguments to pass through to `pageFunction`.
745
- *
746
- * @returns The result of calling `pageFunction`. If it returns an element it
747
- * is wrapped in an {@link ElementHandle}, else the raw value itself is
748
- * returned.
749
- */
750
- $eval<ReturnType>(selector: string, pageFunction: (element: Element, ...args: unknown[]) => ReturnType | Promise<ReturnType>, ...args: SerializableOrJSHandle[]): Promise<WrapElementHandle<ReturnType>>;
751
- /**
752
- * This method runs `Array.from(document.querySelectorAll(selector))` within
753
- * the page and passes the result as the first argument to the `pageFunction`.
754
- *
755
- * @remarks
756
- *
757
- * If `pageFunction` returns a promise `$$eval` will wait for the promise to
758
- * resolve and then return its value.
759
- *
760
- * @example
761
- *
762
- * ```
763
- * // get the amount of divs on the page
764
- * const divCount = await page.$$eval('div', divs => divs.length);
765
- *
766
- * // get the text content of all the `.options` elements:
767
- * const options = await page.$$eval('div > span.options', options => {
768
- * return options.map(option => option.textContent)
769
- * });
770
- * ```
771
- *
772
- * If you are using TypeScript, you may have to provide an explicit type to the
773
- * first argument of the `pageFunction`.
774
- * By default it is typed as `Element[]`, but you may need to provide a more
775
- * specific sub-type:
776
- *
777
- * @example
778
- *
779
- * ```
780
- * // if you don't provide HTMLInputElement here, TS will error
781
- * // as `value` is not on `Element`
782
- * await page.$$eval('input', (elements: HTMLInputElement[]) => {
783
- * return elements.map(e => e.value);
784
- * });
785
- * ```
786
- *
787
- * The compiler should be able to infer the return type
788
- * from the `pageFunction` you provide. If it is unable to, you can use the generic
789
- * type to tell the compiler what return type you expect from `$$eval`:
790
- *
791
- * @example
792
- *
793
- * ```
794
- * // The compiler can infer the return type in this case, but if it can't
795
- * // or if you want to be more explicit, provide it as the generic type.
796
- * const allInputValues = await page.$$eval<string[]>(
797
- * 'input', (elements: HTMLInputElement[]) => elements.map(e => e.textContent)
798
- * );
799
- * ```
800
- *
801
- * @param selector - the
802
- * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | selector}
803
- * to query for
804
- * @param pageFunction - the function to be evaluated in the page context. Will
805
- * be passed the result of `Array.from(document.querySelectorAll(selector))`
806
- * as its first argument.
807
- * @param args - any additional arguments to pass through to `pageFunction`.
808
- *
809
- * @returns The result of calling `pageFunction`. If it returns an element it
810
- * is wrapped in an {@link ElementHandle}, else the raw value itself is
811
- * returned.
812
- */
813
- $$eval<ReturnType>(selector: string, pageFunction: (elements: Element[], ...args: unknown[]) => ReturnType | Promise<ReturnType>, ...args: SerializableOrJSHandle[]): Promise<WrapElementHandle<ReturnType>>;
814
- /**
815
- * The method runs `document.querySelectorAll` within the page. If no elements
816
- * match the selector, the return value resolves to `[]`.
817
- * @remarks
818
- * Shortcut for {@link Frame.$$ | Page.mainFrame().$$(selector) }.
819
- * @param selector - A `selector` to query page for
820
- */
821
- $$<T extends Element = Element>(selector: string): Promise<Array<ElementHandle<T>>>;
822
- /**
823
- * The method evaluates the XPath expression relative to the page document as
824
- * its context node. If there are no such elements, the method resolves to an
825
- * empty array.
826
- * @remarks
827
- * Shortcut for {@link Frame.$x | Page.mainFrame().$x(expression) }.
828
- * @param expression - Expression to evaluate
829
- */
830
- $x(expression: string): Promise<ElementHandle[]>;
831
- /**
832
- * If no URLs are specified, this method returns cookies for the current page
833
- * URL. If URLs are specified, only cookies for those URLs are returned.
834
- */
835
- cookies(...urls: string[]): Promise<Protocol.Network.Cookie[]>;
836
- deleteCookie(...cookies: Protocol.Network.DeleteCookiesRequest[]): Promise<void>;
837
- /**
838
- * @example
839
- * ```js
840
- * await page.setCookie(cookieObject1, cookieObject2);
841
- * ```
842
- */
843
- setCookie(...cookies: Protocol.Network.CookieParam[]): Promise<void>;
844
- /**
845
- * Adds a `<script>` tag into the page with the desired URL or content.
846
- * @remarks
847
- * Shortcut for {@link Frame.addScriptTag | page.mainFrame().addScriptTag(options) }.
848
- * @returns Promise which resolves to the added tag when the script's onload fires or
849
- * when the script content was injected into frame.
850
- */
851
- addScriptTag(options: {
852
- url?: string;
853
- path?: string;
854
- content?: string;
855
- type?: string;
856
- id?: string;
857
- }): Promise<ElementHandle>;
858
- /**
859
- * Adds a `<link rel="stylesheet">` tag into the page with the desired URL or a
860
- * `<style type="text/css">` tag with the content.
861
- * @returns Promise which resolves to the added tag when the stylesheet's
862
- * onload fires or when the CSS content was injected into frame.
863
- */
864
- addStyleTag(options: {
865
- url?: string;
866
- path?: string;
867
- content?: string;
868
- }): Promise<ElementHandle>;
869
- /**
870
- * The method adds a function called `name` on the page's `window` object. When
871
- * called, the function executes `puppeteerFunction` in node.js and returns a
872
- * `Promise` which resolves to the return value of `puppeteerFunction`.
873
- *
874
- * If the puppeteerFunction returns a `Promise`, it will be awaited.
875
- *
876
- * NOTE: Functions installed via `page.exposeFunction` survive navigations.
877
- * @param name - Name of the function on the window object
878
- * @param puppeteerFunction - Callback function which will be called in
879
- * Puppeteer's context.
880
- * @example
881
- * An example of adding an `md5` function into the page:
882
- * ```js
883
- * const puppeteer = require('puppeteer');
884
- * const crypto = require('crypto');
885
- *
886
- * (async () => {
887
- * const browser = await puppeteer.launch();
888
- * const page = await browser.newPage();
889
- * page.on('console', (msg) => console.log(msg.text()));
890
- * await page.exposeFunction('md5', (text) =>
891
- * crypto.createHash('md5').update(text).digest('hex')
892
- * );
893
- * await page.evaluate(async () => {
894
- * // use window.md5 to compute hashes
895
- * const myString = 'PUPPETEER';
896
- * const myHash = await window.md5(myString);
897
- * console.log(`md5 of ${myString} is ${myHash}`);
898
- * });
899
- * await browser.close();
900
- * })();
901
- * ```
902
- * An example of adding a `window.readfile` function into the page:
903
- * ```js
904
- * const puppeteer = require('puppeteer');
905
- * const fs = require('fs');
906
- *
907
- * (async () => {
908
- * const browser = await puppeteer.launch();
909
- * const page = await browser.newPage();
910
- * page.on('console', (msg) => console.log(msg.text()));
911
- * await page.exposeFunction('readfile', async (filePath) => {
912
- * return new Promise((resolve, reject) => {
913
- * fs.readFile(filePath, 'utf8', (err, text) => {
914
- * if (err) reject(err);
915
- * else resolve(text);
916
- * });
917
- * });
918
- * });
919
- * await page.evaluate(async () => {
920
- * // use window.readfile to read contents of a file
921
- * const content = await window.readfile('/etc/hosts');
922
- * console.log(content);
923
- * });
924
- * await browser.close();
925
- * })();
926
- * ```
927
- */
928
- exposeFunction(name: string, puppeteerFunction: Function | {
929
- default: Function;
930
- }): Promise<void>;
931
- /**
932
- * Provide credentials for `HTTP authentication`.
933
- * @remarks To disable authentication, pass `null`.
934
- */
935
- authenticate(credentials: Credentials): Promise<void>;
936
- /**
937
- * The extra HTTP headers will be sent with every request the page initiates.
938
- * NOTE: All HTTP header names are lowercased. (HTTP headers are
939
- * case-insensitive, so this shouldn’t impact your server code.)
940
- * NOTE: page.setExtraHTTPHeaders does not guarantee the order of headers in
941
- * the outgoing requests.
942
- * @param headers - An object containing additional HTTP headers to be sent
943
- * with every request. All header values must be strings.
944
- * @returns
945
- */
946
- setExtraHTTPHeaders(headers: Record<string, string>): Promise<void>;
947
- /**
948
- * @param userAgent - Specific user agent to use in this page
949
- * @param userAgentData - Specific user agent client hint data to use in this
950
- * page
951
- * @returns Promise which resolves when the user agent is set.
952
- */
953
- setUserAgent(userAgent: string, userAgentMetadata?: Protocol.Emulation.UserAgentMetadata): Promise<void>;
954
- /**
955
- * @returns Object containing metrics as key/value pairs.
956
- *
957
- * - `Timestamp` : The timestamp when the metrics sample was taken.
958
- *
959
- * - `Documents` : Number of documents in the page.
960
- *
961
- * - `Frames` : Number of frames in the page.
962
- *
963
- * - `JSEventListeners` : Number of events in the page.
964
- *
965
- * - `Nodes` : Number of DOM nodes in the page.
966
- *
967
- * - `LayoutCount` : Total number of full or partial page layout.
968
- *
969
- * - `RecalcStyleCount` : Total number of page style recalculations.
970
- *
971
- * - `LayoutDuration` : Combined durations of all page layouts.
972
- *
973
- * - `RecalcStyleDuration` : Combined duration of all page style
974
- * recalculations.
975
- *
976
- * - `ScriptDuration` : Combined duration of JavaScript execution.
977
- *
978
- * - `TaskDuration` : Combined duration of all tasks performed by the browser.
979
- *
980
- *
981
- * - `JSHeapUsedSize` : Used JavaScript heap size.
982
- *
983
- * - `JSHeapTotalSize` : Total JavaScript heap size.
984
- * @remarks
985
- * NOTE: All timestamps are in monotonic time: monotonically increasing time
986
- * in seconds since an arbitrary point in the past.
987
- */
988
- metrics(): Promise<Metrics>;
989
- private _emitMetrics;
990
- private _buildMetricsObject;
991
- private _handleException;
992
- private _onConsoleAPI;
993
- private _onBindingCalled;
994
- private _addConsoleMessage;
995
- private _onDialog;
996
- /**
997
- * Resets default white background
998
- */
999
- private _resetDefaultBackgroundColor;
1000
- /**
1001
- * Hides default white background
1002
- */
1003
- private _setTransparentBackgroundColor;
1004
- /**
1005
- *
1006
- * @returns
1007
- * @remarks Shortcut for
1008
- * {@link Frame.url | page.mainFrame().url()}.
1009
- */
1010
- url(): string;
1011
- content(): Promise<string>;
1012
- /**
1013
- * @param html - HTML markup to assign to the page.
1014
- * @param options - Parameters that has some properties.
1015
- * @remarks
1016
- * The parameter `options` might have the following options.
1017
- *
1018
- * - `timeout` : Maximum time in milliseconds for resources to load, defaults
1019
- * to 30 seconds, pass `0` to disable timeout. The default value can be
1020
- * changed by using the
1021
- * {@link Page.setDefaultNavigationTimeout |
1022
- * page.setDefaultNavigationTimeout(timeout)}
1023
- * or {@link Page.setDefaultTimeout | page.setDefaultTimeout(timeout)}
1024
- * methods.
1025
- *
1026
- * - `waitUntil`: When to consider setting markup succeeded, defaults to `load`.
1027
- * Given an array of event strings, setting content is considered to be
1028
- * successful after all events have been fired. Events can be either:<br/>
1029
- * - `load` : consider setting content to be finished when the `load` event is
1030
- * fired.<br/>
1031
- * - `domcontentloaded` : consider setting content to be finished when the
1032
- * `DOMContentLoaded` event is fired.<br/>
1033
- * - `networkidle0` : consider setting content to be finished when there are no
1034
- * more than 0 network connections for at least `500` ms.<br/>
1035
- * - `networkidle2` : consider setting content to be finished when there are no
1036
- * more than 2 network connections for at least `500` ms.
1037
- */
1038
- setContent(html: string, options?: WaitForOptions): Promise<void>;
1039
- /**
1040
- * @param url - URL to navigate page to. The URL should include scheme, e.g.
1041
- * `https://`
1042
- * @param options - Navigation Parameter
1043
- * @returns Promise which resolves to the main resource response. In case of
1044
- * multiple redirects, the navigation will resolve with the response of the
1045
- * last redirect.
1046
- * @remarks
1047
- * The argument `options` might have the following properties:
1048
- *
1049
- * - `timeout` : Maximum navigation time in milliseconds, defaults to 30
1050
- * seconds, pass 0 to disable timeout. The default value can be changed by
1051
- * using the
1052
- * {@link Page.setDefaultNavigationTimeout |
1053
- * page.setDefaultNavigationTimeout(timeout)}
1054
- * or {@link Page.setDefaultTimeout | page.setDefaultTimeout(timeout)}
1055
- * methods.
1056
- *
1057
- * - `waitUntil`:When to consider navigation succeeded, defaults to `load`.
1058
- * Given an array of event strings, navigation is considered to be successful
1059
- * after all events have been fired. Events can be either:<br/>
1060
- * - `load` : consider navigation to be finished when the load event is
1061
- * fired.<br/>
1062
- * - `domcontentloaded` : consider navigation to be finished when the
1063
- * DOMContentLoaded event is fired.<br/>
1064
- * - `networkidle0` : consider navigation to be finished when there are no
1065
- * more than 0 network connections for at least `500` ms.<br/>
1066
- * - `networkidle2` : consider navigation to be finished when there are no
1067
- * more than 2 network connections for at least `500` ms.
1068
- *
1069
- * - `referer` : Referer header value. If provided it will take preference
1070
- * over the referer header value set by
1071
- * {@link Page.setExtraHTTPHeaders |page.setExtraHTTPHeaders()}.
1072
- *
1073
- * `page.goto` will throw an error if:
1074
- * - there's an SSL error (e.g. in case of self-signed certificates).
1075
- * - target URL is invalid.
1076
- * - the timeout is exceeded during navigation.
1077
- * - the remote server does not respond or is unreachable.
1078
- * - the main resource failed to load.
1079
- *
1080
- * `page.goto` will not throw an error when any valid HTTP status code is
1081
- * returned by the remote server, including 404 "Not Found" and 500
1082
- * "Internal Server Error". The status code for such responses can be
1083
- * retrieved by calling response.status().
1084
- *
1085
- * NOTE: `page.goto` either throws an error or returns a main resource
1086
- * response. The only exceptions are navigation to about:blank or navigation
1087
- * to the same URL with a different hash, which would succeed and return null.
1088
- *
1089
- * NOTE: Headless mode doesn't support navigation to a PDF document. See the
1090
- * {@link https://bugs.chromium.org/p/chromium/issues/detail?id=761295
1091
- * | upstream issue}.
1092
- *
1093
- * Shortcut for {@link Frame.goto | page.mainFrame().goto(url, options)}.
1094
- */
1095
- goto(url: string, options?: WaitForOptions & {
1096
- referer?: string;
1097
- }): Promise<HTTPResponse>;
1098
- /**
1099
- * @param options - Navigation parameters which might have the following
1100
- * properties:
1101
- * @returns Promise which resolves to the main resource response. In case of
1102
- * multiple redirects, the navigation will resolve with the response of the
1103
- * last redirect.
1104
- * @remarks
1105
- * The argument `options` might have the following properties:
1106
- *
1107
- * - `timeout` : Maximum navigation time in milliseconds, defaults to 30
1108
- * seconds, pass 0 to disable timeout. The default value can be changed by
1109
- * using the
1110
- * {@link Page.setDefaultNavigationTimeout |
1111
- * page.setDefaultNavigationTimeout(timeout)}
1112
- * or {@link Page.setDefaultTimeout | page.setDefaultTimeout(timeout)}
1113
- * methods.
1114
- *
1115
- * - `waitUntil`: When to consider navigation succeeded, defaults to `load`.
1116
- * Given an array of event strings, navigation is considered to be
1117
- * successful after all events have been fired. Events can be either:<br/>
1118
- * - `load` : consider navigation to be finished when the load event is 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
- reload(options?: WaitForOptions): Promise<HTTPResponse | null>;
1127
- /**
1128
- * This resolves when the page navigates to a new URL or reloads. It is useful
1129
- * when you run code that will indirectly cause the page to navigate. Consider
1130
- * this example:
1131
- * ```js
1132
- * const [response] = await Promise.all([
1133
- * page.waitForNavigation(), // The promise resolves after navigation has finished
1134
- * page.click('a.my-link'), // Clicking the link will indirectly cause a navigation
1135
- * ]);
1136
- * ```
1137
- *
1138
- * @param options - Navigation parameters which might have the following properties:
1139
- * @returns Promise which resolves to the main resource response. In case of
1140
- * multiple redirects, the navigation will resolve with the response of the
1141
- * last redirect. In case of navigation to a different anchor or navigation
1142
- * due to History API usage, the navigation will resolve with `null`.
1143
- * @remarks
1144
- * NOTE: Usage of the
1145
- * {@link https://developer.mozilla.org/en-US/docs/Web/API/History_API | History API}
1146
- * to change the URL is considered a navigation.
1147
- *
1148
- * Shortcut for
1149
- * {@link Frame.waitForNavigation | page.mainFrame().waitForNavigation(options)}.
1150
- */
1151
- waitForNavigation(options?: WaitForOptions): Promise<HTTPResponse | null>;
1152
- private _sessionClosePromise;
1153
- /**
1154
- * @param urlOrPredicate - A URL or predicate to wait for
1155
- * @param options - Optional waiting parameters
1156
- * @returns Promise which resolves to the matched response
1157
- * @example
1158
- * ```js
1159
- * const firstResponse = await page.waitForResponse(
1160
- * 'https://example.com/resource'
1161
- * );
1162
- * const finalResponse = await page.waitForResponse(
1163
- * (response) =>
1164
- * response.url() === 'https://example.com' && response.status() === 200
1165
- * );
1166
- * const finalResponse = await page.waitForResponse(async (response) => {
1167
- * return (await response.text()).includes('<html>');
1168
- * });
1169
- * return finalResponse.ok();
1170
- * ```
1171
- * @remarks
1172
- * Optional Waiting Parameters have:
1173
- *
1174
- * - `timeout`: Maximum wait time in milliseconds, defaults to `30` seconds, pass
1175
- * `0` to disable the timeout. The default value can be changed by using the
1176
- * {@link Page.setDefaultTimeout} method.
1177
- */
1178
- waitForRequest(urlOrPredicate: string | ((req: HTTPRequest) => boolean | Promise<boolean>), options?: {
1179
- timeout?: number;
1180
- }): Promise<HTTPRequest>;
1181
- /**
1182
- * @param urlOrPredicate - A URL or predicate to wait for.
1183
- * @param options - Optional waiting parameters
1184
- * @returns Promise which resolves to the matched response.
1185
- * @example
1186
- * ```js
1187
- * const firstResponse = await page.waitForResponse(
1188
- * 'https://example.com/resource'
1189
- * );
1190
- * const finalResponse = await page.waitForResponse(
1191
- * (response) =>
1192
- * response.url() === 'https://example.com' && response.status() === 200
1193
- * );
1194
- * const finalResponse = await page.waitForResponse(async (response) => {
1195
- * return (await response.text()).includes('<html>');
1196
- * });
1197
- * return finalResponse.ok();
1198
- * ```
1199
- * @remarks
1200
- * Optional Parameter have:
1201
- *
1202
- * - `timeout`: Maximum wait time in milliseconds, defaults to `30` seconds,
1203
- * pass `0` to disable the timeout. The default value can be changed by using
1204
- * the {@link Page.setDefaultTimeout} method.
1205
- */
1206
- waitForResponse(urlOrPredicate: string | ((res: HTTPResponse) => boolean | Promise<boolean>), options?: {
1207
- timeout?: number;
1208
- }): Promise<HTTPResponse>;
1209
- /**
1210
- * @param options - Optional waiting parameters
1211
- * @returns Promise which resolves when network is idle
1212
- */
1213
- waitForNetworkIdle(options?: {
1214
- idleTime?: number;
1215
- timeout?: number;
1216
- }): Promise<void>;
1217
- /**
1218
- * @param urlOrPredicate - A URL or predicate to wait for.
1219
- * @param options - Optional waiting parameters
1220
- * @returns Promise which resolves to the matched frame.
1221
- * @example
1222
- * ```js
1223
- * const frame = await page.waitForFrame(async (frame) => {
1224
- * return frame.name() === 'Test';
1225
- * });
1226
- * ```
1227
- * @remarks
1228
- * Optional Parameter have:
1229
- *
1230
- * - `timeout`: Maximum wait time in milliseconds, defaults to `30` seconds,
1231
- * pass `0` to disable the timeout. The default value can be changed by using
1232
- * the {@link Page.setDefaultTimeout} method.
1233
- */
1234
- waitForFrame(urlOrPredicate: string | ((frame: Frame) => boolean | Promise<boolean>), options?: {
1235
- timeout?: number;
1236
- }): Promise<Frame>;
1237
- /**
1238
- * This method navigate to the previous page in history.
1239
- * @param options - Navigation parameters
1240
- * @returns Promise which resolves to the main resource response. In case of
1241
- * multiple redirects, the navigation will resolve with the response of the
1242
- * last redirect. If can not go back, resolves to `null`.
1243
- * @remarks
1244
- * The argument `options` might have the following properties:
1245
- *
1246
- * - `timeout` : Maximum navigation time in milliseconds, defaults to 30
1247
- * seconds, pass 0 to disable timeout. The default value can be changed by
1248
- * using the
1249
- * {@link Page.setDefaultNavigationTimeout
1250
- * | page.setDefaultNavigationTimeout(timeout)}
1251
- * or {@link Page.setDefaultTimeout | page.setDefaultTimeout(timeout)}
1252
- * methods.
1253
- *
1254
- * - `waitUntil` : When to consider navigation succeeded, defaults to `load`.
1255
- * Given an array of event strings, navigation is considered to be
1256
- * successful after all events have been fired. Events can be either:<br/>
1257
- * - `load` : consider navigation to be finished when the load event is fired.<br/>
1258
- * - `domcontentloaded` : consider navigation to be finished when the
1259
- * DOMContentLoaded event is fired.<br/>
1260
- * - `networkidle0` : consider navigation to be finished when there are no
1261
- * more than 0 network connections for at least `500` ms.<br/>
1262
- * - `networkidle2` : consider navigation to be finished when there are no
1263
- * more than 2 network connections for at least `500` ms.
1264
- */
1265
- goBack(options?: WaitForOptions): Promise<HTTPResponse | null>;
1266
- /**
1267
- * This method navigate to the next page in history.
1268
- * @param options - Navigation Parameter
1269
- * @returns Promise which resolves to the main resource response. In case of
1270
- * multiple redirects, the navigation will resolve with the response of the
1271
- * last redirect. If can not go forward, resolves to `null`.
1272
- * @remarks
1273
- * The argument `options` might have the following properties:
1274
- *
1275
- * - `timeout` : Maximum navigation time in milliseconds, defaults to 30
1276
- * seconds, pass 0 to disable timeout. The default value can be changed by
1277
- * using the
1278
- * {@link Page.setDefaultNavigationTimeout
1279
- * | page.setDefaultNavigationTimeout(timeout)}
1280
- * or {@link Page.setDefaultTimeout | page.setDefaultTimeout(timeout)}
1281
- * methods.
1282
- *
1283
- * - `waitUntil`: When to consider navigation succeeded, defaults to `load`.
1284
- * Given an array of event strings, navigation is considered to be
1285
- * successful after all events have been fired. Events can be either:<br/>
1286
- * - `load` : consider navigation to be finished when the load event is fired.<br/>
1287
- * - `domcontentloaded` : consider navigation to be finished when the
1288
- * DOMContentLoaded event is fired.<br/>
1289
- * - `networkidle0` : consider navigation to be finished when there are no
1290
- * more than 0 network connections for at least `500` ms.<br/>
1291
- * - `networkidle2` : consider navigation to be finished when there are no
1292
- * more than 2 network connections for at least `500` ms.
1293
- */
1294
- goForward(options?: WaitForOptions): Promise<HTTPResponse | null>;
1295
- private _go;
1296
- /**
1297
- * Brings page to front (activates tab).
1298
- */
1299
- bringToFront(): Promise<void>;
1300
- /**
1301
- * Emulates given device metrics and user agent. This method is a shortcut for
1302
- * calling two methods: {@link Page.setUserAgent} and {@link Page.setViewport}
1303
- * To aid emulation, Puppeteer provides a list of device descriptors that can
1304
- * be obtained via the {@link Puppeteer.devices} `page.emulate` will resize
1305
- * the page. A lot of websites don't expect phones to change size, so you
1306
- * should emulate before navigating to the page.
1307
- * @example
1308
- * ```js
1309
- * const puppeteer = require('puppeteer');
1310
- * const iPhone = puppeteer.devices['iPhone 6'];
1311
- * (async () => {
1312
- * const browser = await puppeteer.launch();
1313
- * const page = await browser.newPage();
1314
- * await page.emulate(iPhone);
1315
- * await page.goto('https://www.google.com');
1316
- * // other actions...
1317
- * await browser.close();
1318
- * })();
1319
- * ```
1320
- * @remarks List of all available devices is available in the source code:
1321
- * {@link https://github.com/puppeteer/puppeteer/blob/main/src/common/DeviceDescriptors.ts | src/common/DeviceDescriptors.ts}.
1322
- */
1323
- emulate(options: {
1324
- viewport: Viewport;
1325
- userAgent: string;
1326
- }): Promise<void>;
1327
- /**
1328
- * @param enabled - Whether or not to enable JavaScript on the page.
1329
- * @returns
1330
- * @remarks
1331
- * NOTE: changing this value won't affect scripts that have already been run.
1332
- * It will take full effect on the next navigation.
1333
- */
1334
- setJavaScriptEnabled(enabled: boolean): Promise<void>;
1335
- /**
1336
- * Toggles bypassing page's Content-Security-Policy.
1337
- * @param enabled - sets bypassing of page's Content-Security-Policy.
1338
- * @remarks
1339
- * NOTE: CSP bypassing happens at the moment of CSP initialization rather than
1340
- * evaluation. Usually, this means that `page.setBypassCSP` should be called
1341
- * before navigating to the domain.
1342
- */
1343
- setBypassCSP(enabled: boolean): Promise<void>;
1344
- /**
1345
- * @param type - Changes the CSS media type of the page. The only allowed
1346
- * values are `screen`, `print` and `null`. Passing `null` disables CSS media
1347
- * emulation.
1348
- * @example
1349
- * ```
1350
- * await page.evaluate(() => matchMedia('screen').matches);
1351
- * // → true
1352
- * await page.evaluate(() => matchMedia('print').matches);
1353
- * // → false
1354
- *
1355
- * await page.emulateMediaType('print');
1356
- * await page.evaluate(() => matchMedia('screen').matches);
1357
- * // → false
1358
- * await page.evaluate(() => matchMedia('print').matches);
1359
- * // → true
1360
- *
1361
- * await page.emulateMediaType(null);
1362
- * await page.evaluate(() => matchMedia('screen').matches);
1363
- * // → true
1364
- * await page.evaluate(() => matchMedia('print').matches);
1365
- * // → false
1366
- * ```
1367
- */
1368
- emulateMediaType(type?: string): Promise<void>;
1369
- /**
1370
- * Enables CPU throttling to emulate slow CPUs.
1371
- * @param factor - slowdown factor (1 is no throttle, 2 is 2x slowdown, etc).
1372
- */
1373
- emulateCPUThrottling(factor: number | null): Promise<void>;
1374
- /**
1375
- * @param features - `<?Array<Object>>` Given an array of media feature
1376
- * objects, emulates CSS media features on the page. Each media feature object
1377
- * must have the following properties:
1378
- * @example
1379
- * ```js
1380
- * await page.emulateMediaFeatures([
1381
- * { name: 'prefers-color-scheme', value: 'dark' },
1382
- * ]);
1383
- * await page.evaluate(() => matchMedia('(prefers-color-scheme: dark)').matches);
1384
- * // → true
1385
- * await page.evaluate(() => matchMedia('(prefers-color-scheme: light)').matches);
1386
- * // → false
1387
- *
1388
- * await page.emulateMediaFeatures([
1389
- * { name: 'prefers-reduced-motion', value: 'reduce' },
1390
- * ]);
1391
- * await page.evaluate(
1392
- * () => matchMedia('(prefers-reduced-motion: reduce)').matches
1393
- * );
1394
- * // → true
1395
- * await page.evaluate(
1396
- * () => matchMedia('(prefers-reduced-motion: no-preference)').matches
1397
- * );
1398
- * // → false
1399
- *
1400
- * await page.emulateMediaFeatures([
1401
- * { name: 'prefers-color-scheme', value: 'dark' },
1402
- * { name: 'prefers-reduced-motion', value: 'reduce' },
1403
- * ]);
1404
- * await page.evaluate(() => matchMedia('(prefers-color-scheme: dark)').matches);
1405
- * // → true
1406
- * await page.evaluate(() => matchMedia('(prefers-color-scheme: light)').matches);
1407
- * // → false
1408
- * await page.evaluate(
1409
- * () => matchMedia('(prefers-reduced-motion: reduce)').matches
1410
- * );
1411
- * // → true
1412
- * await page.evaluate(
1413
- * () => matchMedia('(prefers-reduced-motion: no-preference)').matches
1414
- * );
1415
- * // → false
1416
- *
1417
- * await page.emulateMediaFeatures([{ name: 'color-gamut', value: 'p3' }]);
1418
- * await page.evaluate(() => matchMedia('(color-gamut: srgb)').matches);
1419
- * // → true
1420
- * await page.evaluate(() => matchMedia('(color-gamut: p3)').matches);
1421
- * // → true
1422
- * await page.evaluate(() => matchMedia('(color-gamut: rec2020)').matches);
1423
- * // → false
1424
- * ```
1425
- */
1426
- emulateMediaFeatures(features?: MediaFeature[]): Promise<void>;
1427
- /**
1428
- * @param timezoneId - Changes the timezone of the page. See
1429
- * {@link https://source.chromium.org/chromium/chromium/deps/icu.git/+/faee8bc70570192d82d2978a71e2a615788597d1:source/data/misc/metaZones.txt | ICU’s metaZones.txt}
1430
- * for a list of supported timezone IDs. Passing
1431
- * `null` disables timezone emulation.
1432
- */
1433
- emulateTimezone(timezoneId?: string): Promise<void>;
1434
- /**
1435
- * Emulates the idle state.
1436
- * If no arguments set, clears idle state emulation.
1437
- *
1438
- * @example
1439
- * ```js
1440
- * // set idle emulation
1441
- * await page.emulateIdleState({isUserActive: true, isScreenUnlocked: false});
1442
- *
1443
- * // do some checks here
1444
- * ...
1445
- *
1446
- * // clear idle emulation
1447
- * await page.emulateIdleState();
1448
- * ```
1449
- *
1450
- * @param overrides - Mock idle state. If not set, clears idle overrides
1451
- */
1452
- emulateIdleState(overrides?: {
1453
- isUserActive: boolean;
1454
- isScreenUnlocked: boolean;
1455
- }): Promise<void>;
1456
- /**
1457
- * Simulates the given vision deficiency on the page.
1458
- *
1459
- * @example
1460
- * ```js
1461
- * const puppeteer = require('puppeteer');
1462
- *
1463
- * (async () => {
1464
- * const browser = await puppeteer.launch();
1465
- * const page = await browser.newPage();
1466
- * await page.goto('https://v8.dev/blog/10-years');
1467
- *
1468
- * await page.emulateVisionDeficiency('achromatopsia');
1469
- * await page.screenshot({ path: 'achromatopsia.png' });
1470
- *
1471
- * await page.emulateVisionDeficiency('deuteranopia');
1472
- * await page.screenshot({ path: 'deuteranopia.png' });
1473
- *
1474
- * await page.emulateVisionDeficiency('blurredVision');
1475
- * await page.screenshot({ path: 'blurred-vision.png' });
1476
- *
1477
- * await browser.close();
1478
- * })();
1479
- * ```
1480
- *
1481
- * @param type - the type of deficiency to simulate, or `'none'` to reset.
1482
- */
1483
- emulateVisionDeficiency(type?: Protocol.Emulation.SetEmulatedVisionDeficiencyRequest['type']): Promise<void>;
1484
- /**
1485
- * `page.setViewport` will resize the page. A lot of websites don't expect
1486
- * phones to change size, so you should set the viewport before navigating to
1487
- * the page.
1488
- *
1489
- * In the case of multiple pages in a single browser, each page can have its
1490
- * own viewport size.
1491
- * @example
1492
- * ```js
1493
- * const page = await browser.newPage();
1494
- * await page.setViewport({
1495
- * width: 640,
1496
- * height: 480,
1497
- * deviceScaleFactor: 1,
1498
- * });
1499
- * await page.goto('https://example.com');
1500
- * ```
1501
- *
1502
- * @param viewport -
1503
- * @remarks
1504
- * Argument viewport have following properties:
1505
- *
1506
- * - `width`: page width in pixels. required
1507
- *
1508
- * - `height`: page height in pixels. required
1509
- *
1510
- * - `deviceScaleFactor`: Specify device scale factor (can be thought of as
1511
- * DPR). Defaults to `1`.
1512
- *
1513
- * - `isMobile`: Whether the meta viewport tag is taken into account. Defaults
1514
- * to `false`.
1515
- *
1516
- * - `hasTouch`: Specifies if viewport supports touch events. Defaults to `false`
1517
- *
1518
- * - `isLandScape`: Specifies if viewport is in landscape mode. Defaults to false.
1519
- *
1520
- * NOTE: in certain cases, setting viewport will reload the page in order to
1521
- * set the isMobile or hasTouch properties.
1522
- */
1523
- setViewport(viewport: Viewport): Promise<void>;
1524
- /**
1525
- * @returns
1526
- *
1527
- * - `width`: page's width in pixels
1528
- *
1529
- * - `height`: page's height in pixels
1530
- *
1531
- * - `deviceScalarFactor`: Specify device scale factor (can be though of as
1532
- * dpr). Defaults to `1`.
1533
- *
1534
- * - `isMobile`: Whether the meta viewport tag is taken into account. Defaults
1535
- * to `false`.
1536
- *
1537
- * - `hasTouch`: Specifies if viewport supports touch events. Defaults to
1538
- * `false`.
1539
- *
1540
- * - `isLandScape`: Specifies if viewport is in landscape mode. Defaults to
1541
- * `false`.
1542
- */
1543
- viewport(): Viewport | null;
1544
- /**
1545
- * @remarks
1546
- *
1547
- * Evaluates a function in the page's context and returns the result.
1548
- *
1549
- * If the function passed to `page.evaluteHandle` returns a Promise, the
1550
- * function will wait for the promise to resolve and return its value.
1551
- *
1552
- * @example
1553
- *
1554
- * ```js
1555
- * const result = await frame.evaluate(() => {
1556
- * return Promise.resolve(8 * 7);
1557
- * });
1558
- * console.log(result); // prints "56"
1559
- * ```
1560
- *
1561
- * You can pass a string instead of a function (although functions are
1562
- * recommended as they are easier to debug and use with TypeScript):
1563
- *
1564
- * @example
1565
- * ```
1566
- * const aHandle = await page.evaluate('1 + 2');
1567
- * ```
1568
- *
1569
- * To get the best TypeScript experience, you should pass in as the
1570
- * generic the type of `pageFunction`:
1571
- *
1572
- * ```
1573
- * const aHandle = await page.evaluate<() => number>(() => 2);
1574
- * ```
1575
- *
1576
- * @example
1577
- *
1578
- * {@link ElementHandle} instances (including {@link JSHandle}s) can be passed
1579
- * as arguments to the `pageFunction`:
1580
- *
1581
- * ```
1582
- * const bodyHandle = await page.$('body');
1583
- * const html = await page.evaluate(body => body.innerHTML, bodyHandle);
1584
- * await bodyHandle.dispose();
1585
- * ```
1586
- *
1587
- * @param pageFunction - a function that is run within the page
1588
- * @param args - arguments to be passed to the pageFunction
1589
- *
1590
- * @returns the return value of `pageFunction`.
1591
- */
1592
- evaluate<T extends EvaluateFn>(pageFunction: T, ...args: SerializableOrJSHandle[]): Promise<UnwrapPromiseLike<EvaluateFnReturnType<T>>>;
1593
- /**
1594
- * Adds a function which would be invoked in one of the following scenarios:
1595
- *
1596
- * - whenever the page is navigated
1597
- *
1598
- * - whenever the child frame is attached or navigated. In this case, the
1599
- * function is invoked in the context of the newly attached frame.
1600
- *
1601
- * The function is invoked after the document was created but before any of
1602
- * its scripts were run. This is useful to amend the JavaScript environment,
1603
- * e.g. to seed `Math.random`.
1604
- * @param pageFunction - Function to be evaluated in browser context
1605
- * @param args - Arguments to pass to `pageFunction`
1606
- * @example
1607
- * An example of overriding the navigator.languages property before the page loads:
1608
- * ```js
1609
- * // preload.js
1610
- *
1611
- * // overwrite the `languages` property to use a custom getter
1612
- * Object.defineProperty(navigator, 'languages', {
1613
- * get: function () {
1614
- * return ['en-US', 'en', 'bn'];
1615
- * },
1616
- * });
1617
- *
1618
- * // In your puppeteer script, assuming the preload.js file is
1619
- * in same folder of our script
1620
- * const preloadFile = fs.readFileSync('./preload.js', 'utf8');
1621
- * await page.evaluateOnNewDocument(preloadFile);
1622
- * ```
1623
- */
1624
- evaluateOnNewDocument(pageFunction: Function | string, ...args: unknown[]): Promise<void>;
1625
- /**
1626
- * Toggles ignoring cache for each request based on the enabled state. By
1627
- * default, caching is enabled.
1628
- * @param enabled - sets the `enabled` state of cache
1629
- */
1630
- setCacheEnabled(enabled?: boolean): Promise<void>;
1631
- /**
1632
- * @remarks
1633
- * Options object which might have the following properties:
1634
- *
1635
- * - `path` : The file path to save the image to. The screenshot type
1636
- * will be inferred from file extension. If `path` is a relative path, then
1637
- * it is resolved relative to
1638
- * {@link https://nodejs.org/api/process.html#process_process_cwd
1639
- * | current working directory}.
1640
- * If no path is provided, the image won't be saved to the disk.
1641
- *
1642
- * - `type` : Specify screenshot type, can be either `jpeg` or `png`.
1643
- * Defaults to 'png'.
1644
- *
1645
- * - `quality` : The quality of the image, between 0-100. Not
1646
- * applicable to `png` images.
1647
- *
1648
- * - `fullPage` : When true, takes a screenshot of the full
1649
- * scrollable page. Defaults to `false`
1650
- *
1651
- * - `clip` : An object which specifies clipping region of the page.
1652
- * Should have the following fields:<br/>
1653
- * - `x` : x-coordinate of top-left corner of clip area.<br/>
1654
- * - `y` : y-coordinate of top-left corner of clip area.<br/>
1655
- * - `width` : width of clipping area.<br/>
1656
- * - `height` : height of clipping area.
1657
- *
1658
- * - `omitBackground` : Hides default white background and allows
1659
- * capturing screenshots with transparency. Defaults to `false`
1660
- *
1661
- * - `encoding` : The encoding of the image, can be either base64 or
1662
- * binary. Defaults to `binary`.
1663
- *
1664
- *
1665
- * NOTE: Screenshots take at least 1/6 second on OS X. See
1666
- * {@link https://crbug.com/741689} for discussion.
1667
- * @returns Promise which resolves to buffer or a base64 string (depending on
1668
- * the value of `encoding`) with captured screenshot.
1669
- */
1670
- screenshot(options?: ScreenshotOptions): Promise<Buffer | string>;
1671
- private _screenshotTask;
1672
- /**
1673
- * Generatees a PDF of the page with the `print` CSS media type.
1674
- * @remarks
1675
- *
1676
- * NOTE: PDF generation is only supported in Chrome headless mode.
1677
- *
1678
- * To generate a PDF with the `screen` media type, call
1679
- * {@link Page.emulateMediaType | `page.emulateMediaType('screen')`} before
1680
- * calling `page.pdf()`.
1681
- *
1682
- * By default, `page.pdf()` generates a pdf with modified colors for printing.
1683
- * Use the
1684
- * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-print-color-adjust | `-webkit-print-color-adjust`}
1685
- * property to force rendering of exact colors.
1686
- *
1687
- *
1688
- * @param options - options for generating the PDF.
1689
- */
1690
- createPDFStream(options?: PDFOptions): Promise<Readable>;
1691
- /**
1692
- * @param options -
1693
- * @returns
1694
- */
1695
- pdf(options?: PDFOptions): Promise<Buffer>;
1696
- /**
1697
- * @returns The page's title
1698
- * @remarks
1699
- * Shortcut for {@link Frame.title | page.mainFrame().title()}.
1700
- */
1701
- title(): Promise<string>;
1702
- close(options?: {
1703
- runBeforeUnload?: boolean;
1704
- }): Promise<void>;
1705
- /**
1706
- * Indicates that the page has been closed.
1707
- * @returns
1708
- */
1709
- isClosed(): boolean;
1710
- get mouse(): Mouse;
1711
- /**
1712
- * This method fetches an element with `selector`, scrolls it into view if
1713
- * needed, and then uses {@link Page.mouse} to click in the center of the
1714
- * element. If there's no element matching `selector`, the method throws an
1715
- * error.
1716
- * @remarks Bear in mind that if `click()` triggers a navigation event and
1717
- * there's a separate `page.waitForNavigation()` promise to be resolved, you
1718
- * may end up with a race condition that yields unexpected results. The
1719
- * correct pattern for click and wait for navigation is the following:
1720
- * ```js
1721
- * const [response] = await Promise.all([
1722
- * page.waitForNavigation(waitOptions),
1723
- * page.click(selector, clickOptions),
1724
- * ]);
1725
- * ```
1726
- * Shortcut for {@link Frame.click | page.mainFrame().click(selector[, options]) }.
1727
- * @param selector - A `selector` to search for element to click. If there are
1728
- * multiple elements satisfying the `selector`, the first will be clicked
1729
- * @param options - `Object`
1730
- * @returns Promise which resolves when the element matching `selector` is
1731
- * successfully clicked. The Promise will be rejected if there is no element
1732
- * matching `selector`.
1733
- */
1734
- click(selector: string, options?: {
1735
- delay?: number;
1736
- button?: MouseButton;
1737
- clickCount?: number;
1738
- }): Promise<void>;
1739
- /**
1740
- * This method fetches an element with `selector` and focuses it. If there's no
1741
- * element matching `selector`, the method throws an error.
1742
- * @param selector - A
1743
- * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | selector }
1744
- * of an element to focus. If there are multiple elements satisfying the
1745
- * selector, the first will be focused.
1746
- * @returns Promise which resolves when the element matching selector is
1747
- * successfully focused. The promise will be rejected if there is no element
1748
- * matching selector.
1749
- * @remarks
1750
- * Shortcut for {@link Frame.focus | page.mainFrame().focus(selector)}.
1751
- */
1752
- focus(selector: string): Promise<void>;
1753
- /**
1754
- * This method fetches an element with `selector`, scrolls it into view if
1755
- * needed, and then uses {@link Page.mouse} to hover over the center of the element.
1756
- * If there's no element matching `selector`, the method throws an error.
1757
- * @param selector - A
1758
- * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | selector}
1759
- * to search for element to hover. If there are multiple elements satisfying
1760
- * the selector, the first will be hovered.
1761
- * @returns Promise which resolves when the element matching `selector` is
1762
- * successfully hovered. Promise gets rejected if there's no element matching
1763
- * `selector`.
1764
- * @remarks
1765
- * Shortcut for {@link Page.hover | page.mainFrame().hover(selector)}.
1766
- */
1767
- hover(selector: string): Promise<void>;
1768
- /**
1769
- * Triggers a `change` and `input` event once all the provided options have been
1770
- * selected. If there's no `<select>` element matching `selector`, the method
1771
- * throws an error.
1772
- *
1773
- * @example
1774
- * ```js
1775
- * page.select('select#colors', 'blue'); // single selection
1776
- * page.select('select#colors', 'red', 'green', 'blue'); // multiple selections
1777
- * ```
1778
- * @param selector - A
1779
- * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | Selector}
1780
- * to query the page for
1781
- * @param values - Values of options to select. If the `<select>` has the
1782
- * `multiple` attribute, all values are considered, otherwise only the first one
1783
- * is taken into account.
1784
- * @returns
1785
- *
1786
- * @remarks
1787
- * Shortcut for {@link Frame.select | page.mainFrame().select()}
1788
- */
1789
- select(selector: string, ...values: string[]): Promise<string[]>;
1790
- /**
1791
- * This method fetches an element with `selector`, scrolls it into view if
1792
- * needed, and then uses {@link Page.touchscreen} to tap in the center of the element.
1793
- * If there's no element matching `selector`, the method throws an error.
1794
- * @param selector - A
1795
- * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | Selector}
1796
- * to search for element to tap. If there are multiple elements satisfying the
1797
- * selector, the first will be tapped.
1798
- * @returns
1799
- * @remarks
1800
- * Shortcut for {@link Frame.tap | page.mainFrame().tap(selector)}.
1801
- */
1802
- tap(selector: string): Promise<void>;
1803
- /**
1804
- * Sends a `keydown`, `keypress/input`, and `keyup` event for each character
1805
- * in the text.
1806
- *
1807
- * To press a special key, like `Control` or `ArrowDown`, use {@link Keyboard.press}.
1808
- * @example
1809
- * ```
1810
- * await page.type('#mytextarea', 'Hello');
1811
- * // Types instantly
1812
- * await page.type('#mytextarea', 'World', { delay: 100 });
1813
- * // Types slower, like a user
1814
- * ```
1815
- * @param selector - A
1816
- * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | selector}
1817
- * of an element to type into. If there are multiple elements satisfying the
1818
- * selector, the first will be used.
1819
- * @param text - A text to type into a focused element.
1820
- * @param options - have property `delay` which is the Time to wait between
1821
- * key presses in milliseconds. Defaults to `0`.
1822
- * @returns
1823
- * @remarks
1824
- */
1825
- type(selector: string, text: string, options?: {
1826
- delay: number;
1827
- }): Promise<void>;
1828
- /**
1829
- * @remarks
1830
- *
1831
- * This method behaves differently depending on the first parameter. If it's a
1832
- * `string`, it will be treated as a `selector` or `xpath` (if the string
1833
- * starts with `//`). This method then is a shortcut for
1834
- * {@link Page.waitForSelector} or {@link Page.waitForXPath}.
1835
- *
1836
- * If the first argument is a function this method is a shortcut for
1837
- * {@link Page.waitForFunction}.
1838
- *
1839
- * If the first argument is a `number`, it's treated as a timeout in
1840
- * milliseconds and the method returns a promise which resolves after the
1841
- * timeout.
1842
- *
1843
- * @param selectorOrFunctionOrTimeout - a selector, predicate or timeout to
1844
- * wait for.
1845
- * @param options - optional waiting parameters.
1846
- * @param args - arguments to pass to `pageFunction`.
1847
- *
1848
- * @deprecated Don't use this method directly. Instead use the more explicit
1849
- * methods available: {@link Page.waitForSelector},
1850
- * {@link Page.waitForXPath}, {@link Page.waitForFunction} or
1851
- * {@link Page.waitForTimeout}.
1852
- */
1853
- waitFor(selectorOrFunctionOrTimeout: string | number | Function, options?: {
1854
- visible?: boolean;
1855
- hidden?: boolean;
1856
- timeout?: number;
1857
- polling?: string | number;
1858
- }, ...args: SerializableOrJSHandle[]): Promise<JSHandle>;
1859
- /**
1860
- * Causes your script to wait for the given number of milliseconds.
1861
- *
1862
- * @remarks
1863
- *
1864
- * It's generally recommended to not wait for a number of seconds, but instead
1865
- * use {@link Page.waitForSelector}, {@link Page.waitForXPath} or
1866
- * {@link Page.waitForFunction} to wait for exactly the conditions you want.
1867
- *
1868
- * @example
1869
- *
1870
- * Wait for 1 second:
1871
- *
1872
- * ```
1873
- * await page.waitForTimeout(1000);
1874
- * ```
1875
- *
1876
- * @param milliseconds - the number of milliseconds to wait.
1877
- */
1878
- waitForTimeout(milliseconds: number): Promise<void>;
1879
- /**
1880
- * Wait for the `selector` to appear in page. If at the moment of calling the
1881
- * method the `selector` already exists, the method will return immediately. If
1882
- * the `selector` doesn't appear after the `timeout` milliseconds of waiting, the
1883
- * function will throw.
1884
- *
1885
- * This method works across navigations:
1886
- * ```js
1887
- * const puppeteer = require('puppeteer');
1888
- * (async () => {
1889
- * const browser = await puppeteer.launch();
1890
- * const page = await browser.newPage();
1891
- * let currentURL;
1892
- * page
1893
- * .waitForSelector('img')
1894
- * .then(() => console.log('First URL with image: ' + currentURL));
1895
- * for (currentURL of [
1896
- * 'https://example.com',
1897
- * 'https://google.com',
1898
- * 'https://bbc.com',
1899
- * ]) {
1900
- * await page.goto(currentURL);
1901
- * }
1902
- * await browser.close();
1903
- * })();
1904
- * ```
1905
- * @param selector - A
1906
- * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | selector}
1907
- * of an element to wait for
1908
- * @param options - Optional waiting parameters
1909
- * @returns Promise which resolves when element specified by selector string
1910
- * is added to DOM. Resolves to `null` if waiting for hidden: `true` and
1911
- * selector is not found in DOM.
1912
- * @remarks
1913
- * The optional Parameter in Arguments `options` are :
1914
- *
1915
- * - `Visible`: A boolean wait for element to be present in DOM and to be
1916
- * visible, i.e. to not have `display: none` or `visibility: hidden` CSS
1917
- * properties. Defaults to `false`.
1918
- *
1919
- * - `hidden`: ait for element to not be found in the DOM or to be hidden,
1920
- * i.e. have `display: none` or `visibility: hidden` CSS properties. Defaults to
1921
- * `false`.
1922
- *
1923
- * - `timeout`: maximum time to wait for in milliseconds. Defaults to `30000`
1924
- * (30 seconds). Pass `0` to disable timeout. The default value can be changed
1925
- * by using the {@link Page.setDefaultTimeout} method.
1926
- */
1927
- waitForSelector(selector: string, options?: {
1928
- visible?: boolean;
1929
- hidden?: boolean;
1930
- timeout?: number;
1931
- }): Promise<ElementHandle | null>;
1932
- /**
1933
- * Wait for the `xpath` to appear in page. If at the moment of calling the
1934
- * method the `xpath` already exists, the method will return immediately. If
1935
- * the `xpath` doesn't appear after the `timeout` milliseconds of waiting, the
1936
- * function will throw.
1937
- *
1938
- * This method works across navigation
1939
- * ```js
1940
- * const puppeteer = require('puppeteer');
1941
- * (async () => {
1942
- * const browser = await puppeteer.launch();
1943
- * const page = await browser.newPage();
1944
- * let currentURL;
1945
- * page
1946
- * .waitForXPath('//img')
1947
- * .then(() => console.log('First URL with image: ' + currentURL));
1948
- * for (currentURL of [
1949
- * 'https://example.com',
1950
- * 'https://google.com',
1951
- * 'https://bbc.com',
1952
- * ]) {
1953
- * await page.goto(currentURL);
1954
- * }
1955
- * await browser.close();
1956
- * })();
1957
- * ```
1958
- * @param xpath - A
1959
- * {@link https://developer.mozilla.org/en-US/docs/Web/XPath | xpath} of an
1960
- * element to wait for
1961
- * @param options - Optional waiting parameters
1962
- * @returns Promise which resolves when element specified by xpath string is
1963
- * added to DOM. Resolves to `null` if waiting for `hidden: true` and xpath is
1964
- * not found in DOM.
1965
- * @remarks
1966
- * The optional Argument `options` have properties:
1967
- *
1968
- * - `visible`: A boolean to wait for element to be present in DOM and to be
1969
- * visible, i.e. to not have `display: none` or `visibility: hidden` CSS
1970
- * properties. Defaults to `false`.
1971
- *
1972
- * - `hidden`: A boolean wait for element to not be found in the DOM or to be
1973
- * hidden, i.e. have `display: none` or `visibility: hidden` CSS properties.
1974
- * Defaults to `false`.
1975
- *
1976
- * - `timeout`: A number which is maximum time to wait for in milliseconds.
1977
- * Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default
1978
- * value can be changed by using the {@link Page.setDefaultTimeout} method.
1979
- */
1980
- waitForXPath(xpath: string, options?: {
1981
- visible?: boolean;
1982
- hidden?: boolean;
1983
- timeout?: number;
1984
- }): Promise<ElementHandle | null>;
1985
- /**
1986
- * The `waitForFunction` can be used to observe viewport size change:
1987
- *
1988
- * ```
1989
- * const puppeteer = require('puppeteer');
1990
- * (async () => {
1991
- * const browser = await puppeteer.launch();
1992
- * const page = await browser.newPage();
1993
- * const watchDog = page.waitForFunction('window.innerWidth < 100');
1994
- * await page.setViewport({ width: 50, height: 50 });
1995
- * await watchDog;
1996
- * await browser.close();
1997
- * })();
1998
- * ```
1999
- * To pass arguments from node.js to the predicate of `page.waitForFunction` function:
2000
- * ```
2001
- * const selector = '.foo';
2002
- * await page.waitForFunction(
2003
- * (selector) => !!document.querySelector(selector),
2004
- * {},
2005
- * selector
2006
- * );
2007
- * ```
2008
- * The predicate of `page.waitForFunction` can be asynchronous too:
2009
- * ```
2010
- * const username = 'github-username';
2011
- * await page.waitForFunction(
2012
- * async (username) => {
2013
- * const githubResponse = await fetch(
2014
- * `https://api.github.com/users/${username}`
2015
- * );
2016
- * const githubUser = await githubResponse.json();
2017
- * // show the avatar
2018
- * const img = document.createElement('img');
2019
- * img.src = githubUser.avatar_url;
2020
- * // wait 3 seconds
2021
- * await new Promise((resolve, reject) => setTimeout(resolve, 3000));
2022
- * img.remove();
2023
- * },
2024
- * {},
2025
- * username
2026
- * );
2027
- * ```
2028
- * @param pageFunction - Function to be evaluated in browser context
2029
- * @param options - Optional waiting parameters
2030
- * @param args - Arguments to pass to `pageFunction`
2031
- * @returns Promise which resolves when the `pageFunction` returns a truthy
2032
- * value. It resolves to a JSHandle of the truthy value.
2033
- *
2034
- * The optional waiting parameter can be:
2035
- *
2036
- * - `Polling`: An interval at which the `pageFunction` is executed, defaults to
2037
- * `raf`. If `polling` is a number, then it is treated as an interval in
2038
- * milliseconds at which the function would be executed. If polling is a
2039
- * string, then it can be one of the following values:<br/>
2040
- * - `raf`: to constantly execute `pageFunction` in `requestAnimationFrame`
2041
- * callback. This is the tightest polling mode which is suitable to
2042
- * observe styling changes.<br/>
2043
- * - `mutation`: to execute pageFunction on every DOM mutation.
2044
- *
2045
- * - `timeout`: maximum time to wait for in milliseconds. Defaults to `30000`
2046
- * (30 seconds). Pass `0` to disable timeout. The default value can be changed
2047
- * by using the
2048
- * {@link Page.setDefaultTimeout | page.setDefaultTimeout(timeout)} method.
2049
- *
2050
- */
2051
- waitForFunction(pageFunction: Function | string, options?: {
2052
- timeout?: number;
2053
- polling?: string | number;
2054
- }, ...args: SerializableOrJSHandle[]): Promise<JSHandle>;
2055
- }
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
+ /// <reference types="node" />
17
+ import type { Readable } from 'stream';
18
+ import { EventEmitter } from './EventEmitter.js';
19
+ import { CDPSession } from './Connection.js';
20
+ import { Dialog } from './Dialog.js';
21
+ import { Frame } from './FrameManager.js';
22
+ import { Keyboard, Mouse, Touchscreen, MouseButton } from './Input.js';
23
+ import { Tracing } from './Tracing.js';
24
+ import { Coverage } from './Coverage.js';
25
+ import { WebWorker } from './WebWorker.js';
26
+ import { Browser, BrowserContext } from './Browser.js';
27
+ import { Target } from './Target.js';
28
+ import { JSHandle, ElementHandle } from './JSHandle.js';
29
+ import { Viewport } from './PuppeteerViewport.js';
30
+ import { Credentials, NetworkConditions } from './NetworkManager.js';
31
+ import { HTTPRequest } from './HTTPRequest.js';
32
+ import { HTTPResponse } from './HTTPResponse.js';
33
+ import { Accessibility } from './Accessibility.js';
34
+ import { FileChooser } from './FileChooser.js';
35
+ import { ConsoleMessage } from './ConsoleMessage.js';
36
+ import { PuppeteerLifeCycleEvent } from './LifecycleWatcher.js';
37
+ import { Protocol } from 'devtools-protocol';
38
+ import { SerializableOrJSHandle, EvaluateHandleFn, WrapElementHandle, EvaluateFn, EvaluateFnReturnType, UnwrapPromiseLike } from './EvalTypes.js';
39
+ import { PDFOptions } from './PDFOptions.js';
40
+ import { TaskQueue } from './TaskQueue.js';
41
+ /**
42
+ * @public
43
+ */
44
+ export interface Metrics {
45
+ Timestamp?: number;
46
+ Documents?: number;
47
+ Frames?: number;
48
+ JSEventListeners?: number;
49
+ Nodes?: number;
50
+ LayoutCount?: number;
51
+ RecalcStyleCount?: number;
52
+ LayoutDuration?: number;
53
+ RecalcStyleDuration?: number;
54
+ ScriptDuration?: number;
55
+ TaskDuration?: number;
56
+ JSHeapUsedSize?: number;
57
+ JSHeapTotalSize?: number;
58
+ }
59
+ /**
60
+ * @public
61
+ */
62
+ export interface WaitTimeoutOptions {
63
+ /**
64
+ * Maximum wait time in milliseconds, defaults to 30 seconds, pass `0` to
65
+ * disable the timeout.
66
+ *
67
+ * @remarks
68
+ * The default value can be changed by using the
69
+ * {@link Page.setDefaultTimeout} method.
70
+ */
71
+ timeout?: number;
72
+ }
73
+ /**
74
+ * @public
75
+ */
76
+ export interface WaitForOptions {
77
+ /**
78
+ * Maximum wait time in milliseconds, defaults to 30 seconds, pass `0` to
79
+ * disable the timeout.
80
+ *
81
+ * @remarks
82
+ * The default value can be changed by using the
83
+ * {@link Page.setDefaultTimeout} or {@link Page.setDefaultNavigationTimeout}
84
+ * methods.
85
+ */
86
+ timeout?: number;
87
+ waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[];
88
+ }
89
+ /**
90
+ * @public
91
+ */
92
+ export interface GeolocationOptions {
93
+ /**
94
+ * Latitude between -90 and 90.
95
+ */
96
+ longitude: number;
97
+ /**
98
+ * Longitude between -180 and 180.
99
+ */
100
+ latitude: number;
101
+ /**
102
+ * Optional non-negative accuracy value.
103
+ */
104
+ accuracy?: number;
105
+ }
106
+ /**
107
+ * @public
108
+ */
109
+ export interface MediaFeature {
110
+ name: string;
111
+ value: string;
112
+ }
113
+ /**
114
+ * @public
115
+ */
116
+ export interface ScreenshotClip {
117
+ x: number;
118
+ y: number;
119
+ width: number;
120
+ height: number;
121
+ }
122
+ /**
123
+ * @public
124
+ */
125
+ export interface ScreenshotOptions {
126
+ /**
127
+ * @defaultValue 'png'
128
+ */
129
+ type?: 'png' | 'jpeg' | 'webp';
130
+ /**
131
+ * The file path to save the image to. The screenshot type will be inferred
132
+ * from file extension. If path is a relative path, then it is resolved
133
+ * relative to current working directory. If no path is provided, the image
134
+ * won't be saved to the disk.
135
+ */
136
+ path?: string;
137
+ /**
138
+ * When true, takes a screenshot of the full page.
139
+ * @defaultValue false
140
+ */
141
+ fullPage?: boolean;
142
+ /**
143
+ * An object which specifies the clipping region of the page.
144
+ */
145
+ clip?: ScreenshotClip;
146
+ /**
147
+ * Quality of the image, between 0-100. Not applicable to `png` images.
148
+ */
149
+ quality?: number;
150
+ /**
151
+ * Hides default white background and allows capturing screenshots with transparency.
152
+ * @defaultValue false
153
+ */
154
+ omitBackground?: boolean;
155
+ /**
156
+ * Encoding of the image.
157
+ * @defaultValue 'binary'
158
+ */
159
+ encoding?: 'base64' | 'binary';
160
+ /**
161
+ * If you need a screenshot bigger than the Viewport
162
+ * @defaultValue true
163
+ */
164
+ captureBeyondViewport?: boolean;
165
+ }
166
+ /**
167
+ * All the events that a page instance may emit.
168
+ *
169
+ * @public
170
+ */
171
+ export declare const enum PageEmittedEvents {
172
+ /** Emitted when the page closes.
173
+ * @eventProperty
174
+ */
175
+ Close = "close",
176
+ /**
177
+ * Emitted when JavaScript within the page calls one of console API methods,
178
+ * e.g. `console.log` or `console.dir`. Also emitted if the page throws an
179
+ * error or a warning.
180
+ *
181
+ * @remarks
182
+ *
183
+ * A `console` event provides a {@link ConsoleMessage} representing the
184
+ * console message that was logged.
185
+ *
186
+ * @example
187
+ * An example of handling `console` event:
188
+ * ```js
189
+ * page.on('console', msg => {
190
+ * for (let i = 0; i < msg.args().length; ++i)
191
+ * console.log(`${i}: ${msg.args()[i]}`);
192
+ * });
193
+ * page.evaluate(() => console.log('hello', 5, {foo: 'bar'}));
194
+ * ```
195
+ */
196
+ Console = "console",
197
+ /**
198
+ * Emitted when a JavaScript dialog appears, such as `alert`, `prompt`,
199
+ * `confirm` or `beforeunload`. Puppeteer can respond to the dialog via
200
+ * {@link Dialog.accept} or {@link Dialog.dismiss}.
201
+ */
202
+ Dialog = "dialog",
203
+ /**
204
+ * Emitted when the JavaScript
205
+ * {@link https://developer.mozilla.org/en-US/docs/Web/Events/DOMContentLoaded | DOMContentLoaded } event is dispatched.
206
+ */
207
+ DOMContentLoaded = "domcontentloaded",
208
+ /**
209
+ * Emitted when the page crashes. Will contain an `Error`.
210
+ */
211
+ Error = "error",
212
+ /** Emitted when a frame is attached. Will contain a {@link Frame}. */
213
+ FrameAttached = "frameattached",
214
+ /** Emitted when a frame is detached. Will contain a {@link Frame}. */
215
+ FrameDetached = "framedetached",
216
+ /** Emitted when a frame is navigated to a new URL. Will contain a {@link Frame}. */
217
+ FrameNavigated = "framenavigated",
218
+ /**
219
+ * Emitted when the JavaScript
220
+ * {@link https://developer.mozilla.org/en-US/docs/Web/Events/load | load}
221
+ * event is dispatched.
222
+ */
223
+ Load = "load",
224
+ /**
225
+ * Emitted when the JavaScript code makes a call to `console.timeStamp`. For
226
+ * the list of metrics see {@link Page.metrics | page.metrics}.
227
+ *
228
+ * @remarks
229
+ * Contains an object with two properties:
230
+ * - `title`: the title passed to `console.timeStamp`
231
+ * - `metrics`: objec containing metrics as key/value pairs. The values will
232
+ * be `number`s.
233
+ */
234
+ Metrics = "metrics",
235
+ /**
236
+ * Emitted when an uncaught exception happens within the page.
237
+ * Contains an `Error`.
238
+ */
239
+ PageError = "pageerror",
240
+ /**
241
+ * Emitted when the page opens a new tab or window.
242
+ *
243
+ * Contains a {@link Page} corresponding to the popup window.
244
+ *
245
+ * @example
246
+ *
247
+ * ```js
248
+ * const [popup] = await Promise.all([
249
+ * new Promise(resolve => page.once('popup', resolve)),
250
+ * page.click('a[target=_blank]'),
251
+ * ]);
252
+ * ```
253
+ *
254
+ * ```js
255
+ * const [popup] = await Promise.all([
256
+ * new Promise(resolve => page.once('popup', resolve)),
257
+ * page.evaluate(() => window.open('https://example.com')),
258
+ * ]);
259
+ * ```
260
+ */
261
+ Popup = "popup",
262
+ /**
263
+ * Emitted when a page issues a request and contains a {@link HTTPRequest}.
264
+ *
265
+ * @remarks
266
+ * The object is readonly. See {@link Page.setRequestInterception} for intercepting
267
+ * and mutating requests.
268
+ */
269
+ Request = "request",
270
+ /**
271
+ * Emitted when a request ended up loading from cache. Contains a {@link HTTPRequest}.
272
+ *
273
+ * @remarks
274
+ * For certain requests, might contain undefined.
275
+ * {@link https://crbug.com/750469}
276
+ */
277
+ RequestServedFromCache = "requestservedfromcache",
278
+ /**
279
+ * Emitted when a request fails, for example by timing out.
280
+ *
281
+ * Contains a {@link HTTPRequest}.
282
+ *
283
+ * @remarks
284
+ *
285
+ * NOTE: HTTP Error responses, such as 404 or 503, are still successful
286
+ * responses from HTTP standpoint, so request will complete with
287
+ * `requestfinished` event and not with `requestfailed`.
288
+ */
289
+ RequestFailed = "requestfailed",
290
+ /**
291
+ * Emitted when a request finishes successfully. Contains a {@link HTTPRequest}.
292
+ */
293
+ RequestFinished = "requestfinished",
294
+ /**
295
+ * Emitted when a response is received. Contains a {@link HTTPResponse}.
296
+ */
297
+ Response = "response",
298
+ /**
299
+ * Emitted when a dedicated
300
+ * {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API | WebWorker}
301
+ * is spawned by the page.
302
+ */
303
+ WorkerCreated = "workercreated",
304
+ /**
305
+ * Emitted when a dedicated
306
+ * {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API | WebWorker}
307
+ * is destroyed by the page.
308
+ */
309
+ WorkerDestroyed = "workerdestroyed"
310
+ }
311
+ /**
312
+ * Denotes the objects received by callback functions for page events.
313
+ *
314
+ * See {@link PageEmittedEvents} for more detail on the events and when they are
315
+ * emitted.
316
+ * @public
317
+ */
318
+ export interface PageEventObject {
319
+ close: never;
320
+ console: ConsoleMessage;
321
+ dialog: Dialog;
322
+ domcontentloaded: never;
323
+ error: Error;
324
+ frameattached: Frame;
325
+ framedetached: Frame;
326
+ framenavigated: Frame;
327
+ load: never;
328
+ metrics: {
329
+ title: string;
330
+ metrics: Metrics;
331
+ };
332
+ pageerror: Error;
333
+ popup: Page;
334
+ request: HTTPRequest;
335
+ response: HTTPResponse;
336
+ requestfailed: HTTPRequest;
337
+ requestfinished: HTTPRequest;
338
+ requestservedfromcache: HTTPRequest;
339
+ workercreated: WebWorker;
340
+ workerdestroyed: WebWorker;
341
+ }
342
+ /**
343
+ * Page provides methods to interact with a single tab or
344
+ * {@link https://developer.chrome.com/extensions/background_pages | extension background page} in Chromium.
345
+ *
346
+ * @remarks
347
+ *
348
+ * One Browser instance might have multiple Page instances.
349
+ *
350
+ * @example
351
+ * This example creates a page, navigates it to a URL, and then * saves a screenshot:
352
+ * ```js
353
+ * const puppeteer = require('puppeteer');
354
+ *
355
+ * (async () => {
356
+ * const browser = await puppeteer.launch();
357
+ * const page = await browser.newPage();
358
+ * await page.goto('https://example.com');
359
+ * await page.screenshot({path: 'screenshot.png'});
360
+ * await browser.close();
361
+ * })();
362
+ * ```
363
+ *
364
+ * The Page class extends from Puppeteer's {@link EventEmitter} class and will
365
+ * emit various events which are documented in the {@link PageEmittedEvents} enum.
366
+ *
367
+ * @example
368
+ * This example logs a message for a single page `load` event:
369
+ * ```js
370
+ * page.once('load', () => console.log('Page loaded!'));
371
+ * ```
372
+ *
373
+ * To unsubscribe from events use the `off` method:
374
+ *
375
+ * ```js
376
+ * function logRequest(interceptedRequest) {
377
+ * console.log('A request was made:', interceptedRequest.url());
378
+ * }
379
+ * page.on('request', logRequest);
380
+ * // Sometime later...
381
+ * page.off('request', logRequest);
382
+ * ```
383
+ * @public
384
+ */
385
+ export declare class Page extends EventEmitter {
386
+ /**
387
+ * @internal
388
+ */
389
+ static create(client: CDPSession, target: Target, ignoreHTTPSErrors: boolean, defaultViewport: Viewport | null, screenshotTaskQueue: TaskQueue): Promise<Page>;
390
+ private _closed;
391
+ private _client;
392
+ private _target;
393
+ private _keyboard;
394
+ private _mouse;
395
+ private _timeoutSettings;
396
+ private _touchscreen;
397
+ private _accessibility;
398
+ private _frameManager;
399
+ private _emulationManager;
400
+ private _tracing;
401
+ private _pageBindings;
402
+ private _coverage;
403
+ private _javascriptEnabled;
404
+ private _viewport;
405
+ private _screenshotTaskQueue;
406
+ private _workers;
407
+ private _fileChooserInterceptors;
408
+ private _disconnectPromise?;
409
+ private _userDragInterceptionEnabled;
410
+ private _handlerMap;
411
+ /**
412
+ * @internal
413
+ */
414
+ constructor(client: CDPSession, target: Target, ignoreHTTPSErrors: boolean, screenshotTaskQueue: TaskQueue);
415
+ private _initialize;
416
+ private _onFileChooser;
417
+ /**
418
+ * @returns `true` if drag events are being intercepted, `false` otherwise.
419
+ */
420
+ isDragInterceptionEnabled(): boolean;
421
+ /**
422
+ * @returns `true` if the page has JavaScript enabled, `false` otherwise.
423
+ */
424
+ isJavaScriptEnabled(): boolean;
425
+ /**
426
+ * Listen to page events.
427
+ */
428
+ on<K extends keyof PageEventObject>(eventName: K, handler: (event: PageEventObject[K]) => void): EventEmitter;
429
+ once<K extends keyof PageEventObject>(eventName: K, handler: (event: PageEventObject[K]) => void): EventEmitter;
430
+ off<K extends keyof PageEventObject>(eventName: K, handler: (event: PageEventObject[K]) => void): EventEmitter;
431
+ /**
432
+ * This method is typically coupled with an action that triggers file
433
+ * choosing. The following example clicks a button that issues a file chooser
434
+ * and then responds with `/tmp/myfile.pdf` as if a user has selected this file.
435
+ *
436
+ * ```js
437
+ * const [fileChooser] = await Promise.all([
438
+ * page.waitForFileChooser(),
439
+ * page.click('#upload-file-button'),
440
+ * // some button that triggers file selection
441
+ * ]);
442
+ * await fileChooser.accept(['/tmp/myfile.pdf']);
443
+ * ```
444
+ *
445
+ * NOTE: This must be called before the file chooser is launched. It will not
446
+ * return a currently active file chooser.
447
+ * @param options - Optional waiting parameters
448
+ * @returns Resolves after a page requests a file picker.
449
+ * @remarks
450
+ * NOTE: In non-headless Chromium, this method results in the native file picker
451
+ * dialog `not showing up` for the user.
452
+ */
453
+ waitForFileChooser(options?: WaitTimeoutOptions): Promise<FileChooser>;
454
+ /**
455
+ * Sets the page's geolocation.
456
+ * @remarks
457
+ * NOTE: Consider using {@link BrowserContext.overridePermissions} to grant
458
+ * permissions for the page to read its geolocation.
459
+ * @example
460
+ * ```js
461
+ * await page.setGeolocation({latitude: 59.95, longitude: 30.31667});
462
+ * ```
463
+ */
464
+ setGeolocation(options: GeolocationOptions): Promise<void>;
465
+ /**
466
+ * @returns A target this page was created from.
467
+ */
468
+ target(): Target;
469
+ /**
470
+ * Get the CDP session client the page belongs to.
471
+ * @internal
472
+ */
473
+ client(): CDPSession;
474
+ /**
475
+ * Get the browser the page belongs to.
476
+ */
477
+ browser(): Browser;
478
+ /**
479
+ * Get the browser context that the page belongs to.
480
+ */
481
+ browserContext(): BrowserContext;
482
+ private _onTargetCrashed;
483
+ private _onLogEntryAdded;
484
+ /**
485
+ * @returns The page's main frame.
486
+ * @remarks
487
+ * Page is guaranteed to have a main frame which persists during navigations.
488
+ */
489
+ mainFrame(): Frame;
490
+ get keyboard(): Keyboard;
491
+ get touchscreen(): Touchscreen;
492
+ get coverage(): Coverage;
493
+ get tracing(): Tracing;
494
+ get accessibility(): Accessibility;
495
+ /**
496
+ * @returns An array of all frames attached to the page.
497
+ */
498
+ frames(): Frame[];
499
+ /**
500
+ * @returns all of the dedicated
501
+ * {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API |
502
+ * WebWorkers}
503
+ * associated with the page.
504
+ * @remarks
505
+ * NOTE: This does not contain ServiceWorkers
506
+ */
507
+ workers(): WebWorker[];
508
+ /**
509
+ * @param value - Whether to enable request interception.
510
+ *
511
+ * @remarks
512
+ * Activating request interception enables {@link HTTPRequest.abort},
513
+ * {@link HTTPRequest.continue} and {@link HTTPRequest.respond} methods. This
514
+ * provides the capability to modify network requests that are made by a page.
515
+ *
516
+ * Once request interception is enabled, every request will stall unless it's
517
+ * continued, responded or aborted; or completed using the browser cache.
518
+ *
519
+ * @example
520
+ * An example of a naïve request interceptor that aborts all image requests:
521
+ * ```js
522
+ * const puppeteer = require('puppeteer');
523
+ * (async () => {
524
+ * const browser = await puppeteer.launch();
525
+ * const page = await browser.newPage();
526
+ * await page.setRequestInterception(true);
527
+ * page.on('request', interceptedRequest => {
528
+ * if (interceptedRequest.url().endsWith('.png') ||
529
+ * interceptedRequest.url().endsWith('.jpg'))
530
+ * interceptedRequest.abort();
531
+ * else
532
+ * interceptedRequest.continue();
533
+ * });
534
+ * await page.goto('https://example.com');
535
+ * await browser.close();
536
+ * })();
537
+ * ```
538
+ * NOTE: Enabling request interception disables page caching.
539
+ */
540
+ setRequestInterception(value: boolean): Promise<void>;
541
+ /**
542
+ * @param enabled - Whether to enable drag interception.
543
+ *
544
+ * @remarks
545
+ * Activating drag interception enables the `Input.drag`,
546
+ * methods This provides the capability to capture drag events emitted
547
+ * on the page, which can then be used to simulate drag-and-drop.
548
+ */
549
+ setDragInterception(enabled: boolean): Promise<void>;
550
+ /**
551
+ * @param enabled - When `true`, enables offline mode for the page.
552
+ * @remarks
553
+ * NOTE: while this method sets the network connection to offline, it does
554
+ * not change the parameters used in [page.emulateNetworkConditions(networkConditions)]
555
+ * (#pageemulatenetworkconditionsnetworkconditions)
556
+ */
557
+ setOfflineMode(enabled: boolean): Promise<void>;
558
+ /**
559
+ * @param networkConditions - Passing `null` disables network condition emulation.
560
+ * @example
561
+ * ```js
562
+ * const puppeteer = require('puppeteer');
563
+ * const slow3G = puppeteer.networkConditions['Slow 3G'];
564
+ *
565
+ * (async () => {
566
+ * const browser = await puppeteer.launch();
567
+ * const page = await browser.newPage();
568
+ * await page.emulateNetworkConditions(slow3G);
569
+ * await page.goto('https://www.google.com');
570
+ * // other actions...
571
+ * await browser.close();
572
+ * })();
573
+ * ```
574
+ * @remarks
575
+ * NOTE: This does not affect WebSockets and WebRTC PeerConnections (see
576
+ * https://crbug.com/563644). To set the page offline, you can use
577
+ * [page.setOfflineMode(enabled)](#pagesetofflinemodeenabled).
578
+ */
579
+ emulateNetworkConditions(networkConditions: NetworkConditions | null): Promise<void>;
580
+ /**
581
+ * This setting will change the default maximum navigation time for the
582
+ * following methods and related shortcuts:
583
+ *
584
+ * - {@link Page.goBack | page.goBack(options)}
585
+ *
586
+ * - {@link Page.goForward | page.goForward(options)}
587
+ *
588
+ * - {@link Page.goto | page.goto(url,options)}
589
+ *
590
+ * - {@link Page.reload | page.reload(options)}
591
+ *
592
+ * - {@link Page.setContent | page.setContent(html,options)}
593
+ *
594
+ * - {@link Page.waitForNavigation | page.waitForNavigation(options)}
595
+ * @param timeout - Maximum navigation time in milliseconds.
596
+ */
597
+ setDefaultNavigationTimeout(timeout: number): void;
598
+ /**
599
+ * @param timeout - Maximum time in milliseconds.
600
+ */
601
+ setDefaultTimeout(timeout: number): void;
602
+ /**
603
+ * Runs `document.querySelector` within the page. If no element matches the
604
+ * selector, the return value resolves to `null`.
605
+ *
606
+ * @remarks
607
+ * Shortcut for {@link Frame.$ | Page.mainFrame().$(selector) }.
608
+ *
609
+ * @param selector - A `selector` to query page for
610
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | selector}
611
+ * to query page for.
612
+ */
613
+ $<T extends Element = Element>(selector: string): Promise<ElementHandle<T> | null>;
614
+ /**
615
+ * @remarks
616
+ *
617
+ * The only difference between {@link Page.evaluate | page.evaluate} and
618
+ * `page.evaluateHandle` is that `evaluateHandle` will return the value
619
+ * wrapped in an in-page object.
620
+ *
621
+ * If the function passed to `page.evaluteHandle` returns a Promise, the
622
+ * function will wait for the promise to resolve and return its value.
623
+ *
624
+ * You can pass a string instead of a function (although functions are
625
+ * recommended as they are easier to debug and use with TypeScript):
626
+ *
627
+ * @example
628
+ * ```
629
+ * const aHandle = await page.evaluateHandle('document')
630
+ * ```
631
+ *
632
+ * @example
633
+ * {@link JSHandle} instances can be passed as arguments to the `pageFunction`:
634
+ * ```
635
+ * const aHandle = await page.evaluateHandle(() => document.body);
636
+ * const resultHandle = await page.evaluateHandle(body => body.innerHTML, aHandle);
637
+ * console.log(await resultHandle.jsonValue());
638
+ * await resultHandle.dispose();
639
+ * ```
640
+ *
641
+ * Most of the time this function returns a {@link JSHandle},
642
+ * but if `pageFunction` returns a reference to an element,
643
+ * you instead get an {@link ElementHandle} back:
644
+ *
645
+ * @example
646
+ * ```
647
+ * const button = await page.evaluateHandle(() => document.querySelector('button'));
648
+ * // can call `click` because `button` is an `ElementHandle`
649
+ * await button.click();
650
+ * ```
651
+ *
652
+ * The TypeScript definitions assume that `evaluateHandle` returns
653
+ * a `JSHandle`, but if you know it's going to return an
654
+ * `ElementHandle`, pass it as the generic argument:
655
+ *
656
+ * ```
657
+ * const button = await page.evaluateHandle<ElementHandle>(...);
658
+ * ```
659
+ *
660
+ * @param pageFunction - a function that is run within the page
661
+ * @param args - arguments to be passed to the pageFunction
662
+ */
663
+ evaluateHandle<HandlerType extends JSHandle = JSHandle>(pageFunction: EvaluateHandleFn, ...args: SerializableOrJSHandle[]): Promise<HandlerType>;
664
+ /**
665
+ * This method iterates the JavaScript heap and finds all objects with the
666
+ * given prototype.
667
+ *
668
+ * @remarks
669
+ * Shortcut for
670
+ * {@link ExecutionContext.queryObjects |
671
+ * page.mainFrame().executionContext().queryObjects(prototypeHandle)}.
672
+ *
673
+ * @example
674
+ *
675
+ * ```js
676
+ * // Create a Map object
677
+ * await page.evaluate(() => window.map = new Map());
678
+ * // Get a handle to the Map object prototype
679
+ * const mapPrototype = await page.evaluateHandle(() => Map.prototype);
680
+ * // Query all map instances into an array
681
+ * const mapInstances = await page.queryObjects(mapPrototype);
682
+ * // Count amount of map objects in heap
683
+ * const count = await page.evaluate(maps => maps.length, mapInstances);
684
+ * await mapInstances.dispose();
685
+ * await mapPrototype.dispose();
686
+ * ```
687
+ * @param prototypeHandle - a handle to the object prototype.
688
+ * @returns Promise which resolves to a handle to an array of objects with
689
+ * this prototype.
690
+ */
691
+ queryObjects(prototypeHandle: JSHandle): Promise<JSHandle>;
692
+ /**
693
+ * This method runs `document.querySelector` within the page and passes the
694
+ * result as the first argument to the `pageFunction`.
695
+ *
696
+ * @remarks
697
+ *
698
+ * If no element is found matching `selector`, the method will throw an error.
699
+ *
700
+ * If `pageFunction` returns a promise `$eval` will wait for the promise to
701
+ * resolve and then return its value.
702
+ *
703
+ * @example
704
+ *
705
+ * ```
706
+ * const searchValue = await page.$eval('#search', el => el.value);
707
+ * const preloadHref = await page.$eval('link[rel=preload]', el => el.href);
708
+ * const html = await page.$eval('.main-container', el => el.outerHTML);
709
+ * ```
710
+ *
711
+ * If you are using TypeScript, you may have to provide an explicit type to the
712
+ * first argument of the `pageFunction`.
713
+ * By default it is typed as `Element`, but you may need to provide a more
714
+ * specific sub-type:
715
+ *
716
+ * @example
717
+ *
718
+ * ```
719
+ * // if you don't provide HTMLInputElement here, TS will error
720
+ * // as `value` is not on `Element`
721
+ * const searchValue = await page.$eval('#search', (el: HTMLInputElement) => el.value);
722
+ * ```
723
+ *
724
+ * The compiler should be able to infer the return type
725
+ * from the `pageFunction` you provide. If it is unable to, you can use the generic
726
+ * type to tell the compiler what return type you expect from `$eval`:
727
+ *
728
+ * @example
729
+ *
730
+ * ```
731
+ * // The compiler can infer the return type in this case, but if it can't
732
+ * // or if you want to be more explicit, provide it as the generic type.
733
+ * const searchValue = await page.$eval<string>(
734
+ * '#search', (el: HTMLInputElement) => el.value
735
+ * );
736
+ * ```
737
+ *
738
+ * @param selector - the
739
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | selector}
740
+ * to query for
741
+ * @param pageFunction - the function to be evaluated in the page context.
742
+ * Will be passed the result of `document.querySelector(selector)` as its
743
+ * first argument.
744
+ * @param args - any additional arguments to pass through to `pageFunction`.
745
+ *
746
+ * @returns The result of calling `pageFunction`. If it returns an element it
747
+ * is wrapped in an {@link ElementHandle}, else the raw value itself is
748
+ * returned.
749
+ */
750
+ $eval<ReturnType>(selector: string, pageFunction: (element: Element, ...args: unknown[]) => ReturnType | Promise<ReturnType>, ...args: SerializableOrJSHandle[]): Promise<WrapElementHandle<ReturnType>>;
751
+ /**
752
+ * This method runs `Array.from(document.querySelectorAll(selector))` within
753
+ * the page and passes the result as the first argument to the `pageFunction`.
754
+ *
755
+ * @remarks
756
+ *
757
+ * If `pageFunction` returns a promise `$$eval` will wait for the promise to
758
+ * resolve and then return its value.
759
+ *
760
+ * @example
761
+ *
762
+ * ```
763
+ * // get the amount of divs on the page
764
+ * const divCount = await page.$$eval('div', divs => divs.length);
765
+ *
766
+ * // get the text content of all the `.options` elements:
767
+ * const options = await page.$$eval('div > span.options', options => {
768
+ * return options.map(option => option.textContent)
769
+ * });
770
+ * ```
771
+ *
772
+ * If you are using TypeScript, you may have to provide an explicit type to the
773
+ * first argument of the `pageFunction`.
774
+ * By default it is typed as `Element[]`, but you may need to provide a more
775
+ * specific sub-type:
776
+ *
777
+ * @example
778
+ *
779
+ * ```
780
+ * // if you don't provide HTMLInputElement here, TS will error
781
+ * // as `value` is not on `Element`
782
+ * await page.$$eval('input', (elements: HTMLInputElement[]) => {
783
+ * return elements.map(e => e.value);
784
+ * });
785
+ * ```
786
+ *
787
+ * The compiler should be able to infer the return type
788
+ * from the `pageFunction` you provide. If it is unable to, you can use the generic
789
+ * type to tell the compiler what return type you expect from `$$eval`:
790
+ *
791
+ * @example
792
+ *
793
+ * ```
794
+ * // The compiler can infer the return type in this case, but if it can't
795
+ * // or if you want to be more explicit, provide it as the generic type.
796
+ * const allInputValues = await page.$$eval<string[]>(
797
+ * 'input', (elements: HTMLInputElement[]) => elements.map(e => e.textContent)
798
+ * );
799
+ * ```
800
+ *
801
+ * @param selector - the
802
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | selector}
803
+ * to query for
804
+ * @param pageFunction - the function to be evaluated in the page context. Will
805
+ * be passed the result of `Array.from(document.querySelectorAll(selector))`
806
+ * as its first argument.
807
+ * @param args - any additional arguments to pass through to `pageFunction`.
808
+ *
809
+ * @returns The result of calling `pageFunction`. If it returns an element it
810
+ * is wrapped in an {@link ElementHandle}, else the raw value itself is
811
+ * returned.
812
+ */
813
+ $$eval<ReturnType>(selector: string, pageFunction: (elements: Element[], ...args: unknown[]) => ReturnType | Promise<ReturnType>, ...args: SerializableOrJSHandle[]): Promise<WrapElementHandle<ReturnType>>;
814
+ /**
815
+ * The method runs `document.querySelectorAll` within the page. If no elements
816
+ * match the selector, the return value resolves to `[]`.
817
+ * @remarks
818
+ * Shortcut for {@link Frame.$$ | Page.mainFrame().$$(selector) }.
819
+ * @param selector - A `selector` to query page for
820
+ */
821
+ $$<T extends Element = Element>(selector: string): Promise<Array<ElementHandle<T>>>;
822
+ /**
823
+ * The method evaluates the XPath expression relative to the page document as
824
+ * its context node. If there are no such elements, the method resolves to an
825
+ * empty array.
826
+ * @remarks
827
+ * Shortcut for {@link Frame.$x | Page.mainFrame().$x(expression) }.
828
+ * @param expression - Expression to evaluate
829
+ */
830
+ $x(expression: string): Promise<ElementHandle[]>;
831
+ /**
832
+ * If no URLs are specified, this method returns cookies for the current page
833
+ * URL. If URLs are specified, only cookies for those URLs are returned.
834
+ */
835
+ cookies(...urls: string[]): Promise<Protocol.Network.Cookie[]>;
836
+ deleteCookie(...cookies: Protocol.Network.DeleteCookiesRequest[]): Promise<void>;
837
+ /**
838
+ * @example
839
+ * ```js
840
+ * await page.setCookie(cookieObject1, cookieObject2);
841
+ * ```
842
+ */
843
+ setCookie(...cookies: Protocol.Network.CookieParam[]): Promise<void>;
844
+ /**
845
+ * Adds a `<script>` tag into the page with the desired URL or content.
846
+ * @remarks
847
+ * Shortcut for {@link Frame.addScriptTag | page.mainFrame().addScriptTag(options) }.
848
+ * @returns Promise which resolves to the added tag when the script's onload fires or
849
+ * when the script content was injected into frame.
850
+ */
851
+ addScriptTag(options: {
852
+ url?: string;
853
+ path?: string;
854
+ content?: string;
855
+ type?: string;
856
+ id?: string;
857
+ }): Promise<ElementHandle>;
858
+ /**
859
+ * Adds a `<link rel="stylesheet">` tag into the page with the desired URL or a
860
+ * `<style type="text/css">` tag with the content.
861
+ * @returns Promise which resolves to the added tag when the stylesheet's
862
+ * onload fires or when the CSS content was injected into frame.
863
+ */
864
+ addStyleTag(options: {
865
+ url?: string;
866
+ path?: string;
867
+ content?: string;
868
+ }): Promise<ElementHandle>;
869
+ /**
870
+ * The method adds a function called `name` on the page's `window` object. When
871
+ * called, the function executes `puppeteerFunction` in node.js and returns a
872
+ * `Promise` which resolves to the return value of `puppeteerFunction`.
873
+ *
874
+ * If the puppeteerFunction returns a `Promise`, it will be awaited.
875
+ *
876
+ * NOTE: Functions installed via `page.exposeFunction` survive navigations.
877
+ * @param name - Name of the function on the window object
878
+ * @param puppeteerFunction - Callback function which will be called in
879
+ * Puppeteer's context.
880
+ * @example
881
+ * An example of adding an `md5` function into the page:
882
+ * ```js
883
+ * const puppeteer = require('puppeteer');
884
+ * const crypto = require('crypto');
885
+ *
886
+ * (async () => {
887
+ * const browser = await puppeteer.launch();
888
+ * const page = await browser.newPage();
889
+ * page.on('console', (msg) => console.log(msg.text()));
890
+ * await page.exposeFunction('md5', (text) =>
891
+ * crypto.createHash('md5').update(text).digest('hex')
892
+ * );
893
+ * await page.evaluate(async () => {
894
+ * // use window.md5 to compute hashes
895
+ * const myString = 'PUPPETEER';
896
+ * const myHash = await window.md5(myString);
897
+ * console.log(`md5 of ${myString} is ${myHash}`);
898
+ * });
899
+ * await browser.close();
900
+ * })();
901
+ * ```
902
+ * An example of adding a `window.readfile` function into the page:
903
+ * ```js
904
+ * const puppeteer = require('puppeteer');
905
+ * const fs = require('fs');
906
+ *
907
+ * (async () => {
908
+ * const browser = await puppeteer.launch();
909
+ * const page = await browser.newPage();
910
+ * page.on('console', (msg) => console.log(msg.text()));
911
+ * await page.exposeFunction('readfile', async (filePath) => {
912
+ * return new Promise((resolve, reject) => {
913
+ * fs.readFile(filePath, 'utf8', (err, text) => {
914
+ * if (err) reject(err);
915
+ * else resolve(text);
916
+ * });
917
+ * });
918
+ * });
919
+ * await page.evaluate(async () => {
920
+ * // use window.readfile to read contents of a file
921
+ * const content = await window.readfile('/etc/hosts');
922
+ * console.log(content);
923
+ * });
924
+ * await browser.close();
925
+ * })();
926
+ * ```
927
+ */
928
+ exposeFunction(name: string, puppeteerFunction: Function | {
929
+ default: Function;
930
+ }): Promise<void>;
931
+ /**
932
+ * Provide credentials for `HTTP authentication`.
933
+ * @remarks To disable authentication, pass `null`.
934
+ */
935
+ authenticate(credentials: Credentials): Promise<void>;
936
+ /**
937
+ * The extra HTTP headers will be sent with every request the page initiates.
938
+ * NOTE: All HTTP header names are lowercased. (HTTP headers are
939
+ * case-insensitive, so this shouldn’t impact your server code.)
940
+ * NOTE: page.setExtraHTTPHeaders does not guarantee the order of headers in
941
+ * the outgoing requests.
942
+ * @param headers - An object containing additional HTTP headers to be sent
943
+ * with every request. All header values must be strings.
944
+ * @returns
945
+ */
946
+ setExtraHTTPHeaders(headers: Record<string, string>): Promise<void>;
947
+ /**
948
+ * @param userAgent - Specific user agent to use in this page
949
+ * @param userAgentData - Specific user agent client hint data to use in this
950
+ * page
951
+ * @returns Promise which resolves when the user agent is set.
952
+ */
953
+ setUserAgent(userAgent: string, userAgentMetadata?: Protocol.Emulation.UserAgentMetadata): Promise<void>;
954
+ /**
955
+ * @returns Object containing metrics as key/value pairs.
956
+ *
957
+ * - `Timestamp` : The timestamp when the metrics sample was taken.
958
+ *
959
+ * - `Documents` : Number of documents in the page.
960
+ *
961
+ * - `Frames` : Number of frames in the page.
962
+ *
963
+ * - `JSEventListeners` : Number of events in the page.
964
+ *
965
+ * - `Nodes` : Number of DOM nodes in the page.
966
+ *
967
+ * - `LayoutCount` : Total number of full or partial page layout.
968
+ *
969
+ * - `RecalcStyleCount` : Total number of page style recalculations.
970
+ *
971
+ * - `LayoutDuration` : Combined durations of all page layouts.
972
+ *
973
+ * - `RecalcStyleDuration` : Combined duration of all page style
974
+ * recalculations.
975
+ *
976
+ * - `ScriptDuration` : Combined duration of JavaScript execution.
977
+ *
978
+ * - `TaskDuration` : Combined duration of all tasks performed by the browser.
979
+ *
980
+ *
981
+ * - `JSHeapUsedSize` : Used JavaScript heap size.
982
+ *
983
+ * - `JSHeapTotalSize` : Total JavaScript heap size.
984
+ * @remarks
985
+ * NOTE: All timestamps are in monotonic time: monotonically increasing time
986
+ * in seconds since an arbitrary point in the past.
987
+ */
988
+ metrics(): Promise<Metrics>;
989
+ private _emitMetrics;
990
+ private _buildMetricsObject;
991
+ private _handleException;
992
+ private _onConsoleAPI;
993
+ private _onBindingCalled;
994
+ private _addConsoleMessage;
995
+ private _onDialog;
996
+ /**
997
+ * Resets default white background
998
+ */
999
+ private _resetDefaultBackgroundColor;
1000
+ /**
1001
+ * Hides default white background
1002
+ */
1003
+ private _setTransparentBackgroundColor;
1004
+ /**
1005
+ *
1006
+ * @returns
1007
+ * @remarks Shortcut for
1008
+ * {@link Frame.url | page.mainFrame().url()}.
1009
+ */
1010
+ url(): string;
1011
+ content(): Promise<string>;
1012
+ /**
1013
+ * @param html - HTML markup to assign to the page.
1014
+ * @param options - Parameters that has some properties.
1015
+ * @remarks
1016
+ * The parameter `options` might have the following options.
1017
+ *
1018
+ * - `timeout` : Maximum time in milliseconds for resources to load, defaults
1019
+ * to 30 seconds, pass `0` to disable timeout. The default value can be
1020
+ * changed by using the
1021
+ * {@link Page.setDefaultNavigationTimeout |
1022
+ * page.setDefaultNavigationTimeout(timeout)}
1023
+ * or {@link Page.setDefaultTimeout | page.setDefaultTimeout(timeout)}
1024
+ * methods.
1025
+ *
1026
+ * - `waitUntil`: When to consider setting markup succeeded, defaults to `load`.
1027
+ * Given an array of event strings, setting content is considered to be
1028
+ * successful after all events have been fired. Events can be either:<br/>
1029
+ * - `load` : consider setting content to be finished when the `load` event is
1030
+ * fired.<br/>
1031
+ * - `domcontentloaded` : consider setting content to be finished when the
1032
+ * `DOMContentLoaded` event is fired.<br/>
1033
+ * - `networkidle0` : consider setting content to be finished when there are no
1034
+ * more than 0 network connections for at least `500` ms.<br/>
1035
+ * - `networkidle2` : consider setting content to be finished when there are no
1036
+ * more than 2 network connections for at least `500` ms.
1037
+ */
1038
+ setContent(html: string, options?: WaitForOptions): Promise<void>;
1039
+ /**
1040
+ * @param url - URL to navigate page to. The URL should include scheme, e.g.
1041
+ * `https://`
1042
+ * @param options - Navigation Parameter
1043
+ * @returns Promise which resolves to the main resource response. In case of
1044
+ * multiple redirects, the navigation will resolve with the response of the
1045
+ * last redirect.
1046
+ * @remarks
1047
+ * The argument `options` might have the following properties:
1048
+ *
1049
+ * - `timeout` : Maximum navigation time in milliseconds, defaults to 30
1050
+ * seconds, pass 0 to disable timeout. The default value can be changed by
1051
+ * using the
1052
+ * {@link Page.setDefaultNavigationTimeout |
1053
+ * page.setDefaultNavigationTimeout(timeout)}
1054
+ * or {@link Page.setDefaultTimeout | page.setDefaultTimeout(timeout)}
1055
+ * methods.
1056
+ *
1057
+ * - `waitUntil`:When to consider navigation succeeded, defaults to `load`.
1058
+ * Given an array of event strings, navigation is considered to be successful
1059
+ * after all events have been fired. Events can be either:<br/>
1060
+ * - `load` : consider navigation to be finished when the load event is
1061
+ * fired.<br/>
1062
+ * - `domcontentloaded` : consider navigation to be finished when the
1063
+ * DOMContentLoaded event is fired.<br/>
1064
+ * - `networkidle0` : consider navigation to be finished when there are no
1065
+ * more than 0 network connections for at least `500` ms.<br/>
1066
+ * - `networkidle2` : consider navigation to be finished when there are no
1067
+ * more than 2 network connections for at least `500` ms.
1068
+ *
1069
+ * - `referer` : Referer header value. If provided it will take preference
1070
+ * over the referer header value set by
1071
+ * {@link Page.setExtraHTTPHeaders |page.setExtraHTTPHeaders()}.
1072
+ *
1073
+ * `page.goto` will throw an error if:
1074
+ * - there's an SSL error (e.g. in case of self-signed certificates).
1075
+ * - target URL is invalid.
1076
+ * - the timeout is exceeded during navigation.
1077
+ * - the remote server does not respond or is unreachable.
1078
+ * - the main resource failed to load.
1079
+ *
1080
+ * `page.goto` will not throw an error when any valid HTTP status code is
1081
+ * returned by the remote server, including 404 "Not Found" and 500
1082
+ * "Internal Server Error". The status code for such responses can be
1083
+ * retrieved by calling response.status().
1084
+ *
1085
+ * NOTE: `page.goto` either throws an error or returns a main resource
1086
+ * response. The only exceptions are navigation to about:blank or navigation
1087
+ * to the same URL with a different hash, which would succeed and return null.
1088
+ *
1089
+ * NOTE: Headless mode doesn't support navigation to a PDF document. See the
1090
+ * {@link https://bugs.chromium.org/p/chromium/issues/detail?id=761295
1091
+ * | upstream issue}.
1092
+ *
1093
+ * Shortcut for {@link Frame.goto | page.mainFrame().goto(url, options)}.
1094
+ */
1095
+ goto(url: string, options?: WaitForOptions & {
1096
+ referer?: string;
1097
+ }): Promise<HTTPResponse>;
1098
+ /**
1099
+ * @param options - Navigation parameters which might have the following
1100
+ * properties:
1101
+ * @returns Promise which resolves to the main resource response. In case of
1102
+ * multiple redirects, the navigation will resolve with the response of the
1103
+ * last redirect.
1104
+ * @remarks
1105
+ * The argument `options` might have the following properties:
1106
+ *
1107
+ * - `timeout` : Maximum navigation time in milliseconds, defaults to 30
1108
+ * seconds, pass 0 to disable timeout. The default value can be changed by
1109
+ * using the
1110
+ * {@link Page.setDefaultNavigationTimeout |
1111
+ * page.setDefaultNavigationTimeout(timeout)}
1112
+ * or {@link Page.setDefaultTimeout | page.setDefaultTimeout(timeout)}
1113
+ * methods.
1114
+ *
1115
+ * - `waitUntil`: When to consider navigation succeeded, defaults to `load`.
1116
+ * Given an array of event strings, navigation is considered to be
1117
+ * successful after all events have been fired. Events can be either:<br/>
1118
+ * - `load` : consider navigation to be finished when the load event is 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
+ reload(options?: WaitForOptions): Promise<HTTPResponse | null>;
1127
+ /**
1128
+ * This resolves when the page navigates to a new URL or reloads. It is useful
1129
+ * when you run code that will indirectly cause the page to navigate. Consider
1130
+ * this example:
1131
+ * ```js
1132
+ * const [response] = await Promise.all([
1133
+ * page.waitForNavigation(), // The promise resolves after navigation has finished
1134
+ * page.click('a.my-link'), // Clicking the link will indirectly cause a navigation
1135
+ * ]);
1136
+ * ```
1137
+ *
1138
+ * @param options - Navigation parameters which might have the following properties:
1139
+ * @returns Promise which resolves to the main resource response. In case of
1140
+ * multiple redirects, the navigation will resolve with the response of the
1141
+ * last redirect. In case of navigation to a different anchor or navigation
1142
+ * due to History API usage, the navigation will resolve with `null`.
1143
+ * @remarks
1144
+ * NOTE: Usage of the
1145
+ * {@link https://developer.mozilla.org/en-US/docs/Web/API/History_API | History API}
1146
+ * to change the URL is considered a navigation.
1147
+ *
1148
+ * Shortcut for
1149
+ * {@link Frame.waitForNavigation | page.mainFrame().waitForNavigation(options)}.
1150
+ */
1151
+ waitForNavigation(options?: WaitForOptions): Promise<HTTPResponse | null>;
1152
+ private _sessionClosePromise;
1153
+ /**
1154
+ * @param urlOrPredicate - A URL or predicate to wait for
1155
+ * @param options - Optional waiting parameters
1156
+ * @returns Promise which resolves to the matched response
1157
+ * @example
1158
+ * ```js
1159
+ * const firstResponse = await page.waitForResponse(
1160
+ * 'https://example.com/resource'
1161
+ * );
1162
+ * const finalResponse = await page.waitForResponse(
1163
+ * (response) =>
1164
+ * response.url() === 'https://example.com' && response.status() === 200
1165
+ * );
1166
+ * const finalResponse = await page.waitForResponse(async (response) => {
1167
+ * return (await response.text()).includes('<html>');
1168
+ * });
1169
+ * return finalResponse.ok();
1170
+ * ```
1171
+ * @remarks
1172
+ * Optional Waiting Parameters have:
1173
+ *
1174
+ * - `timeout`: Maximum wait time in milliseconds, defaults to `30` seconds, pass
1175
+ * `0` to disable the timeout. The default value can be changed by using the
1176
+ * {@link Page.setDefaultTimeout} method.
1177
+ */
1178
+ waitForRequest(urlOrPredicate: string | ((req: HTTPRequest) => boolean | Promise<boolean>), options?: {
1179
+ timeout?: number;
1180
+ }): Promise<HTTPRequest>;
1181
+ /**
1182
+ * @param urlOrPredicate - A URL or predicate to wait for.
1183
+ * @param options - Optional waiting parameters
1184
+ * @returns Promise which resolves to the matched response.
1185
+ * @example
1186
+ * ```js
1187
+ * const firstResponse = await page.waitForResponse(
1188
+ * 'https://example.com/resource'
1189
+ * );
1190
+ * const finalResponse = await page.waitForResponse(
1191
+ * (response) =>
1192
+ * response.url() === 'https://example.com' && response.status() === 200
1193
+ * );
1194
+ * const finalResponse = await page.waitForResponse(async (response) => {
1195
+ * return (await response.text()).includes('<html>');
1196
+ * });
1197
+ * return finalResponse.ok();
1198
+ * ```
1199
+ * @remarks
1200
+ * Optional Parameter have:
1201
+ *
1202
+ * - `timeout`: Maximum wait time in milliseconds, defaults to `30` seconds,
1203
+ * pass `0` to disable the timeout. The default value can be changed by using
1204
+ * the {@link Page.setDefaultTimeout} method.
1205
+ */
1206
+ waitForResponse(urlOrPredicate: string | ((res: HTTPResponse) => boolean | Promise<boolean>), options?: {
1207
+ timeout?: number;
1208
+ }): Promise<HTTPResponse>;
1209
+ /**
1210
+ * @param options - Optional waiting parameters
1211
+ * @returns Promise which resolves when network is idle
1212
+ */
1213
+ waitForNetworkIdle(options?: {
1214
+ idleTime?: number;
1215
+ timeout?: number;
1216
+ }): Promise<void>;
1217
+ /**
1218
+ * @param urlOrPredicate - A URL or predicate to wait for.
1219
+ * @param options - Optional waiting parameters
1220
+ * @returns Promise which resolves to the matched frame.
1221
+ * @example
1222
+ * ```js
1223
+ * const frame = await page.waitForFrame(async (frame) => {
1224
+ * return frame.name() === 'Test';
1225
+ * });
1226
+ * ```
1227
+ * @remarks
1228
+ * Optional Parameter have:
1229
+ *
1230
+ * - `timeout`: Maximum wait time in milliseconds, defaults to `30` seconds,
1231
+ * pass `0` to disable the timeout. The default value can be changed by using
1232
+ * the {@link Page.setDefaultTimeout} method.
1233
+ */
1234
+ waitForFrame(urlOrPredicate: string | ((frame: Frame) => boolean | Promise<boolean>), options?: {
1235
+ timeout?: number;
1236
+ }): Promise<Frame>;
1237
+ /**
1238
+ * This method navigate to the previous page in history.
1239
+ * @param options - Navigation parameters
1240
+ * @returns Promise which resolves to the main resource response. In case of
1241
+ * multiple redirects, the navigation will resolve with the response of the
1242
+ * last redirect. If can not go back, resolves to `null`.
1243
+ * @remarks
1244
+ * The argument `options` might have the following properties:
1245
+ *
1246
+ * - `timeout` : Maximum navigation time in milliseconds, defaults to 30
1247
+ * seconds, pass 0 to disable timeout. The default value can be changed by
1248
+ * using the
1249
+ * {@link Page.setDefaultNavigationTimeout
1250
+ * | page.setDefaultNavigationTimeout(timeout)}
1251
+ * or {@link Page.setDefaultTimeout | page.setDefaultTimeout(timeout)}
1252
+ * methods.
1253
+ *
1254
+ * - `waitUntil` : When to consider navigation succeeded, defaults to `load`.
1255
+ * Given an array of event strings, navigation is considered to be
1256
+ * successful after all events have been fired. Events can be either:<br/>
1257
+ * - `load` : consider navigation to be finished when the load event is fired.<br/>
1258
+ * - `domcontentloaded` : consider navigation to be finished when the
1259
+ * DOMContentLoaded event is fired.<br/>
1260
+ * - `networkidle0` : consider navigation to be finished when there are no
1261
+ * more than 0 network connections for at least `500` ms.<br/>
1262
+ * - `networkidle2` : consider navigation to be finished when there are no
1263
+ * more than 2 network connections for at least `500` ms.
1264
+ */
1265
+ goBack(options?: WaitForOptions): Promise<HTTPResponse | null>;
1266
+ /**
1267
+ * This method navigate to the next page in history.
1268
+ * @param options - Navigation Parameter
1269
+ * @returns Promise which resolves to the main resource response. In case of
1270
+ * multiple redirects, the navigation will resolve with the response of the
1271
+ * last redirect. If can not go forward, resolves to `null`.
1272
+ * @remarks
1273
+ * The argument `options` might have the following properties:
1274
+ *
1275
+ * - `timeout` : Maximum navigation time in milliseconds, defaults to 30
1276
+ * seconds, pass 0 to disable timeout. The default value can be changed by
1277
+ * using the
1278
+ * {@link Page.setDefaultNavigationTimeout
1279
+ * | page.setDefaultNavigationTimeout(timeout)}
1280
+ * or {@link Page.setDefaultTimeout | page.setDefaultTimeout(timeout)}
1281
+ * methods.
1282
+ *
1283
+ * - `waitUntil`: When to consider navigation succeeded, defaults to `load`.
1284
+ * Given an array of event strings, navigation is considered to be
1285
+ * successful after all events have been fired. Events can be either:<br/>
1286
+ * - `load` : consider navigation to be finished when the load event is fired.<br/>
1287
+ * - `domcontentloaded` : consider navigation to be finished when the
1288
+ * DOMContentLoaded event is fired.<br/>
1289
+ * - `networkidle0` : consider navigation to be finished when there are no
1290
+ * more than 0 network connections for at least `500` ms.<br/>
1291
+ * - `networkidle2` : consider navigation to be finished when there are no
1292
+ * more than 2 network connections for at least `500` ms.
1293
+ */
1294
+ goForward(options?: WaitForOptions): Promise<HTTPResponse | null>;
1295
+ private _go;
1296
+ /**
1297
+ * Brings page to front (activates tab).
1298
+ */
1299
+ bringToFront(): Promise<void>;
1300
+ /**
1301
+ * Emulates given device metrics and user agent. This method is a shortcut for
1302
+ * calling two methods: {@link Page.setUserAgent} and {@link Page.setViewport}
1303
+ * To aid emulation, Puppeteer provides a list of device descriptors that can
1304
+ * be obtained via the {@link Puppeteer.devices} `page.emulate` will resize
1305
+ * the page. A lot of websites don't expect phones to change size, so you
1306
+ * should emulate before navigating to the page.
1307
+ * @example
1308
+ * ```js
1309
+ * const puppeteer = require('puppeteer');
1310
+ * const iPhone = puppeteer.devices['iPhone 6'];
1311
+ * (async () => {
1312
+ * const browser = await puppeteer.launch();
1313
+ * const page = await browser.newPage();
1314
+ * await page.emulate(iPhone);
1315
+ * await page.goto('https://www.google.com');
1316
+ * // other actions...
1317
+ * await browser.close();
1318
+ * })();
1319
+ * ```
1320
+ * @remarks List of all available devices is available in the source code:
1321
+ * {@link https://github.com/puppeteer/puppeteer/blob/main/src/common/DeviceDescriptors.ts | src/common/DeviceDescriptors.ts}.
1322
+ */
1323
+ emulate(options: {
1324
+ viewport: Viewport;
1325
+ userAgent: string;
1326
+ }): Promise<void>;
1327
+ /**
1328
+ * @param enabled - Whether or not to enable JavaScript on the page.
1329
+ * @returns
1330
+ * @remarks
1331
+ * NOTE: changing this value won't affect scripts that have already been run.
1332
+ * It will take full effect on the next navigation.
1333
+ */
1334
+ setJavaScriptEnabled(enabled: boolean): Promise<void>;
1335
+ /**
1336
+ * Toggles bypassing page's Content-Security-Policy.
1337
+ * @param enabled - sets bypassing of page's Content-Security-Policy.
1338
+ * @remarks
1339
+ * NOTE: CSP bypassing happens at the moment of CSP initialization rather than
1340
+ * evaluation. Usually, this means that `page.setBypassCSP` should be called
1341
+ * before navigating to the domain.
1342
+ */
1343
+ setBypassCSP(enabled: boolean): Promise<void>;
1344
+ /**
1345
+ * @param type - Changes the CSS media type of the page. The only allowed
1346
+ * values are `screen`, `print` and `null`. Passing `null` disables CSS media
1347
+ * emulation.
1348
+ * @example
1349
+ * ```
1350
+ * await page.evaluate(() => matchMedia('screen').matches);
1351
+ * // → true
1352
+ * await page.evaluate(() => matchMedia('print').matches);
1353
+ * // → false
1354
+ *
1355
+ * await page.emulateMediaType('print');
1356
+ * await page.evaluate(() => matchMedia('screen').matches);
1357
+ * // → false
1358
+ * await page.evaluate(() => matchMedia('print').matches);
1359
+ * // → true
1360
+ *
1361
+ * await page.emulateMediaType(null);
1362
+ * await page.evaluate(() => matchMedia('screen').matches);
1363
+ * // → true
1364
+ * await page.evaluate(() => matchMedia('print').matches);
1365
+ * // → false
1366
+ * ```
1367
+ */
1368
+ emulateMediaType(type?: string): Promise<void>;
1369
+ /**
1370
+ * Enables CPU throttling to emulate slow CPUs.
1371
+ * @param factor - slowdown factor (1 is no throttle, 2 is 2x slowdown, etc).
1372
+ */
1373
+ emulateCPUThrottling(factor: number | null): Promise<void>;
1374
+ /**
1375
+ * @param features - `<?Array<Object>>` Given an array of media feature
1376
+ * objects, emulates CSS media features on the page. Each media feature object
1377
+ * must have the following properties:
1378
+ * @example
1379
+ * ```js
1380
+ * await page.emulateMediaFeatures([
1381
+ * { name: 'prefers-color-scheme', value: 'dark' },
1382
+ * ]);
1383
+ * await page.evaluate(() => matchMedia('(prefers-color-scheme: dark)').matches);
1384
+ * // → true
1385
+ * await page.evaluate(() => matchMedia('(prefers-color-scheme: light)').matches);
1386
+ * // → false
1387
+ *
1388
+ * await page.emulateMediaFeatures([
1389
+ * { name: 'prefers-reduced-motion', value: 'reduce' },
1390
+ * ]);
1391
+ * await page.evaluate(
1392
+ * () => matchMedia('(prefers-reduced-motion: reduce)').matches
1393
+ * );
1394
+ * // → true
1395
+ * await page.evaluate(
1396
+ * () => matchMedia('(prefers-reduced-motion: no-preference)').matches
1397
+ * );
1398
+ * // → false
1399
+ *
1400
+ * await page.emulateMediaFeatures([
1401
+ * { name: 'prefers-color-scheme', value: 'dark' },
1402
+ * { name: 'prefers-reduced-motion', value: 'reduce' },
1403
+ * ]);
1404
+ * await page.evaluate(() => matchMedia('(prefers-color-scheme: dark)').matches);
1405
+ * // → true
1406
+ * await page.evaluate(() => matchMedia('(prefers-color-scheme: light)').matches);
1407
+ * // → false
1408
+ * await page.evaluate(
1409
+ * () => matchMedia('(prefers-reduced-motion: reduce)').matches
1410
+ * );
1411
+ * // → true
1412
+ * await page.evaluate(
1413
+ * () => matchMedia('(prefers-reduced-motion: no-preference)').matches
1414
+ * );
1415
+ * // → false
1416
+ *
1417
+ * await page.emulateMediaFeatures([{ name: 'color-gamut', value: 'p3' }]);
1418
+ * await page.evaluate(() => matchMedia('(color-gamut: srgb)').matches);
1419
+ * // → true
1420
+ * await page.evaluate(() => matchMedia('(color-gamut: p3)').matches);
1421
+ * // → true
1422
+ * await page.evaluate(() => matchMedia('(color-gamut: rec2020)').matches);
1423
+ * // → false
1424
+ * ```
1425
+ */
1426
+ emulateMediaFeatures(features?: MediaFeature[]): Promise<void>;
1427
+ /**
1428
+ * @param timezoneId - Changes the timezone of the page. See
1429
+ * {@link https://source.chromium.org/chromium/chromium/deps/icu.git/+/faee8bc70570192d82d2978a71e2a615788597d1:source/data/misc/metaZones.txt | ICU’s metaZones.txt}
1430
+ * for a list of supported timezone IDs. Passing
1431
+ * `null` disables timezone emulation.
1432
+ */
1433
+ emulateTimezone(timezoneId?: string): Promise<void>;
1434
+ /**
1435
+ * Emulates the idle state.
1436
+ * If no arguments set, clears idle state emulation.
1437
+ *
1438
+ * @example
1439
+ * ```js
1440
+ * // set idle emulation
1441
+ * await page.emulateIdleState({isUserActive: true, isScreenUnlocked: false});
1442
+ *
1443
+ * // do some checks here
1444
+ * ...
1445
+ *
1446
+ * // clear idle emulation
1447
+ * await page.emulateIdleState();
1448
+ * ```
1449
+ *
1450
+ * @param overrides - Mock idle state. If not set, clears idle overrides
1451
+ */
1452
+ emulateIdleState(overrides?: {
1453
+ isUserActive: boolean;
1454
+ isScreenUnlocked: boolean;
1455
+ }): Promise<void>;
1456
+ /**
1457
+ * Simulates the given vision deficiency on the page.
1458
+ *
1459
+ * @example
1460
+ * ```js
1461
+ * const puppeteer = require('puppeteer');
1462
+ *
1463
+ * (async () => {
1464
+ * const browser = await puppeteer.launch();
1465
+ * const page = await browser.newPage();
1466
+ * await page.goto('https://v8.dev/blog/10-years');
1467
+ *
1468
+ * await page.emulateVisionDeficiency('achromatopsia');
1469
+ * await page.screenshot({ path: 'achromatopsia.png' });
1470
+ *
1471
+ * await page.emulateVisionDeficiency('deuteranopia');
1472
+ * await page.screenshot({ path: 'deuteranopia.png' });
1473
+ *
1474
+ * await page.emulateVisionDeficiency('blurredVision');
1475
+ * await page.screenshot({ path: 'blurred-vision.png' });
1476
+ *
1477
+ * await browser.close();
1478
+ * })();
1479
+ * ```
1480
+ *
1481
+ * @param type - the type of deficiency to simulate, or `'none'` to reset.
1482
+ */
1483
+ emulateVisionDeficiency(type?: Protocol.Emulation.SetEmulatedVisionDeficiencyRequest['type']): Promise<void>;
1484
+ /**
1485
+ * `page.setViewport` will resize the page. A lot of websites don't expect
1486
+ * phones to change size, so you should set the viewport before navigating to
1487
+ * the page.
1488
+ *
1489
+ * In the case of multiple pages in a single browser, each page can have its
1490
+ * own viewport size.
1491
+ * @example
1492
+ * ```js
1493
+ * const page = await browser.newPage();
1494
+ * await page.setViewport({
1495
+ * width: 640,
1496
+ * height: 480,
1497
+ * deviceScaleFactor: 1,
1498
+ * });
1499
+ * await page.goto('https://example.com');
1500
+ * ```
1501
+ *
1502
+ * @param viewport -
1503
+ * @remarks
1504
+ * Argument viewport have following properties:
1505
+ *
1506
+ * - `width`: page width in pixels. required
1507
+ *
1508
+ * - `height`: page height in pixels. required
1509
+ *
1510
+ * - `deviceScaleFactor`: Specify device scale factor (can be thought of as
1511
+ * DPR). Defaults to `1`.
1512
+ *
1513
+ * - `isMobile`: Whether the meta viewport tag is taken into account. Defaults
1514
+ * to `false`.
1515
+ *
1516
+ * - `hasTouch`: Specifies if viewport supports touch events. Defaults to `false`
1517
+ *
1518
+ * - `isLandScape`: Specifies if viewport is in landscape mode. Defaults to false.
1519
+ *
1520
+ * NOTE: in certain cases, setting viewport will reload the page in order to
1521
+ * set the isMobile or hasTouch properties.
1522
+ */
1523
+ setViewport(viewport: Viewport): Promise<void>;
1524
+ /**
1525
+ * @returns
1526
+ *
1527
+ * - `width`: page's width in pixels
1528
+ *
1529
+ * - `height`: page's height in pixels
1530
+ *
1531
+ * - `deviceScalarFactor`: Specify device scale factor (can be though of as
1532
+ * dpr). Defaults to `1`.
1533
+ *
1534
+ * - `isMobile`: Whether the meta viewport tag is taken into account. Defaults
1535
+ * to `false`.
1536
+ *
1537
+ * - `hasTouch`: Specifies if viewport supports touch events. Defaults to
1538
+ * `false`.
1539
+ *
1540
+ * - `isLandScape`: Specifies if viewport is in landscape mode. Defaults to
1541
+ * `false`.
1542
+ */
1543
+ viewport(): Viewport | null;
1544
+ /**
1545
+ * @remarks
1546
+ *
1547
+ * Evaluates a function in the page's context and returns the result.
1548
+ *
1549
+ * If the function passed to `page.evaluteHandle` returns a Promise, the
1550
+ * function will wait for the promise to resolve and return its value.
1551
+ *
1552
+ * @example
1553
+ *
1554
+ * ```js
1555
+ * const result = await frame.evaluate(() => {
1556
+ * return Promise.resolve(8 * 7);
1557
+ * });
1558
+ * console.log(result); // prints "56"
1559
+ * ```
1560
+ *
1561
+ * You can pass a string instead of a function (although functions are
1562
+ * recommended as they are easier to debug and use with TypeScript):
1563
+ *
1564
+ * @example
1565
+ * ```
1566
+ * const aHandle = await page.evaluate('1 + 2');
1567
+ * ```
1568
+ *
1569
+ * To get the best TypeScript experience, you should pass in as the
1570
+ * generic the type of `pageFunction`:
1571
+ *
1572
+ * ```
1573
+ * const aHandle = await page.evaluate<() => number>(() => 2);
1574
+ * ```
1575
+ *
1576
+ * @example
1577
+ *
1578
+ * {@link ElementHandle} instances (including {@link JSHandle}s) can be passed
1579
+ * as arguments to the `pageFunction`:
1580
+ *
1581
+ * ```
1582
+ * const bodyHandle = await page.$('body');
1583
+ * const html = await page.evaluate(body => body.innerHTML, bodyHandle);
1584
+ * await bodyHandle.dispose();
1585
+ * ```
1586
+ *
1587
+ * @param pageFunction - a function that is run within the page
1588
+ * @param args - arguments to be passed to the pageFunction
1589
+ *
1590
+ * @returns the return value of `pageFunction`.
1591
+ */
1592
+ evaluate<T extends EvaluateFn>(pageFunction: T, ...args: SerializableOrJSHandle[]): Promise<UnwrapPromiseLike<EvaluateFnReturnType<T>>>;
1593
+ /**
1594
+ * Adds a function which would be invoked in one of the following scenarios:
1595
+ *
1596
+ * - whenever the page is navigated
1597
+ *
1598
+ * - whenever the child frame is attached or navigated. In this case, the
1599
+ * function is invoked in the context of the newly attached frame.
1600
+ *
1601
+ * The function is invoked after the document was created but before any of
1602
+ * its scripts were run. This is useful to amend the JavaScript environment,
1603
+ * e.g. to seed `Math.random`.
1604
+ * @param pageFunction - Function to be evaluated in browser context
1605
+ * @param args - Arguments to pass to `pageFunction`
1606
+ * @example
1607
+ * An example of overriding the navigator.languages property before the page loads:
1608
+ * ```js
1609
+ * // preload.js
1610
+ *
1611
+ * // overwrite the `languages` property to use a custom getter
1612
+ * Object.defineProperty(navigator, 'languages', {
1613
+ * get: function () {
1614
+ * return ['en-US', 'en', 'bn'];
1615
+ * },
1616
+ * });
1617
+ *
1618
+ * // In your puppeteer script, assuming the preload.js file is
1619
+ * in same folder of our script
1620
+ * const preloadFile = fs.readFileSync('./preload.js', 'utf8');
1621
+ * await page.evaluateOnNewDocument(preloadFile);
1622
+ * ```
1623
+ */
1624
+ evaluateOnNewDocument(pageFunction: Function | string, ...args: unknown[]): Promise<void>;
1625
+ /**
1626
+ * Toggles ignoring cache for each request based on the enabled state. By
1627
+ * default, caching is enabled.
1628
+ * @param enabled - sets the `enabled` state of cache
1629
+ */
1630
+ setCacheEnabled(enabled?: boolean): Promise<void>;
1631
+ /**
1632
+ * @remarks
1633
+ * Options object which might have the following properties:
1634
+ *
1635
+ * - `path` : The file path to save the image to. The screenshot type
1636
+ * will be inferred from file extension. If `path` is a relative path, then
1637
+ * it is resolved relative to
1638
+ * {@link https://nodejs.org/api/process.html#process_process_cwd
1639
+ * | current working directory}.
1640
+ * If no path is provided, the image won't be saved to the disk.
1641
+ *
1642
+ * - `type` : Specify screenshot type, can be either `jpeg` or `png`.
1643
+ * Defaults to 'png'.
1644
+ *
1645
+ * - `quality` : The quality of the image, between 0-100. Not
1646
+ * applicable to `png` images.
1647
+ *
1648
+ * - `fullPage` : When true, takes a screenshot of the full
1649
+ * scrollable page. Defaults to `false`
1650
+ *
1651
+ * - `clip` : An object which specifies clipping region of the page.
1652
+ * Should have the following fields:<br/>
1653
+ * - `x` : x-coordinate of top-left corner of clip area.<br/>
1654
+ * - `y` : y-coordinate of top-left corner of clip area.<br/>
1655
+ * - `width` : width of clipping area.<br/>
1656
+ * - `height` : height of clipping area.
1657
+ *
1658
+ * - `omitBackground` : Hides default white background and allows
1659
+ * capturing screenshots with transparency. Defaults to `false`
1660
+ *
1661
+ * - `encoding` : The encoding of the image, can be either base64 or
1662
+ * binary. Defaults to `binary`.
1663
+ *
1664
+ *
1665
+ * NOTE: Screenshots take at least 1/6 second on OS X. See
1666
+ * {@link https://crbug.com/741689} for discussion.
1667
+ * @returns Promise which resolves to buffer or a base64 string (depending on
1668
+ * the value of `encoding`) with captured screenshot.
1669
+ */
1670
+ screenshot(options?: ScreenshotOptions): Promise<Buffer | string>;
1671
+ private _screenshotTask;
1672
+ /**
1673
+ * Generatees a PDF of the page with the `print` CSS media type.
1674
+ * @remarks
1675
+ *
1676
+ * NOTE: PDF generation is only supported in Chrome headless mode.
1677
+ *
1678
+ * To generate a PDF with the `screen` media type, call
1679
+ * {@link Page.emulateMediaType | `page.emulateMediaType('screen')`} before
1680
+ * calling `page.pdf()`.
1681
+ *
1682
+ * By default, `page.pdf()` generates a pdf with modified colors for printing.
1683
+ * Use the
1684
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-print-color-adjust | `-webkit-print-color-adjust`}
1685
+ * property to force rendering of exact colors.
1686
+ *
1687
+ *
1688
+ * @param options - options for generating the PDF.
1689
+ */
1690
+ createPDFStream(options?: PDFOptions): Promise<Readable>;
1691
+ /**
1692
+ * @param options -
1693
+ * @returns
1694
+ */
1695
+ pdf(options?: PDFOptions): Promise<Buffer>;
1696
+ /**
1697
+ * @returns The page's title
1698
+ * @remarks
1699
+ * Shortcut for {@link Frame.title | page.mainFrame().title()}.
1700
+ */
1701
+ title(): Promise<string>;
1702
+ close(options?: {
1703
+ runBeforeUnload?: boolean;
1704
+ }): Promise<void>;
1705
+ /**
1706
+ * Indicates that the page has been closed.
1707
+ * @returns
1708
+ */
1709
+ isClosed(): boolean;
1710
+ get mouse(): Mouse;
1711
+ /**
1712
+ * This method fetches an element with `selector`, scrolls it into view if
1713
+ * needed, and then uses {@link Page.mouse} to click in the center of the
1714
+ * element. If there's no element matching `selector`, the method throws an
1715
+ * error.
1716
+ * @remarks Bear in mind that if `click()` triggers a navigation event and
1717
+ * there's a separate `page.waitForNavigation()` promise to be resolved, you
1718
+ * may end up with a race condition that yields unexpected results. The
1719
+ * correct pattern for click and wait for navigation is the following:
1720
+ * ```js
1721
+ * const [response] = await Promise.all([
1722
+ * page.waitForNavigation(waitOptions),
1723
+ * page.click(selector, clickOptions),
1724
+ * ]);
1725
+ * ```
1726
+ * Shortcut for {@link Frame.click | page.mainFrame().click(selector[, options]) }.
1727
+ * @param selector - A `selector` to search for element to click. If there are
1728
+ * multiple elements satisfying the `selector`, the first will be clicked
1729
+ * @param options - `Object`
1730
+ * @returns Promise which resolves when the element matching `selector` is
1731
+ * successfully clicked. The Promise will be rejected if there is no element
1732
+ * matching `selector`.
1733
+ */
1734
+ click(selector: string, options?: {
1735
+ delay?: number;
1736
+ button?: MouseButton;
1737
+ clickCount?: number;
1738
+ }): Promise<void>;
1739
+ /**
1740
+ * This method fetches an element with `selector` and focuses it. If there's no
1741
+ * element matching `selector`, the method throws an error.
1742
+ * @param selector - A
1743
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | selector }
1744
+ * of an element to focus. If there are multiple elements satisfying the
1745
+ * selector, the first will be focused.
1746
+ * @returns Promise which resolves when the element matching selector is
1747
+ * successfully focused. The promise will be rejected if there is no element
1748
+ * matching selector.
1749
+ * @remarks
1750
+ * Shortcut for {@link Frame.focus | page.mainFrame().focus(selector)}.
1751
+ */
1752
+ focus(selector: string): Promise<void>;
1753
+ /**
1754
+ * This method fetches an element with `selector`, scrolls it into view if
1755
+ * needed, and then uses {@link Page.mouse} to hover over the center of the element.
1756
+ * If there's no element matching `selector`, the method throws an error.
1757
+ * @param selector - A
1758
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | selector}
1759
+ * to search for element to hover. If there are multiple elements satisfying
1760
+ * the selector, the first will be hovered.
1761
+ * @returns Promise which resolves when the element matching `selector` is
1762
+ * successfully hovered. Promise gets rejected if there's no element matching
1763
+ * `selector`.
1764
+ * @remarks
1765
+ * Shortcut for {@link Page.hover | page.mainFrame().hover(selector)}.
1766
+ */
1767
+ hover(selector: string): Promise<void>;
1768
+ /**
1769
+ * Triggers a `change` and `input` event once all the provided options have been
1770
+ * selected. If there's no `<select>` element matching `selector`, the method
1771
+ * throws an error.
1772
+ *
1773
+ * @example
1774
+ * ```js
1775
+ * page.select('select#colors', 'blue'); // single selection
1776
+ * page.select('select#colors', 'red', 'green', 'blue'); // multiple selections
1777
+ * ```
1778
+ * @param selector - A
1779
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | Selector}
1780
+ * to query the page for
1781
+ * @param values - Values of options to select. If the `<select>` has the
1782
+ * `multiple` attribute, all values are considered, otherwise only the first one
1783
+ * is taken into account.
1784
+ * @returns
1785
+ *
1786
+ * @remarks
1787
+ * Shortcut for {@link Frame.select | page.mainFrame().select()}
1788
+ */
1789
+ select(selector: string, ...values: string[]): Promise<string[]>;
1790
+ /**
1791
+ * This method fetches an element with `selector`, scrolls it into view if
1792
+ * needed, and then uses {@link Page.touchscreen} to tap in the center of the element.
1793
+ * If there's no element matching `selector`, the method throws an error.
1794
+ * @param selector - A
1795
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | Selector}
1796
+ * to search for element to tap. If there are multiple elements satisfying the
1797
+ * selector, the first will be tapped.
1798
+ * @returns
1799
+ * @remarks
1800
+ * Shortcut for {@link Frame.tap | page.mainFrame().tap(selector)}.
1801
+ */
1802
+ tap(selector: string): Promise<void>;
1803
+ /**
1804
+ * Sends a `keydown`, `keypress/input`, and `keyup` event for each character
1805
+ * in the text.
1806
+ *
1807
+ * To press a special key, like `Control` or `ArrowDown`, use {@link Keyboard.press}.
1808
+ * @example
1809
+ * ```
1810
+ * await page.type('#mytextarea', 'Hello');
1811
+ * // Types instantly
1812
+ * await page.type('#mytextarea', 'World', { delay: 100 });
1813
+ * // Types slower, like a user
1814
+ * ```
1815
+ * @param selector - A
1816
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | selector}
1817
+ * of an element to type into. If there are multiple elements satisfying the
1818
+ * selector, the first will be used.
1819
+ * @param text - A text to type into a focused element.
1820
+ * @param options - have property `delay` which is the Time to wait between
1821
+ * key presses in milliseconds. Defaults to `0`.
1822
+ * @returns
1823
+ * @remarks
1824
+ */
1825
+ type(selector: string, text: string, options?: {
1826
+ delay: number;
1827
+ }): Promise<void>;
1828
+ /**
1829
+ * @remarks
1830
+ *
1831
+ * This method behaves differently depending on the first parameter. If it's a
1832
+ * `string`, it will be treated as a `selector` or `xpath` (if the string
1833
+ * starts with `//`). This method then is a shortcut for
1834
+ * {@link Page.waitForSelector} or {@link Page.waitForXPath}.
1835
+ *
1836
+ * If the first argument is a function this method is a shortcut for
1837
+ * {@link Page.waitForFunction}.
1838
+ *
1839
+ * If the first argument is a `number`, it's treated as a timeout in
1840
+ * milliseconds and the method returns a promise which resolves after the
1841
+ * timeout.
1842
+ *
1843
+ * @param selectorOrFunctionOrTimeout - a selector, predicate or timeout to
1844
+ * wait for.
1845
+ * @param options - optional waiting parameters.
1846
+ * @param args - arguments to pass to `pageFunction`.
1847
+ *
1848
+ * @deprecated Don't use this method directly. Instead use the more explicit
1849
+ * methods available: {@link Page.waitForSelector},
1850
+ * {@link Page.waitForXPath}, {@link Page.waitForFunction} or
1851
+ * {@link Page.waitForTimeout}.
1852
+ */
1853
+ waitFor(selectorOrFunctionOrTimeout: string | number | Function, options?: {
1854
+ visible?: boolean;
1855
+ hidden?: boolean;
1856
+ timeout?: number;
1857
+ polling?: string | number;
1858
+ }, ...args: SerializableOrJSHandle[]): Promise<JSHandle>;
1859
+ /**
1860
+ * Causes your script to wait for the given number of milliseconds.
1861
+ *
1862
+ * @remarks
1863
+ *
1864
+ * It's generally recommended to not wait for a number of seconds, but instead
1865
+ * use {@link Page.waitForSelector}, {@link Page.waitForXPath} or
1866
+ * {@link Page.waitForFunction} to wait for exactly the conditions you want.
1867
+ *
1868
+ * @example
1869
+ *
1870
+ * Wait for 1 second:
1871
+ *
1872
+ * ```
1873
+ * await page.waitForTimeout(1000);
1874
+ * ```
1875
+ *
1876
+ * @param milliseconds - the number of milliseconds to wait.
1877
+ */
1878
+ waitForTimeout(milliseconds: number): Promise<void>;
1879
+ /**
1880
+ * Wait for the `selector` to appear in page. If at the moment of calling the
1881
+ * method the `selector` already exists, the method will return immediately. If
1882
+ * the `selector` doesn't appear after the `timeout` milliseconds of waiting, the
1883
+ * function will throw.
1884
+ *
1885
+ * This method works across navigations:
1886
+ * ```js
1887
+ * const puppeteer = require('puppeteer');
1888
+ * (async () => {
1889
+ * const browser = await puppeteer.launch();
1890
+ * const page = await browser.newPage();
1891
+ * let currentURL;
1892
+ * page
1893
+ * .waitForSelector('img')
1894
+ * .then(() => console.log('First URL with image: ' + currentURL));
1895
+ * for (currentURL of [
1896
+ * 'https://example.com',
1897
+ * 'https://google.com',
1898
+ * 'https://bbc.com',
1899
+ * ]) {
1900
+ * await page.goto(currentURL);
1901
+ * }
1902
+ * await browser.close();
1903
+ * })();
1904
+ * ```
1905
+ * @param selector - A
1906
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | selector}
1907
+ * of an element to wait for
1908
+ * @param options - Optional waiting parameters
1909
+ * @returns Promise which resolves when element specified by selector string
1910
+ * is added to DOM. Resolves to `null` if waiting for hidden: `true` and
1911
+ * selector is not found in DOM.
1912
+ * @remarks
1913
+ * The optional Parameter in Arguments `options` are :
1914
+ *
1915
+ * - `Visible`: A boolean wait for element to be present in DOM and to be
1916
+ * visible, i.e. to not have `display: none` or `visibility: hidden` CSS
1917
+ * properties. Defaults to `false`.
1918
+ *
1919
+ * - `hidden`: ait for element to not be found in the DOM or to be hidden,
1920
+ * i.e. have `display: none` or `visibility: hidden` CSS properties. Defaults to
1921
+ * `false`.
1922
+ *
1923
+ * - `timeout`: maximum time to wait for in milliseconds. Defaults to `30000`
1924
+ * (30 seconds). Pass `0` to disable timeout. The default value can be changed
1925
+ * by using the {@link Page.setDefaultTimeout} method.
1926
+ */
1927
+ waitForSelector(selector: string, options?: {
1928
+ visible?: boolean;
1929
+ hidden?: boolean;
1930
+ timeout?: number;
1931
+ }): Promise<ElementHandle | null>;
1932
+ /**
1933
+ * Wait for the `xpath` to appear in page. If at the moment of calling the
1934
+ * method the `xpath` already exists, the method will return immediately. If
1935
+ * the `xpath` doesn't appear after the `timeout` milliseconds of waiting, the
1936
+ * function will throw.
1937
+ *
1938
+ * This method works across navigation
1939
+ * ```js
1940
+ * const puppeteer = require('puppeteer');
1941
+ * (async () => {
1942
+ * const browser = await puppeteer.launch();
1943
+ * const page = await browser.newPage();
1944
+ * let currentURL;
1945
+ * page
1946
+ * .waitForXPath('//img')
1947
+ * .then(() => console.log('First URL with image: ' + currentURL));
1948
+ * for (currentURL of [
1949
+ * 'https://example.com',
1950
+ * 'https://google.com',
1951
+ * 'https://bbc.com',
1952
+ * ]) {
1953
+ * await page.goto(currentURL);
1954
+ * }
1955
+ * await browser.close();
1956
+ * })();
1957
+ * ```
1958
+ * @param xpath - A
1959
+ * {@link https://developer.mozilla.org/en-US/docs/Web/XPath | xpath} of an
1960
+ * element to wait for
1961
+ * @param options - Optional waiting parameters
1962
+ * @returns Promise which resolves when element specified by xpath string is
1963
+ * added to DOM. Resolves to `null` if waiting for `hidden: true` and xpath is
1964
+ * not found in DOM.
1965
+ * @remarks
1966
+ * The optional Argument `options` have properties:
1967
+ *
1968
+ * - `visible`: A boolean to wait for element to be present in DOM and to be
1969
+ * visible, i.e. to not have `display: none` or `visibility: hidden` CSS
1970
+ * properties. Defaults to `false`.
1971
+ *
1972
+ * - `hidden`: A boolean wait for element to not be found in the DOM or to be
1973
+ * hidden, i.e. have `display: none` or `visibility: hidden` CSS properties.
1974
+ * Defaults to `false`.
1975
+ *
1976
+ * - `timeout`: A number which is maximum time to wait for in milliseconds.
1977
+ * Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default
1978
+ * value can be changed by using the {@link Page.setDefaultTimeout} method.
1979
+ */
1980
+ waitForXPath(xpath: string, options?: {
1981
+ visible?: boolean;
1982
+ hidden?: boolean;
1983
+ timeout?: number;
1984
+ }): Promise<ElementHandle | null>;
1985
+ /**
1986
+ * The `waitForFunction` can be used to observe viewport size change:
1987
+ *
1988
+ * ```
1989
+ * const puppeteer = require('puppeteer');
1990
+ * (async () => {
1991
+ * const browser = await puppeteer.launch();
1992
+ * const page = await browser.newPage();
1993
+ * const watchDog = page.waitForFunction('window.innerWidth < 100');
1994
+ * await page.setViewport({ width: 50, height: 50 });
1995
+ * await watchDog;
1996
+ * await browser.close();
1997
+ * })();
1998
+ * ```
1999
+ * To pass arguments from node.js to the predicate of `page.waitForFunction` function:
2000
+ * ```
2001
+ * const selector = '.foo';
2002
+ * await page.waitForFunction(
2003
+ * (selector) => !!document.querySelector(selector),
2004
+ * {},
2005
+ * selector
2006
+ * );
2007
+ * ```
2008
+ * The predicate of `page.waitForFunction` can be asynchronous too:
2009
+ * ```
2010
+ * const username = 'github-username';
2011
+ * await page.waitForFunction(
2012
+ * async (username) => {
2013
+ * const githubResponse = await fetch(
2014
+ * `https://api.github.com/users/${username}`
2015
+ * );
2016
+ * const githubUser = await githubResponse.json();
2017
+ * // show the avatar
2018
+ * const img = document.createElement('img');
2019
+ * img.src = githubUser.avatar_url;
2020
+ * // wait 3 seconds
2021
+ * await new Promise((resolve, reject) => setTimeout(resolve, 3000));
2022
+ * img.remove();
2023
+ * },
2024
+ * {},
2025
+ * username
2026
+ * );
2027
+ * ```
2028
+ * @param pageFunction - Function to be evaluated in browser context
2029
+ * @param options - Optional waiting parameters
2030
+ * @param args - Arguments to pass to `pageFunction`
2031
+ * @returns Promise which resolves when the `pageFunction` returns a truthy
2032
+ * value. It resolves to a JSHandle of the truthy value.
2033
+ *
2034
+ * The optional waiting parameter can be:
2035
+ *
2036
+ * - `Polling`: An interval at which the `pageFunction` is executed, defaults to
2037
+ * `raf`. If `polling` is a number, then it is treated as an interval in
2038
+ * milliseconds at which the function would be executed. If polling is a
2039
+ * string, then it can be one of the following values:<br/>
2040
+ * - `raf`: to constantly execute `pageFunction` in `requestAnimationFrame`
2041
+ * callback. This is the tightest polling mode which is suitable to
2042
+ * observe styling changes.<br/>
2043
+ * - `mutation`: to execute pageFunction on every DOM mutation.
2044
+ *
2045
+ * - `timeout`: maximum time to wait for in milliseconds. Defaults to `30000`
2046
+ * (30 seconds). Pass `0` to disable timeout. The default value can be changed
2047
+ * by using the
2048
+ * {@link Page.setDefaultTimeout | page.setDefaultTimeout(timeout)} method.
2049
+ *
2050
+ */
2051
+ waitForFunction(pageFunction: Function | string, options?: {
2052
+ timeout?: number;
2053
+ polling?: string | number;
2054
+ }, ...args: SerializableOrJSHandle[]): Promise<JSHandle>;
2055
+ }
2056
2056
  //# sourceMappingURL=Page.d.ts.map