/** * Form Handler * * P1 - Advanced form interactions * * Supports: * - Auto-detect form fields * - Smart field type detection (input, select, textarea, checkbox, radio) * - Fill forms with data * - Form validation detection * - Submit handling * * @see https://playwright.dev/docs/input */ export interface FormField { /** Field selector */ selector: string; /** Field type */ type: 'input' | 'select' | 'textarea' | 'checkbox' | 'radio' | 'file' | 'date' | 'email' | 'tel' | 'number'; /** Field name/label */ name?: string; /** Current value */ value?: string; /** Required flag */ required?: boolean; /** Disabled flag */ disabled?: boolean; /** Options (for select/radio) */ options?: string[]; } export interface FormData { /** Form selector */ selector?: string; /** Fields in the form */ fields: FormField[]; /** Submit button selector */ submitButton?: string; } export interface FormConfig { /** Form selector (optional, defaults to first form) */ formSelector?: string; /** Auto-detect fields */ autoDetect?: boolean; /** Fill timeout per field */ timeout?: number; /** Clear before fill */ clearBeforeFill?: boolean; } export interface FormFillData { /** Field values by name/label */ [fieldName: string]: string | string[] | boolean | number; } export interface FormResult { success: boolean; filled?: number; errors?: string[]; validationErrors?: string[]; } /** * Form Handler class */ export declare class FormHandler { /** * Detect form fields on a page */ detectFormFields(page: any, config?: FormConfig): Promise; /** * Fill a form with data */ fillForm(page: any, data: FormFillData, config?: FormConfig): Promise; /** * Fill a single field */ fillField(page: any, field: FormField, value: string | string[] | boolean | number, config?: FormConfig): Promise; /** * Submit a form */ submitForm(page: any, config?: FormConfig): Promise; /** * Detect form validation errors */ detectValidationErrors(page: any, config?: FormConfig): Promise; /** * Fill and submit a form in one action */ fillAndSubmit(page: any, data: FormFillData, config?: FormConfig): Promise; /** * Get form data as object (extract current values) */ getFormData(page: any, config?: FormConfig): Promise>; /** * Clear all form fields */ clearForm(page: any, config?: FormConfig): Promise; } /** * Factory function to create Form Handler */ export declare function createFormHandler(): FormHandler; export default FormHandler;