chrome-devtools-frontend 1.0.923302 → 1.0.925026

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 (320) hide show
  1. package/config/gni/all_devtools_files.gni +0 -1
  2. package/config/gni/devtools_grd_files.gni +1 -3
  3. package/config/gni/devtools_image_files.gni +1 -1
  4. package/front_end/Images/src/copy_icon.svg +79 -0
  5. package/front_end/core/common/EventTarget.ts +22 -27
  6. package/front_end/core/common/Object.ts +28 -26
  7. package/front_end/core/common/Settings.ts +9 -8
  8. package/front_end/core/i18n/locales/en-US.json +18 -39
  9. package/front_end/core/i18n/locales/en-XL.json +18 -39
  10. package/front_end/core/platform/string-utilities.ts +4 -3
  11. package/front_end/core/sdk/EmulationModel.ts +1 -1
  12. package/front_end/core/sdk/NetworkManager.ts +1 -2
  13. package/front_end/core/sdk/ResourceTreeModel.ts +2 -3
  14. package/front_end/core/sdk/RuntimeModel.ts +2 -3
  15. package/front_end/core/sdk/SourceMap.ts +74 -31
  16. package/front_end/core/sdk/TargetManager.ts +9 -8
  17. package/front_end/core/sdk/TracingManager.ts +1 -1
  18. package/front_end/entrypoints/main/MainImpl.ts +1 -1
  19. package/front_end/entrypoints/node_main/NodeMain.ts +1 -1
  20. package/front_end/generated/InspectorBackendCommands.js +9 -5
  21. package/front_end/generated/protocol-mapping.d.ts +1 -0
  22. package/front_end/generated/protocol-proxy-api.d.ts +1 -0
  23. package/front_end/generated/protocol.d.ts +13 -2
  24. package/front_end/legacy_test_runner/application_test_runner/application_test_runner.js +0 -1
  25. package/front_end/models/bindings/CompilerScriptMapping.ts +24 -6
  26. package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +30 -30
  27. package/front_end/models/extensions/ExtensionServer.ts +10 -13
  28. package/front_end/models/workspace/WorkspaceImpl.ts +1 -1
  29. package/front_end/models/workspace_diff/WorkspaceDiff.ts +24 -20
  30. package/front_end/panels/animation/AnimationModel.ts +6 -1
  31. package/front_end/panels/animation/AnimationTimeline.ts +2 -2
  32. package/front_end/panels/application/AppManifestView.ts +58 -20
  33. package/front_end/panels/application/ApplicationPanelCacheSection.ts +1 -59
  34. package/front_end/panels/application/ApplicationPanelSidebar.ts +15 -163
  35. package/front_end/panels/application/BackgroundServiceModel.ts +6 -1
  36. package/front_end/panels/application/BackgroundServiceView.ts +4 -4
  37. package/front_end/panels/application/DOMStorageItemsView.ts +2 -2
  38. package/front_end/panels/application/DatabaseModel.ts +6 -1
  39. package/front_end/panels/application/DatabaseTableView.ts +1 -1
  40. package/front_end/panels/application/IndexedDBModel.ts +9 -1
  41. package/front_end/panels/application/IndexedDBViews.ts +7 -8
  42. package/front_end/panels/application/ServiceWorkerCacheViews.ts +2 -2
  43. package/front_end/panels/application/ServiceWorkersView.ts +3 -3
  44. package/front_end/panels/application/StorageItemsView.ts +2 -3
  45. package/front_end/panels/application/StorageView.ts +0 -13
  46. package/front_end/panels/application/appManifestView.css +8 -0
  47. package/front_end/panels/application/application-legacy.ts +0 -3
  48. package/front_end/panels/application/application.ts +0 -4
  49. package/front_end/panels/browser_debugger/ObjectEventListenersSidebarPane.ts +1 -1
  50. package/front_end/panels/console/ConsolePinPane.ts +1 -2
  51. package/front_end/panels/console/ConsoleSidebar.ts +2 -2
  52. package/front_end/panels/console/ConsoleView.ts +7 -6
  53. package/front_end/panels/console/ConsoleViewMessage.ts +4 -3
  54. package/front_end/panels/coverage/CoverageModel.ts +9 -3
  55. package/front_end/panels/coverage/CoverageView.ts +3 -2
  56. package/front_end/panels/css_overview/CSSOverviewModel.ts +1 -1
  57. package/front_end/panels/elements/ColorSwatchPopoverIcon.ts +1 -1
  58. package/front_end/panels/elements/ComputedStyleWidget.ts +2 -2
  59. package/front_end/panels/elements/ElementsPanel.ts +3 -3
  60. package/front_end/panels/elements/StylePropertyTreeElement.ts +14 -4
  61. package/front_end/panels/elements/StylesSidebarPane.ts +4 -2
  62. package/front_end/panels/input/InputModel.ts +1 -1
  63. package/front_end/panels/issues/ComboBoxOfCheckBoxes.ts +2 -4
  64. package/front_end/panels/issues/HiddenIssuesRow.ts +7 -12
  65. package/front_end/panels/layers/LayerTreeModel.ts +6 -1
  66. package/front_end/panels/layers/LayersPanel.ts +3 -4
  67. package/front_end/panels/lighthouse/LighthouseReportRenderer.ts +1 -0
  68. package/front_end/panels/media/MainView.ts +22 -19
  69. package/front_end/panels/media/MediaModel.ts +15 -7
  70. package/front_end/panels/media/PlayerMessagesView.ts +2 -4
  71. package/front_end/panels/network/NetworkPanel.ts +6 -6
  72. package/front_end/panels/network/RequestHeadersView.ts +7 -0
  73. package/front_end/panels/network/ResourceWebSocketFrameView.ts +3 -2
  74. package/front_end/panels/network/networkLogView.css +5 -0
  75. package/front_end/panels/profiler/HeapProfileView.ts +14 -4
  76. package/front_end/panels/profiler/HeapSnapshotDataGrids.ts +14 -1
  77. package/front_end/panels/profiler/HeapSnapshotGridNodes.ts +11 -3
  78. package/front_end/panels/profiler/HeapSnapshotView.ts +67 -32
  79. package/front_end/panels/profiler/LiveHeapProfileView.ts +2 -2
  80. package/front_end/panels/profiler/ProfileHeader.ts +11 -2
  81. package/front_end/panels/profiler/ProfileView.ts +3 -3
  82. package/front_end/panels/profiler/ProfilesPanel.ts +7 -6
  83. package/front_end/panels/screencast/InputModel.ts +1 -1
  84. package/front_end/panels/screencast/ScreencastView.ts +1 -1
  85. package/front_end/panels/security/SecurityModel.ts +5 -1
  86. package/front_end/panels/security/SecurityPanel.ts +1 -2
  87. package/front_end/panels/sensors/SensorsView.ts +3 -2
  88. package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +6 -3
  89. package/front_end/panels/sources/CSSPlugin.ts +1 -1
  90. package/front_end/panels/sources/DebuggerPlugin.ts +6 -4
  91. package/front_end/panels/sources/InplaceFormatterEditorAction.ts +1 -1
  92. package/front_end/panels/sources/ScriptFormatterEditorAction.ts +1 -1
  93. package/front_end/panels/sources/SourcesPanel.ts +2 -2
  94. package/front_end/panels/timeline/TimelineFlameChartView.ts +5 -8
  95. package/front_end/panels/timeline/TimelineUIUtils.ts +1 -2
  96. package/front_end/panels/web_audio/AudioContextSelector.ts +4 -6
  97. package/front_end/panels/web_audio/WebAudioModel.ts +19 -1
  98. package/front_end/panels/web_audio/WebAudioView.ts +28 -22
  99. package/front_end/panels/web_audio/graph_visualizer/graph_visualizer.ts +0 -7
  100. package/front_end/panels/web_audio/web_audio.ts +1 -23
  101. package/front_end/panels/webauthn/WebauthnPane.ts +20 -10
  102. package/front_end/third_party/lighthouse/lighthouse-dt-bundle.js +598 -595
  103. package/front_end/third_party/lighthouse/locales/en-US.json +6 -0
  104. package/front_end/third_party/lighthouse/locales/en-XL.json +6 -0
  105. package/front_end/third_party/lighthouse/report/bundle.d.ts +25 -4
  106. package/front_end/third_party/lighthouse/report/bundle.js +111 -22
  107. package/front_end/third_party/lighthouse/report-assets/report.css +120 -12
  108. package/front_end/third_party/lighthouse/report-assets/report.js +10 -10
  109. package/front_end/third_party/puppeteer/README.chromium +1 -1
  110. package/front_end/third_party/puppeteer/package/CHANGELOG.md +66 -0
  111. package/front_end/third_party/puppeteer/package/README.md +34 -13
  112. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/AriaQueryHandler.d.ts.map +1 -1
  113. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/AriaQueryHandler.js +5 -5
  114. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/AriaQueryHandler.js.map +1 -1
  115. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.d.ts +18 -2
  116. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.d.ts.map +1 -1
  117. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.js +8 -3
  118. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.js.map +1 -1
  119. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.d.ts +2 -2
  120. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.js +2 -2
  121. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.d.ts +22 -6
  122. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.d.ts.map +1 -1
  123. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.js +14 -7
  124. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.js.map +1 -1
  125. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.d.ts +1 -0
  126. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.d.ts.map +1 -1
  127. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.js +10 -6
  128. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.js.map +1 -1
  129. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.d.ts.map +1 -1
  130. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.js +120 -0
  131. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.js.map +1 -1
  132. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EvalTypes.d.ts +1 -1
  133. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EvalTypes.d.ts.map +1 -1
  134. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.d.ts.map +1 -1
  135. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.js +2 -2
  136. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.js.map +1 -1
  137. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPRequest.d.ts +62 -3
  138. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPRequest.d.ts.map +1 -1
  139. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPRequest.js +131 -3
  140. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPRequest.js.map +1 -1
  141. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Input.d.ts +40 -0
  142. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Input.d.ts.map +1 -1
  143. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Input.js +76 -0
  144. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Input.js.map +1 -1
  145. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/JSHandle.d.ts +53 -2
  146. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/JSHandle.d.ts.map +1 -1
  147. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/JSHandle.js +82 -13
  148. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/JSHandle.js.map +1 -1
  149. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/NetworkManager.d.ts +2 -1
  150. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/NetworkManager.d.ts.map +1 -1
  151. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/NetworkManager.js +14 -2
  152. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/NetworkManager.js.map +1 -1
  153. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/PDFOptions.d.ts +5 -0
  154. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/PDFOptions.d.ts.map +1 -1
  155. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/PDFOptions.js.map +1 -1
  156. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Page.d.ts +1053 -29
  157. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Page.d.ts.map +1 -1
  158. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Page.js +1114 -22
  159. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Page.js.map +1 -1
  160. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Tracing.d.ts.map +1 -1
  161. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Tracing.js +17 -6
  162. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Tracing.js.map +1 -1
  163. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/assert.d.ts +1 -0
  164. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/assert.d.ts.map +1 -1
  165. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/assert.js +6 -1
  166. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/assert.js.map +1 -1
  167. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/helper.d.ts +21 -5
  168. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/helper.d.ts.map +1 -1
  169. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/helper.js +47 -28
  170. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/helper.js.map +1 -1
  171. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/global.d.ts +17 -0
  172. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/global.d.ts.map +1 -0
  173. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/global.js +3 -0
  174. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/global.js.map +1 -0
  175. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserFetcher.d.ts.map +1 -1
  176. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserFetcher.js +9 -10
  177. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserFetcher.js.map +1 -1
  178. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserRunner.d.ts.map +1 -1
  179. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserRunner.js +5 -2
  180. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserRunner.js.map +1 -1
  181. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/LaunchOptions.d.ts +10 -2
  182. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/LaunchOptions.d.ts.map +1 -1
  183. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Launcher.d.ts +1 -1
  184. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Launcher.d.ts.map +1 -1
  185. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Launcher.js +83 -6
  186. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Launcher.js.map +1 -1
  187. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/NodeWebSocketTransport.d.ts.map +1 -1
  188. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/NodeWebSocketTransport.js +7 -1
  189. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/NodeWebSocketTransport.js.map +1 -1
  190. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Puppeteer.d.ts +1 -1
  191. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Puppeteer.d.ts.map +1 -1
  192. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Puppeteer.js +2 -2
  193. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Puppeteer.js.map +1 -1
  194. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/install.d.ts.map +1 -1
  195. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/install.js +17 -3
  196. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/install.js.map +1 -1
  197. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +1 -1
  198. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/AriaQueryHandler.d.ts.map +1 -1
  199. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/AriaQueryHandler.js +5 -5
  200. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/AriaQueryHandler.js.map +1 -1
  201. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Browser.d.ts +18 -2
  202. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Browser.d.ts.map +1 -1
  203. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Browser.js +8 -3
  204. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Browser.js.map +1 -1
  205. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Connection.d.ts +2 -2
  206. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Connection.js +2 -2
  207. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Coverage.d.ts +22 -6
  208. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Coverage.d.ts.map +1 -1
  209. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Coverage.js +14 -7
  210. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Coverage.js.map +1 -1
  211. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/DOMWorld.d.ts +1 -0
  212. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/DOMWorld.d.ts.map +1 -1
  213. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/DOMWorld.js +10 -6
  214. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/DOMWorld.js.map +1 -1
  215. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/DeviceDescriptors.d.ts.map +1 -1
  216. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/DeviceDescriptors.js +120 -0
  217. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/DeviceDescriptors.js.map +1 -1
  218. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/EvalTypes.d.ts +1 -1
  219. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/EvalTypes.d.ts.map +1 -1
  220. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/FrameManager.d.ts.map +1 -1
  221. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/FrameManager.js +2 -2
  222. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/FrameManager.js.map +1 -1
  223. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/HTTPRequest.d.ts +62 -3
  224. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/HTTPRequest.d.ts.map +1 -1
  225. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/HTTPRequest.js +131 -3
  226. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/HTTPRequest.js.map +1 -1
  227. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Input.d.ts +40 -0
  228. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Input.d.ts.map +1 -1
  229. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Input.js +76 -0
  230. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Input.js.map +1 -1
  231. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/JSHandle.d.ts +53 -2
  232. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/JSHandle.d.ts.map +1 -1
  233. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/JSHandle.js +82 -13
  234. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/JSHandle.js.map +1 -1
  235. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/NetworkManager.d.ts +2 -1
  236. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/NetworkManager.d.ts.map +1 -1
  237. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/NetworkManager.js +14 -2
  238. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/NetworkManager.js.map +1 -1
  239. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/PDFOptions.d.ts +5 -0
  240. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/PDFOptions.d.ts.map +1 -1
  241. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/PDFOptions.js.map +1 -1
  242. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Page.d.ts +1053 -29
  243. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Page.d.ts.map +1 -1
  244. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Page.js +1115 -23
  245. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Page.js.map +1 -1
  246. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Tracing.d.ts.map +1 -1
  247. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Tracing.js +17 -6
  248. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Tracing.js.map +1 -1
  249. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/assert.d.ts +1 -0
  250. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/assert.d.ts.map +1 -1
  251. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/assert.js +4 -0
  252. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/assert.js.map +1 -1
  253. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/helper.d.ts +21 -5
  254. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/helper.d.ts.map +1 -1
  255. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/helper.js +32 -13
  256. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/helper.js.map +1 -1
  257. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/global.d.ts +17 -0
  258. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/global.d.ts.map +1 -0
  259. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/global.js +2 -0
  260. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/global.js.map +1 -0
  261. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserFetcher.d.ts.map +1 -1
  262. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserFetcher.js +9 -10
  263. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserFetcher.js.map +1 -1
  264. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserRunner.d.ts.map +1 -1
  265. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserRunner.js +5 -2
  266. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserRunner.js.map +1 -1
  267. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/LaunchOptions.d.ts +10 -2
  268. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/LaunchOptions.d.ts.map +1 -1
  269. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Launcher.d.ts +1 -1
  270. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Launcher.d.ts.map +1 -1
  271. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Launcher.js +83 -6
  272. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Launcher.js.map +1 -1
  273. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/NodeWebSocketTransport.d.ts.map +1 -1
  274. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/NodeWebSocketTransport.js +7 -1
  275. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/NodeWebSocketTransport.js.map +1 -1
  276. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Puppeteer.d.ts +1 -1
  277. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Puppeteer.d.ts.map +1 -1
  278. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Puppeteer.js +2 -2
  279. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Puppeteer.js.map +1 -1
  280. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/install.d.ts.map +1 -1
  281. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/install.js +17 -3
  282. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/install.js.map +1 -1
  283. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +1 -1
  284. package/front_end/third_party/puppeteer/package/lib/types.d.ts +1382 -19726
  285. package/front_end/third_party/puppeteer/package/package.json +9 -6
  286. package/front_end/third_party/wasmparser/README.chromium +2 -2
  287. package/front_end/third_party/wasmparser/package/CHANGELOG.md +13 -0
  288. package/front_end/third_party/wasmparser/package/dist/cjs/WasmDis.js +50 -10
  289. package/front_end/third_party/wasmparser/package/dist/cjs/WasmDis.js.map +1 -1
  290. package/front_end/third_party/wasmparser/package/dist/cjs/WasmParser.d.ts +21 -4
  291. package/front_end/third_party/wasmparser/package/dist/cjs/WasmParser.js +76 -8
  292. package/front_end/third_party/wasmparser/package/dist/cjs/WasmParser.js.map +1 -1
  293. package/front_end/third_party/wasmparser/package/dist/esm/WasmDis.js +50 -10
  294. package/front_end/third_party/wasmparser/package/dist/esm/WasmDis.js.map +1 -1
  295. package/front_end/third_party/wasmparser/package/dist/esm/WasmParser.d.ts +21 -4
  296. package/front_end/third_party/wasmparser/package/dist/esm/WasmParser.js +76 -8
  297. package/front_end/third_party/wasmparser/package/dist/esm/WasmParser.js.map +1 -1
  298. package/front_end/third_party/wasmparser/package/package.json +1 -1
  299. package/front_end/third_party/wasmparser/package/src/WasmDis.ts +47 -10
  300. package/front_end/third_party/wasmparser/package/src/WasmParser.ts +75 -5
  301. package/front_end/ui/components/icon_button/iconButton.css +4 -0
  302. package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorPane.ts +2 -6
  303. package/front_end/ui/legacy/FilterBar.ts +1 -1
  304. package/front_end/ui/legacy/GlassPane.ts +1 -3
  305. package/front_end/ui/legacy/SplitWidget.ts +1 -1
  306. package/front_end/ui/legacy/UIUtils.ts +3 -4
  307. package/front_end/ui/legacy/components/color_picker/ContrastDetails.ts +3 -3
  308. package/front_end/ui/legacy/components/color_picker/Spectrum.ts +1 -1
  309. package/front_end/ui/legacy/components/data_grid/DataGrid.ts +15 -6
  310. package/front_end/ui/legacy/components/data_grid/ViewportDataGrid.ts +7 -1
  311. package/front_end/ui/legacy/components/inline_editor/SwatchPopoverHelper.ts +6 -2
  312. package/front_end/ui/legacy/components/perf_ui/OverviewGrid.ts +3 -3
  313. package/front_end/ui/legacy/components/utils/TargetDetachedDialog.ts +1 -1
  314. package/front_end/ui/legacy/reportView.css +1 -0
  315. package/package.json +1 -1
  316. package/scripts/build/rollup.config.js +0 -5
  317. package/front_end/Images/src/exclamation_mark_circle_icon.svg +0 -65
  318. package/front_end/legacy_test_runner/application_test_runner/AppcacheTestRunner.js +0 -220
  319. package/front_end/panels/application/ApplicationCacheItemsView.ts +0 -335
  320. package/front_end/panels/application/ApplicationCacheModel.ts +0 -206
@@ -14,30 +14,29 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  /// <reference types="node" />
17
- import { Protocol } from 'devtools-protocol';
18
-
19
- import { Accessibility } from './Accessibility.js';
20
- import { Browser, BrowserContext } from './Browser.js';
17
+ import type { Readable } from 'stream';
18
+ import { EventEmitter } from './EventEmitter.js';
21
19
  import { CDPSession } from './Connection.js';
22
- import { ConsoleMessage } from './ConsoleMessage.js';
23
- import { Coverage } from './Coverage.js';
24
20
  import { Dialog } from './Dialog.js';
25
- import { EvaluateFn, EvaluateFnReturnType, EvaluateHandleFn, SerializableOrJSHandle, UnwrapPromiseLike , WrapElementHandle} from './EvalTypes.js';
26
- import { EventEmitter } from './EventEmitter.js';
27
- import { FileChooser } from './FileChooser.js';
28
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';
29
31
  import { HTTPRequest } from './HTTPRequest.js';
30
32
  import { HTTPResponse } from './HTTPResponse.js';
31
- import { Keyboard, Mouse, MouseButton , Touchscreen} from './Input.js';
32
- import { ElementHandle , JSHandle} from './JSHandle.js';
33
+ import { Accessibility } from './Accessibility.js';
34
+ import { FileChooser } from './FileChooser.js';
35
+ import { ConsoleMessage } from './ConsoleMessage.js';
33
36
  import { PuppeteerLifeCycleEvent } from './LifecycleWatcher.js';
34
- import { Credentials, NetworkConditions } from './NetworkManager.js';
37
+ import { Protocol } from 'devtools-protocol';
38
+ import { SerializableOrJSHandle, EvaluateHandleFn, WrapElementHandle, EvaluateFn, EvaluateFnReturnType, UnwrapPromiseLike } from './EvalTypes.js';
35
39
  import { PDFOptions } from './PDFOptions.js';
36
- import { Viewport } from './PuppeteerViewport.js';
37
- import { Target } from './Target.js';
38
- import { Tracing } from './Tracing.js';
39
- import { WebWorker } from './WebWorker.js';
40
-
41
40
  /**
42
41
  * @public
43
42
  */
@@ -126,7 +125,7 @@ export interface ScreenshotOptions {
126
125
  /**
127
126
  * @defaultValue 'png'
128
127
  */
129
- type?: 'png' | 'jpeg';
128
+ type?: 'png' | 'jpeg' | 'webp';
130
129
  /**
131
130
  * The file path to save the image to. The screenshot type will be inferred
132
131
  * from file extension. If path is a relative path, then it is resolved
@@ -169,7 +168,9 @@ export interface ScreenshotOptions {
169
168
  * @public
170
169
  */
171
170
  export declare const enum PageEmittedEvents {
172
- /** Emitted when the page closes. */
171
+ /** Emitted when the page closes.
172
+ * @eventProperty
173
+ */
173
174
  Close = "close",
174
175
  /**
175
176
  * Emitted when JavaScript within the page calls one of console API methods,
@@ -404,12 +405,17 @@ export declare class Page extends EventEmitter {
404
405
  private _workers;
405
406
  private _fileChooserInterceptors;
406
407
  private _disconnectPromise?;
408
+ private _userDragInterceptionEnabled;
407
409
  /**
408
410
  * @internal
409
411
  */
410
412
  constructor(client: CDPSession, target: Target, ignoreHTTPSErrors: boolean);
411
413
  private _initialize;
412
414
  private _onFileChooser;
415
+ /**
416
+ * @returns `true` if drag events are being intercepted, `false` otherwise.
417
+ */
418
+ isDragInterceptionEnabled(): boolean;
413
419
  /**
414
420
  * @returns `true` if the page has JavaScript enabled, `false` otherwise.
415
421
  */
@@ -420,17 +426,33 @@ export declare class Page extends EventEmitter {
420
426
  on<K extends keyof PageEventObject>(eventName: K, handler: (event: PageEventObject[K]) => void): EventEmitter;
421
427
  once<K extends keyof PageEventObject>(eventName: K, handler: (event: PageEventObject[K]) => void): EventEmitter;
422
428
  /**
429
+ * This method is typically coupled with an action that triggers file
430
+ * choosing. The following example clicks a button that issues a file chooser
431
+ * and then responds with `/tmp/myfile.pdf` as if a user has selected this file.
432
+ *
433
+ * ```js
434
+ * const [fileChooser] = await Promise.all([
435
+ * page.waitForFileChooser(),
436
+ * page.click('#upload-file-button'),
437
+ * // some button that triggers file selection
438
+ * ]);
439
+ * await fileChooser.accept(['/tmp/myfile.pdf']);
440
+ * ```
441
+ *
442
+ * NOTE: This must be called before the file chooser is launched. It will not
443
+ * return a currently active file chooser.
423
444
  * @param options - Optional waiting parameters
424
445
  * @returns Resolves after a page requests a file picker.
446
+ * @remarks
447
+ * NOTE: In non-headless Chromium, this method results in the native file picker
448
+ * dialog `not showing up` for the user.
425
449
  */
426
450
  waitForFileChooser(options?: WaitTimeoutOptions): Promise<FileChooser>;
427
451
  /**
428
452
  * Sets the page's geolocation.
429
- *
430
453
  * @remarks
431
- * Consider using {@link BrowserContext.overridePermissions} to grant
454
+ * NOTE: Consider using {@link BrowserContext.overridePermissions} to grant
432
455
  * permissions for the page to read its geolocation.
433
- *
434
456
  * @example
435
457
  * ```js
436
458
  * await page.setGeolocation({latitude: 59.95, longitude: 30.31667});
@@ -442,17 +464,24 @@ export declare class Page extends EventEmitter {
442
464
  */
443
465
  target(): Target;
444
466
  /**
445
- * @returns The browser this page belongs to.
467
+ * Get the CDP session client the page belongs to.
468
+ * @internal
469
+ */
470
+ client(): CDPSession;
471
+ /**
472
+ * Get the browser the page belongs to.
446
473
  */
447
474
  browser(): Browser;
448
475
  /**
449
- * @returns The browser context that the page belongs to
476
+ * Get the browser context that the page belongs to.
450
477
  */
451
478
  browserContext(): BrowserContext;
452
479
  private _onTargetCrashed;
453
480
  private _onLogEntryAdded;
454
481
  /**
455
482
  * @returns The page's main frame.
483
+ * @remarks
484
+ * Page is guaranteed to have a main frame which persists during navigations.
456
485
  */
457
486
  mainFrame(): Frame;
458
487
  get keyboard(): Keyboard;
@@ -466,8 +495,11 @@ export declare class Page extends EventEmitter {
466
495
  frames(): Frame[];
467
496
  /**
468
497
  * @returns all of the dedicated
469
- * {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API | WebWorkers}
498
+ * {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API |
499
+ * WebWorkers}
470
500
  * associated with the page.
501
+ * @remarks
502
+ * NOTE: This does not contain ServiceWorkers
471
503
  */
472
504
  workers(): WebWorker[];
473
505
  /**
@@ -500,14 +532,63 @@ export declare class Page extends EventEmitter {
500
532
  * await browser.close();
501
533
  * })();
502
534
  * ```
535
+ * NOTE: Enabling request interception disables page caching.
503
536
  */
504
537
  setRequestInterception(value: boolean): Promise<void>;
538
+ /**
539
+ * @param enabled - Whether to enable drag interception.
540
+ *
541
+ * @remarks
542
+ * Activating drag interception enables the `Input.drag`,
543
+ * methods This provides the capability to capture drag events emitted
544
+ * on the page, which can then be used to simulate drag-and-drop.
545
+ */
546
+ setDragInterception(enabled: boolean): Promise<void>;
505
547
  /**
506
548
  * @param enabled - When `true`, enables offline mode for the page.
549
+ * @remarks
550
+ * NOTE: while this method sets the network connection to offline, it does
551
+ * not change the parameters used in [page.emulateNetworkConditions(networkConditions)]
552
+ * (#pageemulatenetworkconditionsnetworkconditions)
507
553
  */
508
554
  setOfflineMode(enabled: boolean): Promise<void>;
555
+ /**
556
+ * @param networkConditions - Passing `null` disables network condition emulation.
557
+ * @example
558
+ * ```js
559
+ * const puppeteer = require('puppeteer');
560
+ * const slow3G = puppeteer.networkConditions['Slow 3G'];
561
+ *
562
+ * (async () => {
563
+ * const browser = await puppeteer.launch();
564
+ * const page = await browser.newPage();
565
+ * await page.emulateNetworkConditions(slow3G);
566
+ * await page.goto('https://www.google.com');
567
+ * // other actions...
568
+ * await browser.close();
569
+ * })();
570
+ * ```
571
+ * @remarks
572
+ * NOTE: This does not affect WebSockets and WebRTC PeerConnections (see
573
+ * https://crbug.com/563644). To set the page offline, you can use
574
+ * [page.setOfflineMode(enabled)](#pagesetofflinemodeenabled).
575
+ */
509
576
  emulateNetworkConditions(networkConditions: NetworkConditions | null): Promise<void>;
510
577
  /**
578
+ * This setting will change the default maximum navigation time for the
579
+ * following methods and related shortcuts:
580
+ *
581
+ * - {@link Page.goBack | page.goBack(options)}
582
+ *
583
+ * - {@link Page.goForward | page.goForward(options)}
584
+ *
585
+ * - {@link Page.goto | page.goto(url,options)}
586
+ *
587
+ * - {@link Page.reload | page.reload(options)}
588
+ *
589
+ * - {@link Page.setContent | page.setContent(html,options)}
590
+ *
591
+ * - {@link Page.waitForNavigation | page.waitForNavigation(options)}
511
592
  * @param timeout - Maximum navigation time in milliseconds.
512
593
  */
513
594
  setDefaultNavigationTimeout(timeout: number): void;
@@ -582,6 +663,9 @@ export declare class Page extends EventEmitter {
582
663
  * given prototype.
583
664
  *
584
665
  * @remarks
666
+ * Shortcut for
667
+ * {@link ExecutionContext.queryObjects |
668
+ * page.mainFrame().executionContext().queryObjects(prototypeHandle)}.
585
669
  *
586
670
  * @example
587
671
  *
@@ -598,6 +682,8 @@ export declare class Page extends EventEmitter {
598
682
  * await mapPrototype.dispose();
599
683
  * ```
600
684
  * @param prototypeHandle - a handle to the object prototype.
685
+ * @returns Promise which resolves to a handle to an array of objects with
686
+ * this prototype.
601
687
  */
602
688
  queryObjects(prototypeHandle: JSHandle): Promise<JSHandle>;
603
689
  /**
@@ -722,7 +808,22 @@ export declare class Page extends EventEmitter {
722
808
  * returned.
723
809
  */
724
810
  $$eval<ReturnType>(selector: string, pageFunction: (elements: Element[], ...args: unknown[]) => ReturnType | Promise<ReturnType>, ...args: SerializableOrJSHandle[]): Promise<WrapElementHandle<ReturnType>>;
811
+ /**
812
+ * The method runs `document.querySelectorAll` within the page. If no elements
813
+ * match the selector, the return value resolves to `[]`.
814
+ * @remarks
815
+ * Shortcut for {@link Frame.$$ | Page.mainFrame().$$(selector) }.
816
+ * @param selector - A `selector` to query page for
817
+ */
725
818
  $$<T extends Element = Element>(selector: string): Promise<Array<ElementHandle<T>>>;
819
+ /**
820
+ * The method evaluates the XPath expression relative to the page document as
821
+ * its context node. If there are no such elements, the method resolves to an
822
+ * empty array.
823
+ * @remarks
824
+ * Shortcut for {@link Frame.$x | Page.mainFrame().$x(expression) }.
825
+ * @param expression - Expression to evaluate
826
+ */
726
827
  $x(expression: string): Promise<ElementHandle[]>;
727
828
  /**
728
829
  * If no URLs are specified, this method returns cookies for the current page
@@ -730,22 +831,155 @@ export declare class Page extends EventEmitter {
730
831
  */
731
832
  cookies(...urls: string[]): Promise<Protocol.Network.Cookie[]>;
732
833
  deleteCookie(...cookies: Protocol.Network.DeleteCookiesRequest[]): Promise<void>;
834
+ /**
835
+ * @example
836
+ * ```js
837
+ * await page.setCookie(cookieObject1, cookieObject2);
838
+ * ```
839
+ */
733
840
  setCookie(...cookies: Protocol.Network.CookieParam[]): Promise<void>;
841
+ /**
842
+ * Adds a `<script>` tag into the page with the desired URL or content.
843
+ * @remarks
844
+ * Shortcut for {@link Frame.addScriptTag | page.mainFrame().addScriptTag(options) }.
845
+ * @returns Promise which resolves to the added tag when the script's onload fires or
846
+ * when the script content was injected into frame.
847
+ */
734
848
  addScriptTag(options: {
735
849
  url?: string;
736
850
  path?: string;
737
851
  content?: string;
738
852
  type?: string;
853
+ id?: string;
739
854
  }): Promise<ElementHandle>;
855
+ /**
856
+ * Adds a `<link rel="stylesheet">` tag into the page with the desired URL or a
857
+ * `<style type="text/css">` tag with the content.
858
+ * @returns Promise which resolves to the added tag when the stylesheet's
859
+ * onload fires or when the CSS content was injected into frame.
860
+ */
740
861
  addStyleTag(options: {
741
862
  url?: string;
742
863
  path?: string;
743
864
  content?: string;
744
865
  }): Promise<ElementHandle>;
866
+ /**
867
+ * The method adds a function called `name` on the page's `window` object. When
868
+ * called, the function executes `puppeteerFunction` in node.js and returns a
869
+ * `Promise` which resolves to the return value of `puppeteerFunction`.
870
+ *
871
+ * If the puppeteerFunction returns a `Promise`, it will be awaited.
872
+ *
873
+ * NOTE: Functions installed via `page.exposeFunction` survive navigations.
874
+ * @param name - Name of the function on the window object
875
+ * @param puppeteerFunction - Callback function which will be called in
876
+ * Puppeteer's context.
877
+ * @example
878
+ * An example of adding an `md5` function into the page:
879
+ * ```js
880
+ * const puppeteer = require('puppeteer');
881
+ * const crypto = require('crypto');
882
+ *
883
+ * (async () => {
884
+ * const browser = await puppeteer.launch();
885
+ * const page = await browser.newPage();
886
+ * page.on('console', (msg) => console.log(msg.text()));
887
+ * await page.exposeFunction('md5', (text) =>
888
+ * crypto.createHash('md5').update(text).digest('hex')
889
+ * );
890
+ * await page.evaluate(async () => {
891
+ * // use window.md5 to compute hashes
892
+ * const myString = 'PUPPETEER';
893
+ * const myHash = await window.md5(myString);
894
+ * console.log(`md5 of ${myString} is ${myHash}`);
895
+ * });
896
+ * await browser.close();
897
+ * })();
898
+ * ```
899
+ * An example of adding a `window.readfile` function into the page:
900
+ * ```js
901
+ * const puppeteer = require('puppeteer');
902
+ * const fs = require('fs');
903
+ *
904
+ * (async () => {
905
+ * const browser = await puppeteer.launch();
906
+ * const page = await browser.newPage();
907
+ * page.on('console', (msg) => console.log(msg.text()));
908
+ * await page.exposeFunction('readfile', async (filePath) => {
909
+ * return new Promise((resolve, reject) => {
910
+ * fs.readFile(filePath, 'utf8', (err, text) => {
911
+ * if (err) reject(err);
912
+ * else resolve(text);
913
+ * });
914
+ * });
915
+ * });
916
+ * await page.evaluate(async () => {
917
+ * // use window.readfile to read contents of a file
918
+ * const content = await window.readfile('/etc/hosts');
919
+ * console.log(content);
920
+ * });
921
+ * await browser.close();
922
+ * })();
923
+ * ```
924
+ */
745
925
  exposeFunction(name: string, puppeteerFunction: Function): Promise<void>;
926
+ /**
927
+ * Provide credentials for `HTTP authentication`.
928
+ * @remarks To disable authentication, pass `null`.
929
+ */
746
930
  authenticate(credentials: Credentials): Promise<void>;
931
+ /**
932
+ * The extra HTTP headers will be sent with every request the page initiates.
933
+ * NOTE: All HTTP header names are lowercased. (HTTP headers are
934
+ * case-insensitive, so this shouldn’t impact your server code.)
935
+ * NOTE: page.setExtraHTTPHeaders does not guarantee the order of headers in
936
+ * the outgoing requests.
937
+ * @param headers - An object containing additional HTTP headers to be sent
938
+ * with every request. All header values must be strings.
939
+ * @returns
940
+ */
747
941
  setExtraHTTPHeaders(headers: Record<string, string>): Promise<void>;
748
- setUserAgent(userAgent: string): Promise<void>;
942
+ /**
943
+ * @param userAgent - Specific user agent to use in this page
944
+ * @param userAgentData - Specific user agent client hint data to use in this
945
+ * page
946
+ * @returns Promise which resolves when the user agent is set.
947
+ */
948
+ setUserAgent(userAgent: string, userAgentMetadata?: Protocol.Emulation.UserAgentMetadata): Promise<void>;
949
+ /**
950
+ * @returns Object containing metrics as key/value pairs.
951
+ *
952
+ * - `Timestamp` : The timestamp when the metrics sample was taken.
953
+ *
954
+ * - `Documents` : Number of documents in the page.
955
+ *
956
+ * - `Frames` : Number of frames in the page.
957
+ *
958
+ * - `JSEventListeners` : Number of events in the page.
959
+ *
960
+ * - `Nodes` : Number of DOM nodes in the page.
961
+ *
962
+ * - `LayoutCount` : Total number of full or partial page layout.
963
+ *
964
+ * - `RecalcStyleCount` : Total number of page style recalculations.
965
+ *
966
+ * - `LayoutDuration` : Combined durations of all page layouts.
967
+ *
968
+ * - `RecalcStyleDuration` : Combined duration of all page style
969
+ * recalculations.
970
+ *
971
+ * - `ScriptDuration` : Combined duration of JavaScript execution.
972
+ *
973
+ * - `TaskDuration` : Combined duration of all tasks performed by the browser.
974
+ *
975
+ *
976
+ * - `JSHeapUsedSize` : Used JavaScript heap size.
977
+ *
978
+ * - `JSHeapTotalSize` : Total JavaScript heap size.
979
+ * @remarks
980
+ * NOTE: All timestamps are in monotonic time: monotonically increasing time
981
+ * in seconds since an arbitrary point in the past.
982
+ */
749
983
  metrics(): Promise<Metrics>;
750
984
  private _emitMetrics;
751
985
  private _buildMetricsObject;
@@ -762,33 +996,411 @@ export declare class Page extends EventEmitter {
762
996
  * Hides default white background
763
997
  */
764
998
  private _setTransparentBackgroundColor;
999
+ /**
1000
+ *
1001
+ * @returns
1002
+ * @remarks Shortcut for
1003
+ * {@link Frame.url | page.mainFrame().url()}.
1004
+ */
765
1005
  url(): string;
766
1006
  content(): Promise<string>;
1007
+ /**
1008
+ * @param html - HTML markup to assign to the page.
1009
+ * @param options - Parameters that has some properties.
1010
+ * @remarks
1011
+ * The parameter `options` might have the following options.
1012
+ *
1013
+ * - `timeout` : Maximum time in milliseconds for resources to load, defaults
1014
+ * to 30 seconds, pass `0` to disable timeout. The default value can be
1015
+ * changed by using the
1016
+ * {@link Page.setDefaultNavigationTimeout |
1017
+ * page.setDefaultNavigationTimeout(timeout)}
1018
+ * or {@link Page.setDefaultTimeout | page.setDefaultTimeout(timeout)}
1019
+ * methods.
1020
+ *
1021
+ * - `waitUntil`: When to consider setting markup succeeded, defaults to `load`.
1022
+ * Given an array of event strings, setting content is considered to be
1023
+ * successful after all events have been fired. Events can be either:<br/>
1024
+ * - `load` : consider setting content to be finished when the `load` event is
1025
+ * fired.<br/>
1026
+ * - `domcontentloaded` : consider setting content to be finished when the
1027
+ * `DOMContentLoaded` event is fired.<br/>
1028
+ * - `networkidle0` : consider setting content to be finished when there are no
1029
+ * more than 0 network connections for at least `500` ms.<br/>
1030
+ * - `networkidle2` : consider setting content to be finished when there are no
1031
+ * more than 2 network connections for at least `500` ms.
1032
+ */
767
1033
  setContent(html: string, options?: WaitForOptions): Promise<void>;
1034
+ /**
1035
+ * @param url - URL to navigate page to. The URL should include scheme, e.g.
1036
+ * `https://`
1037
+ * @param options - Navigation Parameter
1038
+ * @returns Promise which resolves to the main resource response. In case of
1039
+ * multiple redirects, the navigation will resolve with the response of the
1040
+ * last redirect.
1041
+ * @remarks
1042
+ * The argument `options` might have the following properties:
1043
+ *
1044
+ * - `timeout` : Maximum navigation time in milliseconds, defaults to 30
1045
+ * seconds, pass 0 to disable timeout. The default value can be changed by
1046
+ * using the
1047
+ * {@link Page.setDefaultNavigationTimeout |
1048
+ * page.setDefaultNavigationTimeout(timeout)}
1049
+ * or {@link Page.setDefaultTimeout | page.setDefaultTimeout(timeout)}
1050
+ * methods.
1051
+ *
1052
+ * - `waitUntil`:When to consider navigation succeeded, defaults to `load`.
1053
+ * Given an array of event strings, navigation is considered to be successful
1054
+ * after all events have been fired. Events can be either:<br/>
1055
+ * - `load` : consider navigation to be finished when the load event is
1056
+ * fired.<br/>
1057
+ * - `domcontentloaded` : consider navigation to be finished when the
1058
+ * DOMContentLoaded event is fired.<br/>
1059
+ * - `networkidle0` : consider navigation to be finished when there are no
1060
+ * more than 0 network connections for at least `500` ms.<br/>
1061
+ * - `networkidle2` : consider navigation to be finished when there are no
1062
+ * more than 2 network connections for at least `500` ms.
1063
+ *
1064
+ * - `referer` : Referer header value. If provided it will take preference
1065
+ * over the referer header value set by
1066
+ * {@link Page.setExtraHTTPHeaders |page.setExtraHTTPHeaders()}.
1067
+ *
1068
+ * `page.goto` will throw an error if:
1069
+ * - there's an SSL error (e.g. in case of self-signed certificates).
1070
+ * - target URL is invalid.
1071
+ * - the timeout is exceeded during navigation.
1072
+ * - the remote server does not respond or is unreachable.
1073
+ * - the main resource failed to load.
1074
+ *
1075
+ * `page.goto` will not throw an error when any valid HTTP status code is
1076
+ * returned by the remote server, including 404 "Not Found" and 500
1077
+ * "Internal Server Error". The status code for such responses can be
1078
+ * retrieved by calling response.status().
1079
+ *
1080
+ * NOTE: `page.goto` either throws an error or returns a main resource
1081
+ * response. The only exceptions are navigation to about:blank or navigation
1082
+ * to the same URL with a different hash, which would succeed and return null.
1083
+ *
1084
+ * NOTE: Headless mode doesn't support navigation to a PDF document. See the
1085
+ * {@link https://bugs.chromium.org/p/chromium/issues/detail?id=761295
1086
+ * | upstream issue}.
1087
+ *
1088
+ * Shortcut for {@link Frame.goto | page.mainFrame().goto(url, options)}.
1089
+ */
768
1090
  goto(url: string, options?: WaitForOptions & {
769
1091
  referer?: string;
770
1092
  }): Promise<HTTPResponse>;
1093
+ /**
1094
+ * @param options - Navigation parameters which might have the following
1095
+ * properties:
1096
+ * @returns Promise which resolves to the main resource response. In case of
1097
+ * multiple redirects, the navigation will resolve with the response of the
1098
+ * last redirect.
1099
+ * @remarks
1100
+ * The argument `options` might have the following properties:
1101
+ *
1102
+ * - `timeout` : Maximum navigation time in milliseconds, defaults to 30
1103
+ * seconds, pass 0 to disable timeout. The default value can be changed by
1104
+ * using the
1105
+ * {@link Page.setDefaultNavigationTimeout |
1106
+ * page.setDefaultNavigationTimeout(timeout)}
1107
+ * or {@link Page.setDefaultTimeout | page.setDefaultTimeout(timeout)}
1108
+ * methods.
1109
+ *
1110
+ * - `waitUntil`: When to consider navigation succeeded, defaults to `load`.
1111
+ * Given an array of event strings, navigation is considered to be
1112
+ * successful after all events have been fired. Events can be either:<br/>
1113
+ * - `load` : consider navigation to be finished when the load event is fired.<br/>
1114
+ * - `domcontentloaded` : consider navigation to be finished when the
1115
+ * DOMContentLoaded event is fired.<br/>
1116
+ * - `networkidle0` : consider navigation to be finished when there are no
1117
+ * more than 0 network connections for at least `500` ms.<br/>
1118
+ * - `networkidle2` : consider navigation to be finished when there are no
1119
+ * more than 2 network connections for at least `500` ms.
1120
+ */
771
1121
  reload(options?: WaitForOptions): Promise<HTTPResponse | null>;
1122
+ /**
1123
+ * This resolves when the page navigates to a new URL or reloads. It is useful
1124
+ * when you run code that will indirectly cause the page to navigate. Consider
1125
+ * this example:
1126
+ * ```js
1127
+ * const [response] = await Promise.all([
1128
+ * page.waitForNavigation(), // The promise resolves after navigation has finished
1129
+ * page.click('a.my-link'), // Clicking the link will indirectly cause a navigation
1130
+ * ]);
1131
+ * ```
1132
+ *
1133
+ * @param options - Navigation parameters which might have the following properties:
1134
+ * @returns Promise which resolves to the main resource response. In case of
1135
+ * multiple redirects, the navigation will resolve with the response of the
1136
+ * last redirect. In case of navigation to a different anchor or navigation
1137
+ * due to History API usage, the navigation will resolve with `null`.
1138
+ * @remarks
1139
+ * NOTE: Usage of the
1140
+ * {@link https://developer.mozilla.org/en-US/docs/Web/API/History_API | History API}
1141
+ * to change the URL is considered a navigation.
1142
+ *
1143
+ * Shortcut for
1144
+ * {@link Frame.waitForNavigation | page.mainFrame().waitForNavigation(options)}.
1145
+ */
772
1146
  waitForNavigation(options?: WaitForOptions): Promise<HTTPResponse | null>;
773
1147
  private _sessionClosePromise;
1148
+ /**
1149
+ * @param urlOrPredicate - A URL or predicate to wait for
1150
+ * @param options - Optional waiting parameters
1151
+ * @returns Promise which resolves to the matched response
1152
+ * @example
1153
+ * ```js
1154
+ * const firstResponse = await page.waitForResponse(
1155
+ * 'https://example.com/resource'
1156
+ * );
1157
+ * const finalResponse = await page.waitForResponse(
1158
+ * (response) =>
1159
+ * response.url() === 'https://example.com' && response.status() === 200
1160
+ * );
1161
+ * const finalResponse = await page.waitForResponse(async (response) => {
1162
+ * return (await response.text()).includes('<html>');
1163
+ * });
1164
+ * return finalResponse.ok();
1165
+ * ```
1166
+ * @remarks
1167
+ * Optional Waiting Parameters have:
1168
+ *
1169
+ * - `timeout`: Maximum wait time in milliseconds, defaults to `30` seconds, pass
1170
+ * `0` to disable the timeout. The default value can be changed by using the
1171
+ * {@link Page.setDefaultTimeout} method.
1172
+ */
774
1173
  waitForRequest(urlOrPredicate: string | ((req: HTTPRequest) => boolean | Promise<boolean>), options?: {
775
1174
  timeout?: number;
776
1175
  }): Promise<HTTPRequest>;
1176
+ /**
1177
+ * @param urlOrPredicate - A URL or predicate to wait for.
1178
+ * @param options - Optional waiting parameters
1179
+ * @returns Promise which resolves to the matched response.
1180
+ * @example
1181
+ * ```js
1182
+ * const firstResponse = await page.waitForResponse(
1183
+ * 'https://example.com/resource'
1184
+ * );
1185
+ * const finalResponse = await page.waitForResponse(
1186
+ * (response) =>
1187
+ * response.url() === 'https://example.com' && response.status() === 200
1188
+ * );
1189
+ * const finalResponse = await page.waitForResponse(async (response) => {
1190
+ * return (await response.text()).includes('<html>');
1191
+ * });
1192
+ * return finalResponse.ok();
1193
+ * ```
1194
+ * @remarks
1195
+ * Optional Parameter have:
1196
+ *
1197
+ * - `timeout`: Maximum wait time in milliseconds, defaults to `30` seconds,
1198
+ * pass `0` to disable the timeout. The default value can be changed by using
1199
+ * the {@link Page.setDefaultTimeout} method.
1200
+ */
777
1201
  waitForResponse(urlOrPredicate: string | ((res: HTTPResponse) => boolean | Promise<boolean>), options?: {
778
1202
  timeout?: number;
779
1203
  }): Promise<HTTPResponse>;
1204
+ /**
1205
+ * @param options - Optional waiting parameters
1206
+ * @returns Promise which resolves when network is idle
1207
+ */
1208
+ waitForNetworkIdle(options?: {
1209
+ idleTime?: number;
1210
+ timeout?: number;
1211
+ }): Promise<void>;
1212
+ /**
1213
+ * This method navigate to the previous page in history.
1214
+ * @param options - Navigation parameters
1215
+ * @returns Promise which resolves to the main resource response. In case of
1216
+ * multiple redirects, the navigation will resolve with the response of the
1217
+ * last redirect. If can not go back, resolves to `null`.
1218
+ * @remarks
1219
+ * The argument `options` might have the following properties:
1220
+ *
1221
+ * - `timeout` : Maximum navigation time in milliseconds, defaults to 30
1222
+ * seconds, pass 0 to disable timeout. The default value can be changed by
1223
+ * using the
1224
+ * {@link Page.setDefaultNavigationTimeout
1225
+ * | page.setDefaultNavigationTimeout(timeout)}
1226
+ * or {@link Page.setDefaultTimeout | page.setDefaultTimeout(timeout)}
1227
+ * methods.
1228
+ *
1229
+ * - `waitUntil` : When to consider navigation succeeded, defaults to `load`.
1230
+ * Given an array of event strings, navigation is considered to be
1231
+ * successful after all events have been fired. Events can be either:<br/>
1232
+ * - `load` : consider navigation to be finished when the load event is fired.<br/>
1233
+ * - `domcontentloaded` : consider navigation to be finished when the
1234
+ * DOMContentLoaded event is fired.<br/>
1235
+ * - `networkidle0` : consider navigation to be finished when there are no
1236
+ * more than 0 network connections for at least `500` ms.<br/>
1237
+ * - `networkidle2` : consider navigation to be finished when there are no
1238
+ * more than 2 network connections for at least `500` ms.
1239
+ */
780
1240
  goBack(options?: WaitForOptions): Promise<HTTPResponse | null>;
1241
+ /**
1242
+ * This method navigate to the next page in history.
1243
+ * @param options - Navigation Parameter
1244
+ * @returns Promise which resolves to the main resource response. In case of
1245
+ * multiple redirects, the navigation will resolve with the response of the
1246
+ * last redirect. If can not go forward, resolves to `null`.
1247
+ * @remarks
1248
+ * The argument `options` might have the following properties:
1249
+ *
1250
+ * - `timeout` : Maximum navigation time in milliseconds, defaults to 30
1251
+ * seconds, pass 0 to disable timeout. The default value can be changed by
1252
+ * using the
1253
+ * {@link Page.setDefaultNavigationTimeout
1254
+ * | page.setDefaultNavigationTimeout(timeout)}
1255
+ * or {@link Page.setDefaultTimeout | page.setDefaultTimeout(timeout)}
1256
+ * methods.
1257
+ *
1258
+ * - `waitUntil`: When to consider navigation succeeded, defaults to `load`.
1259
+ * Given an array of event strings, navigation is considered to be
1260
+ * successful after all events have been fired. Events can be either:<br/>
1261
+ * - `load` : consider navigation to be finished when the load event is fired.<br/>
1262
+ * - `domcontentloaded` : consider navigation to be finished when the
1263
+ * DOMContentLoaded event is fired.<br/>
1264
+ * - `networkidle0` : consider navigation to be finished when there are no
1265
+ * more than 0 network connections for at least `500` ms.<br/>
1266
+ * - `networkidle2` : consider navigation to be finished when there are no
1267
+ * more than 2 network connections for at least `500` ms.
1268
+ */
781
1269
  goForward(options?: WaitForOptions): Promise<HTTPResponse | null>;
782
1270
  private _go;
1271
+ /**
1272
+ * Brings page to front (activates tab).
1273
+ */
783
1274
  bringToFront(): Promise<void>;
1275
+ /**
1276
+ * Emulates given device metrics and user agent. This method is a shortcut for
1277
+ * calling two methods: {@link Page.setUserAgent} and {@link Page.setViewport}
1278
+ * To aid emulation, Puppeteer provides a list of device descriptors that can
1279
+ * be obtained via the {@link Puppeteer.devices} `page.emulate` will resize
1280
+ * the page. A lot of websites don't expect phones to change size, so you
1281
+ * should emulate before navigating to the page.
1282
+ * @example
1283
+ * ```js
1284
+ * const puppeteer = require('puppeteer');
1285
+ * const iPhone = puppeteer.devices['iPhone 6'];
1286
+ * (async () => {
1287
+ * const browser = await puppeteer.launch();
1288
+ * const page = await browser.newPage();
1289
+ * await page.emulate(iPhone);
1290
+ * await page.goto('https://www.google.com');
1291
+ * // other actions...
1292
+ * await browser.close();
1293
+ * })();
1294
+ * ```
1295
+ * @remarks List of all available devices is available in the source code:
1296
+ * {@link https://github.com/puppeteer/puppeteer/blob/main/src/common/DeviceDescriptors.ts | src/common/DeviceDescriptors.ts}.
1297
+ */
784
1298
  emulate(options: {
785
1299
  viewport: Viewport;
786
1300
  userAgent: string;
787
1301
  }): Promise<void>;
1302
+ /**
1303
+ * @param enabled - Whether or not to enable JavaScript on the page.
1304
+ * @returns
1305
+ * @remarks
1306
+ * NOTE: changing this value won't affect scripts that have already been run.
1307
+ * It will take full effect on the next navigation.
1308
+ */
788
1309
  setJavaScriptEnabled(enabled: boolean): Promise<void>;
1310
+ /**
1311
+ * Toggles bypassing page's Content-Security-Policy.
1312
+ * @param enabled - sets bypassing of page's Content-Security-Policy.
1313
+ * @remarks
1314
+ * NOTE: CSP bypassing happens at the moment of CSP initialization rather than
1315
+ * evaluation. Usually, this means that `page.setBypassCSP` should be called
1316
+ * before navigating to the domain.
1317
+ */
789
1318
  setBypassCSP(enabled: boolean): Promise<void>;
1319
+ /**
1320
+ * @param type - Changes the CSS media type of the page. The only allowed
1321
+ * values are `screen`, `print` and `null`. Passing `null` disables CSS media
1322
+ * emulation.
1323
+ * @example
1324
+ * ```
1325
+ * await page.evaluate(() => matchMedia('screen').matches);
1326
+ * // → true
1327
+ * await page.evaluate(() => matchMedia('print').matches);
1328
+ * // → false
1329
+ *
1330
+ * await page.emulateMediaType('print');
1331
+ * await page.evaluate(() => matchMedia('screen').matches);
1332
+ * // → false
1333
+ * await page.evaluate(() => matchMedia('print').matches);
1334
+ * // → true
1335
+ *
1336
+ * await page.emulateMediaType(null);
1337
+ * await page.evaluate(() => matchMedia('screen').matches);
1338
+ * // → true
1339
+ * await page.evaluate(() => matchMedia('print').matches);
1340
+ * // → false
1341
+ * ```
1342
+ */
790
1343
  emulateMediaType(type?: string): Promise<void>;
1344
+ emulateCPUThrottling(factor: number | null): Promise<void>;
1345
+ /**
1346
+ * @param features - `<?Array<Object>>` Given an array of media feature
1347
+ * objects, emulates CSS media features on the page. Each media feature object
1348
+ * must have the following properties:
1349
+ * @example
1350
+ * ```js
1351
+ * await page.emulateMediaFeatures([
1352
+ * { name: 'prefers-color-scheme', value: 'dark' },
1353
+ * ]);
1354
+ * await page.evaluate(() => matchMedia('(prefers-color-scheme: dark)').matches);
1355
+ * // → true
1356
+ * await page.evaluate(() => matchMedia('(prefers-color-scheme: light)').matches);
1357
+ * // → false
1358
+ *
1359
+ * await page.emulateMediaFeatures([
1360
+ * { name: 'prefers-reduced-motion', value: 'reduce' },
1361
+ * ]);
1362
+ * await page.evaluate(
1363
+ * () => matchMedia('(prefers-reduced-motion: reduce)').matches
1364
+ * );
1365
+ * // → true
1366
+ * await page.evaluate(
1367
+ * () => matchMedia('(prefers-reduced-motion: no-preference)').matches
1368
+ * );
1369
+ * // → false
1370
+ *
1371
+ * await page.emulateMediaFeatures([
1372
+ * { name: 'prefers-color-scheme', value: 'dark' },
1373
+ * { name: 'prefers-reduced-motion', value: 'reduce' },
1374
+ * ]);
1375
+ * await page.evaluate(() => matchMedia('(prefers-color-scheme: dark)').matches);
1376
+ * // → true
1377
+ * await page.evaluate(() => matchMedia('(prefers-color-scheme: light)').matches);
1378
+ * // → false
1379
+ * await page.evaluate(
1380
+ * () => matchMedia('(prefers-reduced-motion: reduce)').matches
1381
+ * );
1382
+ * // → true
1383
+ * await page.evaluate(
1384
+ * () => matchMedia('(prefers-reduced-motion: no-preference)').matches
1385
+ * );
1386
+ * // → false
1387
+ *
1388
+ * await page.emulateMediaFeatures([{ name: 'color-gamut', value: 'p3' }]);
1389
+ * await page.evaluate(() => matchMedia('(color-gamut: srgb)').matches);
1390
+ * // → true
1391
+ * await page.evaluate(() => matchMedia('(color-gamut: p3)').matches);
1392
+ * // → true
1393
+ * await page.evaluate(() => matchMedia('(color-gamut: rec2020)').matches);
1394
+ * // → false
1395
+ * ```
1396
+ */
791
1397
  emulateMediaFeatures(features?: MediaFeature[]): Promise<void>;
1398
+ /**
1399
+ * @param timezoneId - Changes the timezone of the page. See
1400
+ * {@link https://source.chromium.org/chromium/chromium/deps/icu.git/+/faee8bc70570192d82d2978a71e2a615788597d1:source/data/misc/metaZones.txt | ICU’s metaZones.txt}
1401
+ * for a list of supported timezone IDs. Passing
1402
+ * `null` disables timezone emulation.
1403
+ */
792
1404
  emulateTimezone(timezoneId?: string): Promise<void>;
793
1405
  /**
794
1406
  * Emulates the idle state.
@@ -807,8 +1419,6 @@ export declare class Page extends EventEmitter {
807
1419
  * ```
808
1420
  *
809
1421
  * @param overrides - Mock idle state. If not set, clears idle overrides
810
- * @param isUserActive - Mock isUserActive
811
- * @param isScreenUnlocked - Mock isScreenUnlocked
812
1422
  */
813
1423
  emulateIdleState(overrides?: {
814
1424
  isUserActive: boolean;
@@ -842,7 +1452,65 @@ export declare class Page extends EventEmitter {
842
1452
  * @param type - the type of deficiency to simulate, or `'none'` to reset.
843
1453
  */
844
1454
  emulateVisionDeficiency(type?: Protocol.Emulation.SetEmulatedVisionDeficiencyRequest['type']): Promise<void>;
1455
+ /**
1456
+ * `page.setViewport` will resize the page. A lot of websites don't expect
1457
+ * phones to change size, so you should set the viewport before navigating to
1458
+ * the page.
1459
+ *
1460
+ * In the case of multiple pages in a single browser, each page can have its
1461
+ * own viewport size.
1462
+ * @example
1463
+ * ```js
1464
+ * const page = await browser.newPage();
1465
+ * await page.setViewport({
1466
+ * width: 640,
1467
+ * height: 480,
1468
+ * deviceScaleFactor: 1,
1469
+ * });
1470
+ * await page.goto('https://example.com');
1471
+ * ```
1472
+ *
1473
+ * @param viewport -
1474
+ * @remarks
1475
+ * Argument viewport have following properties:
1476
+ *
1477
+ * - `width`: page width in pixels. required
1478
+ *
1479
+ * - `height`: page height in pixels. required
1480
+ *
1481
+ * - `deviceScaleFactor`: Specify device scale factor (can be thought of as
1482
+ * DPR). Defaults to `1`.
1483
+ *
1484
+ * - `isMobile`: Whether the meta viewport tag is taken into account. Defaults
1485
+ * to `false`.
1486
+ *
1487
+ * - `hasTouch`: Specifies if viewport supports touch events. Defaults to `false`
1488
+ *
1489
+ * - `isLandScape`: Specifies if viewport is in landscape mode. Defaults to false.
1490
+ *
1491
+ * NOTE: in certain cases, setting viewport will reload the page in order to
1492
+ * set the isMobile or hasTouch properties.
1493
+ */
845
1494
  setViewport(viewport: Viewport): Promise<void>;
1495
+ /**
1496
+ * @returns
1497
+ *
1498
+ * - `width`: page's width in pixels
1499
+ *
1500
+ * - `height`: page's height in pixels
1501
+ *
1502
+ * - `deviceScalarFactor`: Specify device scale factor (can be though of as
1503
+ * dpr). Defaults to `1`.
1504
+ *
1505
+ * - `isMobile`: Whether the meta viewport tag is taken into account. Defaults
1506
+ * to `false`.
1507
+ *
1508
+ * - `hasTouch`: Specifies if viewport supports touch events. Defaults to
1509
+ * `false`.
1510
+ *
1511
+ * - `isLandScape`: Specifies if viewport is in landscape mode. Defaults to
1512
+ * `false`.
1513
+ */
846
1514
  viewport(): Viewport | null;
847
1515
  /**
848
1516
  * @remarks
@@ -893,15 +1561,90 @@ export declare class Page extends EventEmitter {
893
1561
  * @returns the return value of `pageFunction`.
894
1562
  */
895
1563
  evaluate<T extends EvaluateFn>(pageFunction: T, ...args: SerializableOrJSHandle[]): Promise<UnwrapPromiseLike<EvaluateFnReturnType<T>>>;
1564
+ /**
1565
+ * Adds a function which would be invoked in one of the following scenarios:
1566
+ *
1567
+ * - whenever the page is navigated
1568
+ *
1569
+ * - whenever the child frame is attached or navigated. In this case, the
1570
+ * function is invoked in the context of the newly attached frame.
1571
+ *
1572
+ * The function is invoked after the document was created but before any of
1573
+ * its scripts were run. This is useful to amend the JavaScript environment,
1574
+ * e.g. to seed `Math.random`.
1575
+ * @param pageFunction - Function to be evaluated in browser context
1576
+ * @param args - Arguments to pass to `pageFunction`
1577
+ * @example
1578
+ * An example of overriding the navigator.languages property before the page loads:
1579
+ * ```js
1580
+ * // preload.js
1581
+ *
1582
+ * // overwrite the `languages` property to use a custom getter
1583
+ * Object.defineProperty(navigator, 'languages', {
1584
+ * get: function () {
1585
+ * return ['en-US', 'en', 'bn'];
1586
+ * },
1587
+ * });
1588
+ *
1589
+ * // In your puppeteer script, assuming the preload.js file is
1590
+ * in same folder of our script
1591
+ * const preloadFile = fs.readFileSync('./preload.js', 'utf8');
1592
+ * await page.evaluateOnNewDocument(preloadFile);
1593
+ * ```
1594
+ */
896
1595
  evaluateOnNewDocument(pageFunction: Function | string, ...args: unknown[]): Promise<void>;
1596
+ /**
1597
+ * Toggles ignoring cache for each request based on the enabled state. By
1598
+ * default, caching is enabled.
1599
+ * @param enabled - sets the `enabled` state of cache
1600
+ */
897
1601
  setCacheEnabled(enabled?: boolean): Promise<void>;
1602
+ /**
1603
+ * @remarks
1604
+ * Options object which might have the following properties:
1605
+ *
1606
+ * - `path` : The file path to save the image to. The screenshot type
1607
+ * will be inferred from file extension. If `path` is a relative path, then
1608
+ * it is resolved relative to
1609
+ * {@link https://nodejs.org/api/process.html#process_process_cwd
1610
+ * | current working directory}.
1611
+ * If no path is provided, the image won't be saved to the disk.
1612
+ *
1613
+ * - `type` : Specify screenshot type, can be either `jpeg` or `png`.
1614
+ * Defaults to 'png'.
1615
+ *
1616
+ * - `quality` : The quality of the image, between 0-100. Not
1617
+ * applicable to `png` images.
1618
+ *
1619
+ * - `fullPage` : When true, takes a screenshot of the full
1620
+ * scrollable page. Defaults to `false`
1621
+ *
1622
+ * - `clip` : An object which specifies clipping region of the page.
1623
+ * Should have the following fields:<br/>
1624
+ * - `x` : x-coordinate of top-left corner of clip area.<br/>
1625
+ * - `y` : y-coordinate of top-left corner of clip area.<br/>
1626
+ * - `width` : width of clipping area.<br/>
1627
+ * - `height` : height of clipping area.
1628
+ *
1629
+ * - `omitBackground` : Hides default white background and allows
1630
+ * capturing screenshots with transparency. Defaults to `false`
1631
+ *
1632
+ * - `encoding` : The encoding of the image, can be either base64 or
1633
+ * binary. Defaults to `binary`.
1634
+ *
1635
+ *
1636
+ * NOTE: Screenshots take at least 1/6 second on OS X. See
1637
+ * {@link https://crbug.com/741689} for discussion.
1638
+ * @returns Promise which resolves to buffer or a base64 string (depending on
1639
+ * the value of `encoding`) with captured screenshot.
1640
+ */
898
1641
  screenshot(options?: ScreenshotOptions): Promise<Buffer | string | void>;
899
1642
  private _screenshotTask;
900
1643
  /**
901
1644
  * Generatees a PDF of the page with the `print` CSS media type.
902
1645
  * @remarks
903
1646
  *
904
- * IMPORTANT: PDF generation is only supported in Chrome headless mode.
1647
+ * NOTE: PDF generation is only supported in Chrome headless mode.
905
1648
  *
906
1649
  * To generate a PDF with the `screen` media type, call
907
1650
  * {@link Page.emulateMediaType | `page.emulateMediaType('screen')`} before
@@ -915,22 +1658,141 @@ export declare class Page extends EventEmitter {
915
1658
  *
916
1659
  * @param options - options for generating the PDF.
917
1660
  */
1661
+ createPDFStream(options?: PDFOptions): Promise<Readable>;
1662
+ /**
1663
+ * @param options -
1664
+ * @returns
1665
+ */
918
1666
  pdf(options?: PDFOptions): Promise<Buffer>;
1667
+ /**
1668
+ * @returns The page's title
1669
+ * @remarks
1670
+ * Shortcut for {@link Frame.title | page.mainFrame().title()}.
1671
+ */
919
1672
  title(): Promise<string>;
920
1673
  close(options?: {
921
1674
  runBeforeUnload?: boolean;
922
1675
  }): Promise<void>;
1676
+ /**
1677
+ * Indicates that the page has been closed.
1678
+ * @returns
1679
+ */
923
1680
  isClosed(): boolean;
924
1681
  get mouse(): Mouse;
1682
+ /**
1683
+ * This method fetches an element with `selector`, scrolls it into view if
1684
+ * needed, and then uses {@link Page.mouse} to click in the center of the
1685
+ * element. If there's no element matching `selector`, the method throws an
1686
+ * error.
1687
+ * @remarks Bear in mind that if `click()` triggers a navigation event and
1688
+ * there's a separate `page.waitForNavigation()` promise to be resolved, you
1689
+ * may end up with a race condition that yields unexpected results. The
1690
+ * correct pattern for click and wait for navigation is the following:
1691
+ * ```js
1692
+ * const [response] = await Promise.all([
1693
+ * page.waitForNavigation(waitOptions),
1694
+ * page.click(selector, clickOptions),
1695
+ * ]);
1696
+ * ```
1697
+ * Shortcut for {@link Frame.click | page.mainFrame().click(selector[, options]) }.
1698
+ * @param selector - A `selector` to search for element to click. If there are
1699
+ * multiple elements satisfying the `selector`, the first will be clicked
1700
+ * @param options - `Object`
1701
+ * @returns Promise which resolves when the element matching `selector` is
1702
+ * successfully clicked. The Promise will be rejected if there is no element
1703
+ * matching `selector`.
1704
+ */
925
1705
  click(selector: string, options?: {
926
1706
  delay?: number;
927
1707
  button?: MouseButton;
928
1708
  clickCount?: number;
929
1709
  }): Promise<void>;
1710
+ /**
1711
+ * This method fetches an element with `selector` and focuses it. If there's no
1712
+ * element matching `selector`, the method throws an error.
1713
+ * @param selector - A
1714
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | selector }
1715
+ * of an element to focus. If there are multiple elements satisfying the
1716
+ * selector, the first will be focused.
1717
+ * @returns Promise which resolves when the element matching selector is
1718
+ * successfully focused. The promise will be rejected if there is no element
1719
+ * matching selector.
1720
+ * @remarks
1721
+ * Shortcut for {@link Frame.focus | page.mainFrame().focus(selector)}.
1722
+ */
930
1723
  focus(selector: string): Promise<void>;
1724
+ /**
1725
+ * This method fetches an element with `selector`, scrolls it into view if
1726
+ * needed, and then uses {@link Page.mouse} to hover over the center of the element.
1727
+ * If there's no element matching `selector`, the method throws an error.
1728
+ * @param selector - A
1729
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | selector}
1730
+ * to search for element to hover. If there are multiple elements satisfying
1731
+ * the selector, the first will be hovered.
1732
+ * @returns Promise which resolves when the element matching `selector` is
1733
+ * successfully hovered. Promise gets rejected if there's no element matching
1734
+ * `selector`.
1735
+ * @remarks
1736
+ * Shortcut for {@link Page.hover | page.mainFrame().hover(selector)}.
1737
+ */
931
1738
  hover(selector: string): Promise<void>;
1739
+ /**
1740
+ * Triggers a `change` and `input` event once all the provided options have been
1741
+ * selected. If there's no `<select>` element matching `selector`, the method
1742
+ * throws an error.
1743
+ *
1744
+ * @example
1745
+ * ```js
1746
+ * page.select('select#colors', 'blue'); // single selection
1747
+ * page.select('select#colors', 'red', 'green', 'blue'); // multiple selections
1748
+ * ```
1749
+ * @param selector - A
1750
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | Selector}
1751
+ * to query the page for
1752
+ * @param values - Values of options to select. If the `<select>` has the
1753
+ * `multiple` attribute, all values are considered, otherwise only the first one
1754
+ * is taken into account.
1755
+ * @returns
1756
+ *
1757
+ * @remarks
1758
+ * Shortcut for {@link Frame.select | page.mainFrame().select()}
1759
+ */
932
1760
  select(selector: string, ...values: string[]): Promise<string[]>;
1761
+ /**
1762
+ * This method fetches an element with `selector`, scrolls it into view if
1763
+ * needed, and then uses {@link Page.touchscreen} to tap in the center of the element.
1764
+ * If there's no element matching `selector`, the method throws an error.
1765
+ * @param selector - A
1766
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | Selector}
1767
+ * to search for element to tap. If there are multiple elements satisfying the
1768
+ * selector, the first will be tapped.
1769
+ * @returns
1770
+ * @remarks
1771
+ * Shortcut for {@link Frame.tap | page.mainFrame().tap(selector)}.
1772
+ */
933
1773
  tap(selector: string): Promise<void>;
1774
+ /**
1775
+ * Sends a `keydown`, `keypress/input`, and `keyup` event for each character
1776
+ * in the text.
1777
+ *
1778
+ * To press a special key, like `Control` or `ArrowDown`, use {@link Keyboard.press}.
1779
+ * @example
1780
+ * ```
1781
+ * await page.type('#mytextarea', 'Hello');
1782
+ * // Types instantly
1783
+ * await page.type('#mytextarea', 'World', { delay: 100 });
1784
+ * // Types slower, like a user
1785
+ * ```
1786
+ * @param selector - A
1787
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | selector}
1788
+ * of an element to type into. If there are multiple elements satisfying the
1789
+ * selector, the first will be used.
1790
+ * @param text - A text to type into a focused element.
1791
+ * @param options - have property `delay` which is the Time to wait between
1792
+ * key presses in milliseconds. Defaults to `0`.
1793
+ * @returns
1794
+ * @remarks
1795
+ */
934
1796
  type(selector: string, text: string, options?: {
935
1797
  delay: number;
936
1798
  }): Promise<void>;
@@ -985,16 +1847,178 @@ export declare class Page extends EventEmitter {
985
1847
  * @param milliseconds - the number of milliseconds to wait.
986
1848
  */
987
1849
  waitForTimeout(milliseconds: number): Promise<void>;
1850
+ /**
1851
+ * Wait for the `selector` to appear in page. If at the moment of calling the
1852
+ * method the `selector` already exists, the method will return immediately. If
1853
+ * the `selector` doesn't appear after the `timeout` milliseconds of waiting, the
1854
+ * function will throw.
1855
+ *
1856
+ * This method works across navigations:
1857
+ * ```js
1858
+ * const puppeteer = require('puppeteer');
1859
+ * (async () => {
1860
+ * const browser = await puppeteer.launch();
1861
+ * const page = await browser.newPage();
1862
+ * let currentURL;
1863
+ * page
1864
+ * .waitForSelector('img')
1865
+ * .then(() => console.log('First URL with image: ' + currentURL));
1866
+ * for (currentURL of [
1867
+ * 'https://example.com',
1868
+ * 'https://google.com',
1869
+ * 'https://bbc.com',
1870
+ * ]) {
1871
+ * await page.goto(currentURL);
1872
+ * }
1873
+ * await browser.close();
1874
+ * })();
1875
+ * ```
1876
+ * @param selector - A
1877
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | selector}
1878
+ * of an element to wait for
1879
+ * @param options - Optional waiting parameters
1880
+ * @returns Promise which resolves when element specified by selector string
1881
+ * is added to DOM. Resolves to `null` if waiting for hidden: `true` and
1882
+ * selector is not found in DOM.
1883
+ * @remarks
1884
+ * The optional Parameter in Arguments `options` are :
1885
+ *
1886
+ * - `Visible`: A boolean wait for element to be present in DOM and to be
1887
+ * visible, i.e. to not have `display: none` or `visibility: hidden` CSS
1888
+ * properties. Defaults to `false`.
1889
+ *
1890
+ * - `hidden`: ait for element to not be found in the DOM or to be hidden,
1891
+ * i.e. have `display: none` or `visibility: hidden` CSS properties. Defaults to
1892
+ * `false`.
1893
+ *
1894
+ * - `timeout`: maximum time to wait for in milliseconds. Defaults to `30000`
1895
+ * (30 seconds). Pass `0` to disable timeout. The default value can be changed
1896
+ * by using the {@link Page.setDefaultTimeout} method.
1897
+ */
988
1898
  waitForSelector(selector: string, options?: {
989
1899
  visible?: boolean;
990
1900
  hidden?: boolean;
991
1901
  timeout?: number;
992
1902
  }): Promise<ElementHandle | null>;
1903
+ /**
1904
+ * Wait for the `xpath` to appear in page. If at the moment of calling the
1905
+ * method the `xpath` already exists, the method will return immediately. If
1906
+ * the `xpath` doesn't appear after the `timeout` milliseconds of waiting, the
1907
+ * function will throw.
1908
+ *
1909
+ * This method works across navigation
1910
+ * ```js
1911
+ * const puppeteer = require('puppeteer');
1912
+ * (async () => {
1913
+ * const browser = await puppeteer.launch();
1914
+ * const page = await browser.newPage();
1915
+ * let currentURL;
1916
+ * page
1917
+ * .waitForXPath('//img')
1918
+ * .then(() => console.log('First URL with image: ' + currentURL));
1919
+ * for (currentURL of [
1920
+ * 'https://example.com',
1921
+ * 'https://google.com',
1922
+ * 'https://bbc.com',
1923
+ * ]) {
1924
+ * await page.goto(currentURL);
1925
+ * }
1926
+ * await browser.close();
1927
+ * })();
1928
+ * ```
1929
+ * @param xpath - A
1930
+ * {@link https://developer.mozilla.org/en-US/docs/Web/XPath | xpath} of an
1931
+ * element to wait for
1932
+ * @param options - Optional waiting parameters
1933
+ * @returns Promise which resolves when element specified by xpath string is
1934
+ * added to DOM. Resolves to `null` if waiting for `hidden: true` and xpath is
1935
+ * not found in DOM.
1936
+ * @remarks
1937
+ * The optional Argument `options` have properties:
1938
+ *
1939
+ * - `visible`: A boolean to wait for element to be present in DOM and to be
1940
+ * visible, i.e. to not have `display: none` or `visibility: hidden` CSS
1941
+ * properties. Defaults to `false`.
1942
+ *
1943
+ * - `hidden`: A boolean wait for element to not be found in the DOM or to be
1944
+ * hidden, i.e. have `display: none` or `visibility: hidden` CSS properties.
1945
+ * Defaults to `false`.
1946
+ *
1947
+ * - `timeout`: A number which is maximum time to wait for in milliseconds.
1948
+ * Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default
1949
+ * value can be changed by using the {@link Page.setDefaultTimeout} method.
1950
+ */
993
1951
  waitForXPath(xpath: string, options?: {
994
1952
  visible?: boolean;
995
1953
  hidden?: boolean;
996
1954
  timeout?: number;
997
1955
  }): Promise<ElementHandle | null>;
1956
+ /**
1957
+ * The `waitForFunction` can be used to observe viewport size change:
1958
+ *
1959
+ * ```
1960
+ * const puppeteer = require('puppeteer');
1961
+ * (async () => {
1962
+ * const browser = await puppeteer.launch();
1963
+ * const page = await browser.newPage();
1964
+ * const watchDog = page.waitForFunction('window.innerWidth < 100');
1965
+ * await page.setViewport({ width: 50, height: 50 });
1966
+ * await watchDog;
1967
+ * await browser.close();
1968
+ * })();
1969
+ * ```
1970
+ * To pass arguments from node.js to the predicate of `page.waitForFunction` function:
1971
+ * ```
1972
+ * const selector = '.foo';
1973
+ * await page.waitForFunction(
1974
+ * (selector) => !!document.querySelector(selector),
1975
+ * {},
1976
+ * selector
1977
+ * );
1978
+ * ```
1979
+ * The predicate of `page.waitForFunction` can be asynchronous too:
1980
+ * ```
1981
+ * const username = 'github-username';
1982
+ * await page.waitForFunction(
1983
+ * async (username) => {
1984
+ * const githubResponse = await fetch(
1985
+ * `https://api.github.com/users/${username}`
1986
+ * );
1987
+ * const githubUser = await githubResponse.json();
1988
+ * // show the avatar
1989
+ * const img = document.createElement('img');
1990
+ * img.src = githubUser.avatar_url;
1991
+ * // wait 3 seconds
1992
+ * await new Promise((resolve, reject) => setTimeout(resolve, 3000));
1993
+ * img.remove();
1994
+ * },
1995
+ * {},
1996
+ * username
1997
+ * );
1998
+ * ```
1999
+ * @param pageFunction - Function to be evaluated in browser context
2000
+ * @param options - Optional waiting parameters
2001
+ * @param args - Arguments to pass to `pageFunction`
2002
+ * @returns Promise which resolves when the `pageFunction` returns a truthy
2003
+ * value. It resolves to a JSHandle of the truthy value.
2004
+ *
2005
+ * The optional waiting parameter can be:
2006
+ *
2007
+ * - `Polling`: An interval at which the `pageFunction` is executed, defaults to
2008
+ * `raf`. If `polling` is a number, then it is treated as an interval in
2009
+ * milliseconds at which the function would be executed. If polling is a
2010
+ * string, then it can be one of the following values:<br/>
2011
+ * - `raf`: to constantly execute `pageFunction` in `requestAnimationFrame`
2012
+ * callback. This is the tightest polling mode which is suitable to
2013
+ * observe styling changes.<br/>
2014
+ * - `mutation`: to execute pageFunction on every DOM mutation.
2015
+ *
2016
+ * - `timeout`: maximum time to wait for in milliseconds. Defaults to `30000`
2017
+ * (30 seconds). Pass `0` to disable timeout. The default value can be changed
2018
+ * by using the
2019
+ * {@link Page.setDefaultTimeout | page.setDefaultTimeout(timeout)} method.
2020
+ *
2021
+ */
998
2022
  waitForFunction(pageFunction: Function | string, options?: {
999
2023
  timeout?: number;
1000
2024
  polling?: string | number;