Autofill🧪
为自动填充定义命令和事件。
EN
Defines commands and events for Autofill.
✅️️ Methods
🔨Autofill.disable
禁用自动填充域名通知。
EN
Disables autofill domain notifications.
🔨Autofill.enable
启用自动填充域名通知。
EN
Enables autofill domain notifications.
🔨Autofill.setAddresses
设置地址,以便开发者可以验证其表单实现。
EN
Set addresses so that developers can verify their forms implementation.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| addresses | ✔️ | array[Address] |
🔨Autofill.trigger
在由 fieldId 标识的表单上触发自动填充。如果该字段及相关表单无法自动填充,则返回错误。
EN
Trigger autofill on a form identified by the fieldId. If the field and related form cannot be autofilled, returns an error.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| fieldId | ✔️ | DOM.BackendNodeId | 标识一个作为自动填充锚点的字段。 | ENIdentifies a field that serves as an anchor for autofill. | |
| frameId | Page.FrameId | 标识字段所属的框架。 | ENIdentifies the frame that field belongs to. | ||
| card | CreditCard | 填写表单所需的信用卡信息。信用卡数据不会被保存。与 address 互斥。 | ENCredit card information to fill out the form. Credit card data is not saved. Mutually exclusive withaddress. | ||
| address | Address | 填写表单的地址。地址数据不会被保存。与 card 互斥。 | ENAddress to fill out the form. Address data is not saved. Mutually exclusive withcard. |
✅️️ Events
👋Autofill.addressFormFilled
当''地址''表单被填写时触发。
EN
Emitted when an address form is filled.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| filledFields | ✔️ | array[FilledField] | 有关已填写字段的信息 | ENInformation about the fields that were filled | |
| addressUi | ✔️ | AddressUI | 用于填充表单的地址的用户界面表示形式。由二维数组组成,其中每个子项代表一个地址/配置文件行。 | ENAn UI representation of the address used to fill the form. Consists of a 2D array where each child represents an address/profile line. |
✅️️ Types
📌Autofill.Address
返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| fields | ✔️ | array[AddressField] | 定义地址的字段和值。 | ENfields and values defining an address. |
📌Autofill.AddressField
返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| name | ✔️ | string | 地址字段名称,例如 GIVEN_NAME。支持的字段名称完整列表:https://source.chromium.org/chromium/chromium/src/+/main:components/autofill/core/browser/field_types.cc;l=38 | ENaddress field name, for example GIVEN_NAME. The full list of supported field names: https://source.chromium.org/chromium/chromium/src/+/main:components/autofill/core/browser/field_types.cc;l=38 | |
| value | ✔️ | string | 地址字段值,例如 Jon Doe。 | ENaddress field value, for example Jon Doe. |
📌Autofill.AddressFields
一个地址字段列表。
EN
A list of address fields.
返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| fields | ✔️ | array[AddressField] |
📌Autofill.AddressUI
定义如何在类似chrome://settings/addresses的界面中显示地址。地址用户界面是一个二维数组,每个内部数组代表一个"地址信息行",在用户界面渲染时应按此规则显示。例如以下地址用户界面:[[{name: "GIVE_NAME", value: "Jon"}, {name: "FAMILY_NAME", value: "Doe"}], [{name: "CITY", value: "Munich"}, {name: "ZIP", value: "81456"}]] 应使接收方能够渲染为:Jon Doe Munich 81456
EN
Defines how an address can be displayed like in chrome://settings/addresses. Address UI is a two dimensional array, each inner array is an "address information line", and when rendered in a UI surface should be displayed as such. The following address UI for instance: [[{name: "GIVE_NAME", value: "Jon"}, {name: "FAMILY_NAME", value: "Doe"}], [{name: "CITY", value: "Munich"}, {name: "ZIP", value: "81456"}]] should allow the receiver to render: Jon Doe Munich 81456
返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| addressFields | ✔️ | array[AddressFields] | 一个二维数组,包含地址配置文件中值的表示形式。 | ENA two dimension array containing the representation of values from an address profile. |
📌Autofill.CreditCard
返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| number | ✔️ | string | 16位信用卡号。 | EN16-digit credit card number. | |
| name | ✔️ | string | 信用卡持有人的姓名。 | ENName of the credit card owner. | |
| expiryMonth | ✔️ | string | 2位数的到期月份。 | EN2-digit expiry month. | |
| expiryYear | ✔️ | string | 4位数的到期年份。 | EN4-digit expiry year. | |
| cvc | ✔️ | string | 3位数的卡片验证码。 | EN3-digit card verification code. |
📌Autofill.FilledField
返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| htmlType | ✔️ | string | 字段的类型,例如 text、password 等。 | ENThe type of the field, e.g text, password etc. | |
| id | ✔️ | string | html id | ENthe html id | |
| name | ✔️ | string | html 名称 | ENthe html name | |
| value | ✔️ | string | 字段值 | ENthe field value | |
| autofillType | ✔️ | string | 实际字段类型,例如 FAMILY_NAME | ENThe actual field type, e.g FAMILY_NAME | |
| fillingStrategy | ✔️ | FillingStrategy | 填充策略 | ENThe filling strategy | |
| frameId | ✔️ | Page.FrameId | 字段所属的框架 | ENThe frame the field belongs to | |
| fieldId | ✔️ | DOM.BackendNodeId | 表单字段的DOM节点 | ENThe form field's DOM node |
📌Autofill.FillingStrategy
指定已填写的字段是通过使用HTML自动完成属性还是自动填充启发式方法完成的。
允许的值:autocompleteAttribute、autofillInferred
EN
Specified whether a filled field was done so by using the html autocomplete attribute or autofill heuristics.
Allowed Values:
Allowed Values:
autocompleteAttribute, autofillInferred返回类型:string