Skip to main content
Validate that a field mapping is correct for the current form.
fields = await page.extract_form_fields()
is_valid = await page.validate_mapping(
    form_fields=fields,
    mapping={0: "John", 1: "Doe"},
    prompt="Validate the name fields are filled correctly",
)
ParameterTypeRequiredDescription
form_fieldslist[dict[str, Any]]YesField metadata returned by extract_form_fields.
mappingdict[int, str | list | bool | None]YesMap of field index to the value to validate.
promptstr | NoneYesInstruction describing what to validate.
Returns boolTrue if the mapping is valid, False otherwise.