Page
与所检查页面相关的操作和事件属于页面域。
EN
✅️️ Methods
🔨Page.addScriptToEvaluateOnNewDocument
在创建每个帧时(在加载帧的脚本之前)评估给定的脚本。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| source | ✔️ | string | |||
| worldName | 🧪 | string | 如果指定,将创建一个具有给定名称的独立世界,并在其中执行给定的脚本。当相应事件被触发时,此世界名称将用作ExecutionContextDescription::name。 | ENIf specified, creates an isolated world with the given name and evaluates given script in it. This world name will be used as the ExecutionContextDescription::name when the corresponding event is emitted. | |
| includeCommandLineAPI | 🧪 | boolean | 指定命令行API是否应对脚本可用,默认为false。 | ENSpecifies whether command line API should be available to the script, defaults to false. | |
| runImmediately | 🧪 | boolean | 如果为真,则立即在现有的执行上下文或世界中运行脚本。默认值:false。 | ENIf true, runs the script immediately on existing execution contexts or worlds. Default: false. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| identifier | ScriptIdentifier | 已添加脚本的标识符。 | ENIdentifier of the added script. |
🔨Page.bringToFront
将页面置于前台(激活标签页)。
EN
🔨Page.captureScreenshot
捕获页面截图。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| format | string | 图像压缩格式(默认为 png)。 允许的值: jpeg、png、webp | ENImage compression format (defaults to png).Allowed Values: jpeg, png, webp | ||
| quality | integer | 压缩质量范围从[0..100](仅限jpeg格式)。 | ENCompression quality from range [0..100] (jpeg only). | ||
| clip | Viewport | 仅捕获给定区域的屏幕截图。 | ENCapture the screenshot of a given region only. | ||
| fromSurface | 🧪 | boolean | 从表面而非视图捕获屏幕截图。默认为 true。 | ENCapture the screenshot from the surface, rather than the view. Defaults to true. | |
| captureBeyondViewport | 🧪 | boolean | 捕获超出视口的屏幕截图。默认为 false。 | ENCapture the screenshot beyond the viewport. Defaults to false. | |
| optimizeForSpeed | 🧪 | boolean | 优化图像编码以提升速度,而非压缩文件大小(默认值为 false) | ENOptimize image encoding for speed, not for resulting size (defaults to false) |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| data | string | Base64编码的图像数据。(在通过JSON传递时编码为base64字符串) | ENBase64-encoded image data. (Encoded as a base64 string when passed over JSON) |
🔨Page.close
尝试关闭页面,运行其beforeunload钩子(如果有的话)。
EN
🔨Page.createIsolatedWorld
为给定的框架创建一个隔离的世界。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| frameId | ✔️ | FrameId | 在其中创建隔离世界的框架的Id。 | ENId of the frame in which the isolated world should be created. | |
| worldName | string | 一个可选名称,在''执行上下文''中报告。 | ENAn optional name which is reported in the Execution Context. | ||
| grantUniveralAccess | boolean | 是否应向隔离世界授予通用访问权限。这是一个强大的选项,请谨慎使用。 | ENWhether or not universal access should be granted to the isolated world. This is a powerful option, use with caution. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| executionContextId | Runtime.ExecutionContextId | 隔离世界的执行上下文。 | ENExecution context of the isolated world. |
🔨Page.disable
禁用页面域通知。
EN
🔨Page.enable
启用页面域通知。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| enableFileChooserOpenedEvent | 🧪 | boolean | 如果为真,无论Page.setInterceptFileChooserDialog命令设置的状态如何,都会触发Page.fileChooserOpened事件(默认值:false)。 | ENIf true, thePage.fileChooserOpened event will be emitted regardless of the state set by Page.setInterceptFileChooserDialog command (default: false). |
🔨Page.getAppManifest
获取当前文档已处理的清单。此API始终等待清单加载完成。如果提供了manifestId,并且它与当前文档的清单不匹配,此API将报错。如果没有已加载的页面,此API将立即报错。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| manifestId | string |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| url | string | 清单位置。 | ENManifest location. |
| errors | array[AppManifestError] | ||
| data | string | 清单内容。 | ENManifest content. |
| parsed | AppManifestParsedProperties | 已解析清单属性。已弃用,请改用清单。 | ENParsed manifest properties. Deprecated, use manifest instead. |
| manifest | WebAppManifest |
🔨Page.getFrameTree
返回当前帧树结构。
EN
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| frameTree | FrameTree | 呈现框架树结构。 | ENPresent frame tree structure. |
🔨Page.getLayoutMetrics
返回与页面布局相关的指标,例如视口边界/缩放。
EN
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| layoutViewport | LayoutViewport | 已弃用的与布局视口相关的度量指标。以设备像素为单位。请改用 cssLayoutViewport。 | ENDeprecated metrics relating to the layout viewport. Is in device pixels. UsecssLayoutViewport instead. |
| visualViewport | VisualViewport | 已弃用的与视觉视口相关的度量指标。以设备像素为单位。请改用 cssVisualViewport。 | ENDeprecated metrics relating to the visual viewport. Is in device pixels. UsecssVisualViewport instead. |
| contentSize | DOM.Rect | 已弃用的滚动区域尺寸。以设备独立像素(DP)为单位。请改用 cssContentSize。 | ENDeprecated size of scrollable area. Is in DP. UsecssContentSize instead. |
| cssLayoutViewport | LayoutViewport | 与CSS像素中布局视口相关的度量指标。 | ENMetrics relating to the layout viewport in CSS pixels. |
| cssVisualViewport | VisualViewport | 与CSS像素中视觉视口相关的度量指标。 | ENMetrics relating to the visual viewport in CSS pixels. |
| cssContentSize | DOM.Rect | 可滚动区域的尺寸,以CSS像素为单位。 | ENSize of scrollable area in CSS pixels. |
🔨Page.getNavigationHistory
返回当前页面的导航历史记录。
EN
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| currentIndex | integer | 当前导航历史条目的索引。 | ENIndex of the current navigation history entry. |
| entries | array[NavigationEntry] | 导航历史记录条目数组。 | ENArray of navigation history entries. |
🔨Page.handleJavaScriptDialog
接受或关闭由JavaScript触发的对话框(alert、confirm、prompt或onbeforeunload)。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| accept | ✔️ | boolean | 是否接受或关闭对话框。 | ENWhether to accept or dismiss the dialog. | |
| promptText | string | 在确认前需要输入到对话框提示中的文本。仅当这是一个提示对话框时使用。 | ENThe text to enter into the dialog prompt before accepting. Used only if this is a prompt dialog. |
🔨Page.navigate
将当前页面导航到给定的URL。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| url | ✔️ | string | 导航页面至的URL。 | ENURL to navigate the page to. | |
| referrer | string | Referrer URL. | ENReferrer URL. | ||
| transitionType | TransitionType | 预期过渡类型。 | ENIntended transition type. | ||
| frameId | FrameId | 要导航的框架ID,如果未指定,则导航至顶层框架。 | ENFrame id to navigate, if not specified navigates the top frame. | ||
| referrerPolicy | 🧪 | ReferrerPolicy | 用于导航的引用者策略。 | ENReferrer-policy used for the navigation. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| frameId | FrameId | 已导航(或导航失败)的帧ID | ENFrame id that has navigated (or failed to navigate) |
| loaderId | Network.LoaderId | 加载器标识符。在同文档导航的情况下,此字段会被省略,因为先前提交的加载器ID不会发生变化。 | ENLoader identifier. This is omitted in case of same-document navigation, as the previously committed loaderId would not change. |
| errorText | string | 用户友好的错误信息,仅在导航失败时显示。 | ENUser friendly error message, present if and only if navigation has failed. |
| isDownload | boolean | 导航是否导致了下载。 | ENWhether the navigation resulted in a download. |
🔨Page.navigateToHistoryEntry
导航当前页面至指定的历史记录条目。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| entryId | ✔️ | integer | 导航至条目的唯一标识符。 | ENUnique id of the entry to navigate to. |
🔨Page.printToPDF
将页面打印为PDF。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| landscape | boolean | 纸张方向。默认为 false。 | ENPaper orientation. Defaults to false. | ||
| displayHeaderFooter | boolean | 显示页眉和页脚。默认为 false。 | ENDisplay header and footer. Defaults to false. | ||
| printBackground | boolean | 打印背景图形。默认为 false。 | ENPrint background graphics. Defaults to false. | ||
| scale | number | 网页渲染的缩放比例。默认为 1。 | ENScale of the webpage rendering. Defaults to 1. | ||
| paperWidth | number | 纸张宽度,单位为英寸。默认为8.5英寸。 | ENPaper width in inches. Defaults to 8.5 inches. | ||
| paperHeight | number | 纸张高度,以英寸为单位。默认为 11 英寸。 | ENPaper height in inches. Defaults to 11 inches. | ||
| marginTop | number | 上边距,以英寸为单位。默认为1厘米(约0.4英寸)。 | ENTop margin in inches. Defaults to 1cm (~0.4 inches). | ||
| marginBottom | number | 底部边距,单位为英寸。默认为1厘米(约0.4英寸)。 | ENBottom margin in inches. Defaults to 1cm (~0.4 inches). | ||
| marginLeft | number | 左边距(以英寸为单位)。默认为1厘米(约0.4英寸)。 | ENLeft margin in inches. Defaults to 1cm (~0.4 inches). | ||
| marginRight | number | 右边距,单位为英寸。默认为1厘米(约0.4英寸)。 | ENRight margin in inches. Defaults to 1cm (~0.4 inches). | ||
| pageRanges | string | 要打印的纸张范围,基于一页起始,例如'1-5, 8, 11-13'。页面按文档顺序而非指定顺序打印,且每页最多打印一次。默认为空字符串,表示打印整个文档。页码会静默限制在文档实际页数内,超出文档末尾的范围将被忽略。若因此导致无页面可打印,将报告错误。指定起始页码大于结束页码的范围将导致错误。 | ENPaper ranges to print, one based, e.g., '1-5, 8, 11-13'. Pages are printed in the document order, not in the order specified, and no more than once. Defaults to empty string, which implies the entire document is printed. The page numbers are quietly capped to actual page count of the document, and ranges beyond the end of the document are ignored. If this results in no pages to print, an error is reported. It is an error to specify a range with start greater than end. | ||
| headerTemplate | string | 打印页眉的HTML模板。应为有效的HTML标记,使用以下类将打印值注入其中: - date:格式化后的打印日期- title:文档标题- url:文档位置- pageNumber:当前页码- totalPages:文档总页数例如, <span class=title></span>将生成包含标题的span元素。 | ENHTML template for the print header. Should be valid HTML markup with following classes used to inject printing values into them:- date: formatted print date- title: document title- url: document location- pageNumber: current page number- totalPages: total pages in the documentFor example, <span class=title></span> would generate span containing the title. | ||
| footerTemplate | string | 打印页脚的HTML模板。应使用与headerTemplate相同的格式。 | ENHTML template for the print footer. Should use the same format as theheaderTemplate. | ||
| preferCSSPageSize | boolean | 是否优先使用CSS定义的页面尺寸。默认为false,这种情况下内容将缩放以适应纸张大小。 | ENWhether or not to prefer page size as defined by css. Defaults to false, in which case the content will be scaled to fit the paper size. | ||
| transferMode | 🧪 | string | 以流的形式返回 允许的值: ReturnAsBase64、ReturnAsStream | ENreturn as streamAllowed Values: ReturnAsBase64, ReturnAsStream | |
| generateTaggedPDF | 🧪 | boolean | 是否生成带标签(可访问)的PDF。默认为嵌入器选择。 | ENWhether or not to generate tagged (accessible) PDF. Defaults to embedder choice. | |
| generateDocumentOutline | 🧪 | boolean | 是否将文档大纲嵌入到PDF中。 | ENWhether or not to embed the document outline into the PDF. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| data | string | Base64编码的pdf数据。如果指定了|returnAsStream|,则为空。(通过JSON传递时编码为base64字符串) | ENBase64-encoded pdf data. Empty if |returnAsStream| is specified. (Encoded as a base64 string when passed over JSON) |
| stream | IO.StreamHandle | 一个流句柄,用于保存生成的PDF数据。 | ENA handle of the stream that holds resulting PDF data. |
🔨Page.reload
重新加载指定页面,可选择忽略缓存。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| ignoreCache | boolean | 如果为真,浏览器缓存将被忽略(如同用户按下了 Shift+刷新)。 | ENIf true, browser cache is ignored (as if the user pressed Shift+refresh). | ||
| scriptToEvaluateOnLoad | string | 如果设置,脚本将在重新加载后注入到被检查页面的所有框架中。如果重新加载的数据URL来源,参数将被忽略。 | ENIf set, the script will be injected into all frames of the inspected page after reload. Argument will be ignored if reloading dataURL origin. | ||
| loaderId | 🧪 | Network.LoaderId | 如果设置此选项,当目标页面主框架的加载器ID与提供的ID不匹配时,将抛出错误。这可以防止在发生竞态导航时意外重新加载非预期目标。 | ENIf set, an error will be thrown if the target page's main frame's loader id does not match the provided id. This prevents accidentally reloading an unintended target in case there's a racing navigation. |
🔨Page.removeScriptToEvaluateOnNewDocument
从列表中移除给定的脚本。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| identifier | ✔️ | ScriptIdentifier |
🔨Page.resetNavigationHistory
重置当前页面的导航历史记录。
EN
🔨Page.setBypassCSP
启用页面内容安全策略绕过。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| enabled | ✔️ | boolean | 是否绕过页面CSP。 | ENWhether to bypass page CSP. |
🔨Page.setDocumentContent
将给定的标记设置为文档的HTML。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| frameId | ✔️ | FrameId | 要设置 HTML 的框架 ID。 | ENFrame id to set HTML for. | |
| html | ✔️ | string | 要设置的HTML内容。 | ENHTML content to set. |
🔨Page.setInterceptFileChooserDialog
拦截文件选择器请求并将控制权转移给协议客户端。启用文件选择器拦截后,不会显示原生文件选择对话框,而是会触发协议事件 Page.fileChooserOpened。
EN
Page.fileChooserOpened is emitted.| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| enabled | ✔️ | boolean | |||
| cancel | 🧪 | boolean | 如果为真,除了在启用拦截时不显示对话框外,还会通过发出相关事件(如果有)来取消对话框(默认值:false)。 | ENIf true, cancels the dialog by emitting relevant events (if any) in addition to not showing it if the interception is enabled (default: false). |
🔨Page.setLifecycleEventsEnabled
控制页面是否发出生命周期事件。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| enabled | ✔️ | boolean | 如果为真,则开始触发生命周期事件。 | ENIf true, starts emitting lifecycle events. |
🔨Page.stopLoading
强制页面停止所有导航和待处理的资源获取。
EN
🔨Page.clearGeolocationOverride❌️
清除被覆盖的地理位置定位和错误信息。
EN
🔨Page.setGeolocationOverride❌️
覆盖地理位置位置或错误。省略任何参数将模拟位置不可用。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| latitude | number | 模拟纬度 | ENMock latitude | ||
| longitude | number | 模拟经度 | ENMock longitude | ||
| accuracy | number | 模拟准确度 | ENMock accuracy |
🔨Page.addCompilationCache🧪
为给定URL预 填充编译缓存。编译缓存不会在跨进程导航中保留。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| url | ✔️ | string | |||
| data | ✔️ | string | Base64编码数据(在JSON中传递时编码为base64字符串) | ENBase64-encoded data (Encoded as a base64 string when passed over JSON) |
🔨Page.captureSnapshot🧪
返回页面的快照字符串。对于MHTML格式,序列化包含iframe、shadow DOM、外部资源以及元素内联样式。
EN
| 参数 | 必填 | 标记 | 类 型 | 描述 | 原文 |
|---|---|---|---|---|---|
| format | string | 格式(默认为mhtml)。 允许的值: mhtml | ENFormat (defaults to mhtml).Allowed Values: mhtml |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| data | string | 序列化页面数据。 | ENSerialized page data. |
🔨Page.clearCompilationCache🧪
清除已播种的编译缓存。
EN
🔨Page.crash🧪
在IO线程上崩溃渲染器,生成minidumps。
EN
🔨Page.generateTestReport🧪
为测试生成报告。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| message | ✔️ | string | 要在报告中显示的消息。 | ENMessage to be displayed in the report. | |
| group | string | 指定将报告发送到的端点组。 | ENSpecifies the endpoint group to deliver the report to. |
🔨Page.getAdScriptAncestry🧪
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| frameId | ✔️ | FrameId |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| adScriptAncestry | AdScriptAncestry | 导致此框架创建的广告脚本标识符的祖先链,以及根脚本的过滤列表规则。祖先链按照从最直接的脚本(在框架创建堆栈中)到更远的祖先(创建了紧邻的前一个脚本)的顺序排列。仅在框架被标记为广告且标识符可用时发送。 | ENThe ancestry chain of ad script identifiers leading to this frame's creation, along with the root script's filterlist rule. The ancestry chain is ordered from the most immediate script (in the frame creation stack) to more distant ancestors (that created the immediately preceding script). Only sent if frame is labelled as an ad and ids are available. |
🔨Page.getAnnotatedPageContent🧪
获取主框架的带注释页面内容。这是一个实验性命令,可能会发生变化。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| includeActionableInformation | boolean | 是否包含可操作信息。默认为 true。 | ENWhether to include actionable information. Defaults to true. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| content | string | 带注释的页面内容以base64编码的protobuf格式呈现。该格式由components/optimization_guide/proto/features/common_quality_data.proto文件中的AnnotatedPageContent消息定义(通过JSON传递时以base64字符串形式编码) | ENThe annotated page content as a base64 encoded protobuf. The format is defined by theAnnotatedPageContent message in components/optimization_guide/proto/features/common_quality_data.proto (Encoded as a base64 string when passed over JSON) |
🔨Page.getAppId🧪
返回唯一的(PWA)应用标识符。仅当功能标志'WebAppEnableManifestId'启用时返回值
EN
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| appId | string | 应用ID,来自清单的id属性或根据start_url计算得出 | ENApp id, either from manifest's id attribute or computed from start_url |
| recommendedId | string | 建议manifest的id属性与从start_url计算出的当前id相匹配 | ENRecommendation for manifest's id attribute to match current id computed from start_url |
🔨Page.getInstallabilityErrors🧪
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| installabilityErrors | array[InstallabilityError] |
🔨Page.getOriginTrials🧪
在指定框架上获取原始试验。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| frameId | ✔️ | FrameId |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| originTrials | array[OriginTrial] |
🔨Page.getPermissionsPolicyState🧪
获取给定框架的权限策略状态。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| frameId | ✔️ | FrameId |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| states | array[PermissionsPolicyFeatureState] |
🔨Page.getResourceContent🧪
返回给定资源的''内容''。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| frameId | ✔️ | FrameId | 要获取资源的框架ID。 | ENFrame id to get resource for. | |
| url | ✔️ | string | 获取内容的资源URL。 | ENURL of the resource to get content for. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| content | string | 资源内容。 | ENResource content. |
| base64Encoded | boolean | 是的,如果内容是以 base64 格式提供的。 | ENTrue, if content was served as base64. |
🔨Page.getResourceTree🧪
返回当 前的框架/资源树结构。
EN
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| frameTree | FrameResourceTree | 呈现框架/资源树结构。 | ENPresent frame / resource tree structure. |
🔨Page.produceCompilationCache🧪
请求后端为指定脚本生成编译缓存。scripts 将被追加到待生成缓存的脚本列表中。该列表可能在页面导航期间被重置。当遇到URL匹配的脚本时,后端会根据内部启发式算法自主决定是否生成缓存。另请参阅:Page.compilationCacheProduced。
EN
scripts are appended to the list of scripts for which the cache would be produced. The list may be reset during page navigation. When script with a matching URL is encountered, the cache is optionally produced upon backend discretion, based on internal heuristics. See also: Page.compilationCacheProduced.| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| scripts | ✔️ | array[CompilationCacheParams] |
🔨Page.screencastFrameAck🧪
确认前端已接收到屏幕广播帧。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| sessionId | ✔️ | integer | 帧编号。 | ENFrame number. |
🔨Page.searchInResource🧪
在资源内容中搜索给定的字符串。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| frameId | ✔️ | FrameId | 要在其中搜索资源的帧ID。 | ENFrame id for resource to search in. | |
| url | ✔️ | string | 要在其中搜索资源的URL。 | ENURL of the resource to search in. | |
| query | ✔️ | string | 搜索的字符串。 | ENString to search for. | |
| caseSensitive | boolean | 如果为真,则区分大小写。 | ENIf true, search is case sensitive. | ||
| isRegex | boolean | 如果为真,则将字符串参数视为正则表达式。 | ENIf true, treats string parameter as regex. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| result | array[Debugger.SearchMatch] | 搜索结果列 表。 | ENList of search matches. |
🔨Page.setAdBlockingEnabled🧪
在所有网站上启用Chrome的实验性广告过滤器。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| enabled | ✔️ | boolean | 是否屏蔽广告。 | ENWhether to block ads. |
🔨Page.setFontFamilies🧪
设置通用字体族。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| fontFamilies | ✔️ | FontFamilies | 指定要设置的字体家族。如果未指定字体家族,则不会更改。 | ENSpecifies font families to set. If a font family is not specified, it won't be changed. | |
| forScripts | array[ScriptFontFamilies] | 指定为各脚本设置的字体族。 | ENSpecifies font families to set for individual scripts. |
🔨Page.setFontSizes🧪
设置默认字体大小。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| fontSizes | ✔️ | FontSizes | 指定要设置的字体大小。如果未指定字体大小,则不会更改。 | ENSpecifies font sizes to set. If a font size is not specified, it won't be changed. |
🔨Page.setPrerenderingAllowed🧪
手动启用/禁用预渲染。
此命令是应对 https://crbug.com/1440085 的短期解决方案。详见 https://docs.google.com/document/d/12HVmFxYj5Jc-eJr5OmWsa2bqTJsbgGLKI6ZIyx0_wpA。
待办事项(https://crbug.com/1440085):待 Puppeteer 支持标签页目标后移除此项。
EN
This command is a short-term solution for https://crbug.com/1440085. See https://docs.google.com/document/d/12HVmFxYj5Jc-eJr5OmWsa2bqTJsbgGLKI6ZIyx0_wpA for more details.
TODO(https://crbug.com/1440085): Remove this once Puppeteer supports tab targets.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| isAllowed | ✔️ | boolean |
🔨Page.setRPHRegistrationMode🧪
Custom Handlers API 的扩展:https://html.spec.whatwg.org/multipage/system-state.html#rph-automation
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| mode | ✔️ | string | 允许的值:none、autoAccept、autoReject | ENAllowed Values:none, autoAccept, autoReject |
🔨Page.setSPCTransactionMode🧪
设置安全支付确认交易模式。https://w3c.github.io/secure-payment-confirmation/#sctn-automation-set-spc-transaction-mode
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| mode | ✔️ | string | 允许的值:none、autoAccept、autoChooseToAuthAnotherWay、autoReject、autoOptOut | ENAllowed Values:none, autoAccept, autoChooseToAuthAnotherWay, autoReject, autoOptOut |
🔨Page.setWebLifecycleState🧪
尝试更新页面的Web生命周期状态。它将根据以下规范将页面过渡到给定状态:https://github.com/WICG/web-lifecycle/
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| state | ✔️ | string | 目标生命周期状态 允许的取值: frozen、active | ENTarget lifecycle stateAllowed Values: frozen, active |
🔨Page.startScreencast🧪
开始使用 screencastFrame 事件发送每一帧。
EN
screencastFrame event.| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| format | string | 图像压缩格式。 允许的取值: jpeg、png | ENImage compression format.Allowed Values: jpeg, png | ||
| quality | integer | 压缩质量范围从[0..100]。 | ENCompression quality from range [0..100]. | ||
| maxWidth | integer | 最大截图宽度。 | ENMaximum screenshot width. | ||
| maxHeight | integer | 最大截图高度。 | ENMaximum screenshot height. | ||
| everyNthFrame | integer | 发送每第n帧。 | ENSend every n-th frame. |
🔨Page.stopScreencast🧪
停止发送 screencastFrame 中的每一帧。
EN
screencastFrame.🔨Page.waitForDebugger🧪
暂停页面执行。可通过通用的Runtime.runIfWaitingForDebugger恢复执行。
EN
🔨Page.addScriptToEvaluateOnLoad🧪❌️
已弃用,请改用 addScriptToEvaluateOnNewDocument。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| scriptSource | ✔️ | string |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| identifier | ScriptIdentifier | 添加的脚本的标识符。 | ENIdentifier of the added script. |