fillForm
Fills a form on a web page with specified inputs and submits the form. the function handles static data, and can derive data using ai using your input. the function has the ability to detect form submission errors and use ai to recover from these errors.
Examples
Parameters
• page: Page
The Playwright Page where the form is located.
• options
• options.autoRecoveryOptions?
Optional. Options for auto-recovery in case of form submission failure.
• options.autoRecoveryOptions.enabled: boolean
Whether auto-recovery is enabled
• options.autoRecoveryOptions.fieldsToMask?: ElementSelector
[]
Fields to mask during auto-recovery, use this if you do not want to send your form values to ai.
• options.autoRecoveryOptions.generateDataToUnblockForm?
• options.autoRecoveryOptions.generateDataToUnblockForm.enabled: boolean
Whether generating data to unblock the form is enabled.
• options.autoRecoveryOptions.generateDataToUnblockForm.prompt: string
The prompt to use for generating data.
• options.autoRecoveryOptions.maxRetries?: number
Maximum number of retries for auto-recovery
• options.autoRecoveryOptions.recoveryData: object
Data to use for auto-recovery
• options.fillFieldTimeout?: number
Optional. Timeout for filling each individual field.
• options.formInput: (DynamicFormInputItem
| StaticFormInputItem
)[]
An array of form input items (dynamic or static).
• options.formLocator: Locator
| ElementSelector
The locator for the form element.
• options.isSubmitSuccessful
A function to check if the form submission was successful.
• options.submitForm
A function to submit the form.
• options.timeout?: number
Optional. Timeout for the entire form filling process.
• options.waitTimeBetweenFill?: number
Optional. Wait time between filling each field.
Returns
Promise
<boolean
>
A promise that resolves to a boolean indicating whether the form submission was successful.