Project 30: Form Automation Engine - Smart Data Entry

Project 30: Form Automation Engine - Smart Data Entry

Build an intelligent form-filling system that uses Claudeโ€™s reasoning to understand form context, generate appropriate test data, handle validation errors, and complete multi-step workflows.

Quick Reference

Attribute Value
Difficulty Advanced
Time Estimate 1-2 weeks
Language TypeScript (Alternatives: JavaScript, Python)
Prerequisites Project 29 (Visual Page Analyzer), form validation concepts
Key Topics Form automation, test data generation, validation handling, session management
Main Book โ€œTesting Web Applicationsโ€ by Hung Q. Nguyen

1. Learning Objectives

By completing this project, you will:

  1. Analyze form structure semantically: Understand form fields by their context, not just their HTML attributes
  2. Generate contextual test data: Create realistic but fake data appropriate for each field type
  3. Handle validation intelligently: Detect validation errors, understand them, and adapt
  4. Manage multi-step workflows: Track state across form wizards and multi-page flows
  5. Coordinate browser tools: Chain form_input, read_page, and navigation tools effectively
  6. Build retry logic: Implement intelligent retry strategies for transient failures

2. Theoretical Foundation

2.1 Form Semantics: Beyond HTML Attributes

Forms communicate meaning through multiple channels:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                         Form Field Semantics                                 โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                                                                              โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                โ”‚
โ”‚  โ”‚    Explicit   โ”‚    โ”‚   Implicit    โ”‚    โ”‚   Contextual  โ”‚                โ”‚
โ”‚  โ”‚    Signals    โ”‚    โ”‚    Signals    โ”‚    โ”‚    Signals    โ”‚                โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                โ”‚
โ”‚         โ”‚                    โ”‚                    โ”‚                          โ”‚
โ”‚         โ–ผ                    โ–ผ                    โ–ผ                          โ”‚
โ”‚  - type="email"        - name="pwd"         - "Billing" section             โ”‚
โ”‚  - type="tel"          - id="dob"           - Near "credit card"            โ”‚
โ”‚  - type="date"         - placeholder        - After "shipping"              โ”‚
โ”‚  - required attr       - autocomplete       - Form title/heading            โ”‚
โ”‚  - pattern attr        - aria-label         - Field grouping                โ”‚
โ”‚  - label element       - class names        - Other field values            โ”‚
โ”‚                                                                              โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Key Insight: Claudeโ€™s reasoning capability allows analyzing all these signals together, making smarter decisions than simple pattern matching.

2.2 HTML5 Form Elements and Validation

Input Type Purpose Validation Example Test Data
text General text Pattern, minlength, maxlength โ€œJohn Doeโ€
email Email address Email format validation โ€œtest42857@example.comโ€
password Secure input minlength, pattern โ€œSecureP@ss2024!โ€
tel Phone number Pattern โ€œ+1 (555) 123-4567โ€
url Web address URL format โ€œhttps://example.comโ€
number Numeric input min, max, step โ€œ42โ€
date Date picker min, max dates โ€œ2024-12-25โ€
select Dropdown Required selection (pick from options)
checkbox Boolean toggle Required true/false
radio Single choice Required selection (pick from group)
file File upload Accept types (special handling)

2.3 Client-Side vs Server-Side Validation

Form Submission Flow:

User Input โ”€โ”€โ–ถ Client Validation โ”€โ”€โ–ถ Server Validation โ”€โ”€โ–ถ Success/Error
                    โ”‚                       โ”‚
                    โ–ผ                       โ–ผ
              Immediate                 May redirect
              feedback                  or show error
              (red border,              (page reload,
               error text)               toast message)

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                      Validation Detection Points                             โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                                                                              โ”‚
โ”‚  Client-Side:                        Server-Side:                           โ”‚
โ”‚  โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€                       โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€                           โ”‚
โ”‚  โ€ข HTML5 constraint validation       โ€ข Form rejection with error message    โ”‚
โ”‚  โ€ข JavaScript validation events      โ€ข Field-specific error markers         โ”‚
โ”‚  โ€ข Inline error messages             โ€ข Toast/alert notifications            โ”‚
โ”‚  โ€ข Field border/style changes        โ€ข Page redirect to error state         โ”‚
โ”‚  โ€ข aria-invalid attribute            โ€ข JSON error response (AJAX)           โ”‚
โ”‚  โ€ข Form :invalid pseudo-class        โ€ข HTTP 400/422 status codes            โ”‚
โ”‚                                                                              โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

2.4 Multi-Step Form Patterns

Common multi-step (wizard) form patterns:

Pattern 1: Single Page with Steps
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Step 1  โ”€โ”€โ–ถ  Step 2  โ”€โ”€โ–ถ  Step 3       โ”‚
โ”‚  [Account]    [Profile]   [Confirm]     โ”‚
โ”‚                                         โ”‚
โ”‚  Only one section visible at a time     โ”‚
โ”‚  State stored in JavaScript             โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Pattern 2: Multi-Page Flow
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Page 1  โ”‚โ”€โ”€โ”€โ–ถโ”‚  Page 2  โ”‚โ”€โ”€โ”€โ–ถโ”‚  Page 3  โ”‚
โ”‚ /signup  โ”‚    โ”‚/signup/2 โ”‚    โ”‚/signup/3 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
     โ”‚                                โ”‚
     โ””โ”€โ”€โ”€โ”€โ”€โ”€ Session/Cookie โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Pattern 3: Modal Sequence
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Main Page                              โ”‚
โ”‚    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                    โ”‚
โ”‚    โ”‚  Modal 1      โ”‚โ”€โ”€โ–ถ Modal 2 โ”€โ”€โ–ถ ... โ”‚
โ”‚    โ”‚  [Details]    โ”‚                    โ”‚
โ”‚    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

2.5 Test Data Generation Strategies

Strategy When to Use Example
Random + Suffix Email uniqueness testuser_${timestamp}@example.com
Faker patterns Realistic looking data โ€œJohn Smithโ€, โ€œ123 Main Stโ€
Edge cases Testing validation โ€œa@b.cโ€ (min valid email)
Boundary values Numeric limits min-1, min, max, max+1
Format specific Pattern matching SSN: โ€œ123-45-6789โ€

3. Project Specification

3.1 What You Will Build

A form automation system that:

  1. Discovers forms on any page
  2. Classifies each fieldโ€™s expected data type
  3. Generates appropriate test data
  4. Fills forms intelligently
  5. Detects and handles validation errors
  6. Tracks multi-step form progress
  7. Reports results with detailed logs

3.2 Functional Requirements

  1. Form Discovery
    • Find all forms on a page
    • Identify form boundaries
    • Map field relationships (password confirmation, etc.)
  2. Field Classification
    • Determine expected data format
    • Identify required vs optional
    • Detect dependent fields (country โ†’ state)
  3. Data Generation
    • Create contextually appropriate data
    • Generate unique values when needed
    • Handle special formats (SSN, phone, etc.)
  4. Form Filling
    • Enter data in correct order
    • Handle select dropdowns
    • Toggle checkboxes appropriately
  5. Validation Handling
    • Detect client-side errors
    • Adapt and retry with different data
    • Track which approaches worked
  6. Multi-Step Support
    • Track current step
    • Navigate between steps
    • Maintain state across pages

3.3 Example Interaction

You: Fill out the signup form at https://example.com/signup with test data

Claude: I'll analyze the form and fill it appropriately.

[Navigating to signup page...]
[Analyzing form structure...]

================================================================================
                    FORM ANALYSIS: example.com/signup
================================================================================

FORM DISCOVERED: Signup Form (6 fields)
---------------------------------------

Field Analysis:
  1. Full Name       [text, required]      โ†’ Classified as: PERSON_NAME
  2. Email           [email, required]     โ†’ Classified as: EMAIL
  3. Password        [password, required]  โ†’ Classified as: PASSWORD
                     Pattern: (?=.*\d)(?=.*[a-z])(?=.*[A-Z])
  4. Confirm Password[password, required]  โ†’ Classified as: PASSWORD_CONFIRM
  5. Country         [select, required]    โ†’ Classified as: COUNTRY_SELECT
  6. Terms           [checkbox, required]  โ†’ Classified as: TERMS_CHECKBOX

Dependencies Detected:
  - Password โ†” Confirm Password (must match)

FILLING FORM
------------

Generating test data...
  Full Name:        "Test User 42857"
  Email:            "testuser42857@example.com"
  Password:         [generated: 16 chars, meets pattern]
  Confirm Password: [matching]
  Country:          "United States"
  Terms:            [will check]

Filling fields...
  [ref_1] Full Name........... DONE
  [ref_2] Email............... DONE
  [ref_3] Password............ DONE
  [ref_4] Confirm Password.... DONE
  [ref_5] Country............. DONE
  [ref_6] Terms............... DONE

Checking for validation errors...

VALIDATION ERROR DETECTED
-------------------------
  Message: "Email already exists"
  Field: Email

  Strategy: Generate new unique email
  New value: "testuser42858@example.com"

  Retrying...

RETRY SUCCESSFUL
----------------

Form filled successfully!

Actions available:
  1. Submit the form
  2. Generate different test data
  3. Show the generated credentials

What would you like to do?

4. Solution Architecture

4.1 High-Level Design

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                         Form Automation Engine                               โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                                                                              โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
โ”‚  โ”‚     Form     โ”‚โ”€โ”€โ–ถโ”‚    Field     โ”‚โ”€โ”€โ–ถโ”‚     Data     โ”‚โ”€โ”€โ–ถโ”‚    Form      โ”‚  โ”‚
โ”‚  โ”‚   Discovery  โ”‚   โ”‚  Classifier  โ”‚   โ”‚  Generator   โ”‚   โ”‚   Filler     โ”‚  โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
โ”‚                                                                  โ”‚           โ”‚
โ”‚                                                                  โ–ผ           โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚  โ”‚    Report    โ”‚โ—€โ”€โ”€โ”‚    Retry     โ”‚โ—€โ”€โ”€โ”‚        Validation Detector       โ”‚ โ”‚
โ”‚  โ”‚   Generator  โ”‚   โ”‚    Engine    โ”‚   โ”‚                                  โ”‚ โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ”‚                                                                              โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

4.2 Field Classification System

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                         Field Classifier Logic                               โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                                                                              โ”‚
โ”‚  Input: Field element from accessibility tree                                โ”‚
โ”‚                                                                              โ”‚
โ”‚  Signal Extraction:                                                          โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚  โ”‚  type: "password"                                                       โ”‚ โ”‚
โ”‚  โ”‚  name: "confirmPassword"                                                โ”‚ โ”‚
โ”‚  โ”‚  label: "Confirm your password"                                         โ”‚ โ”‚
โ”‚  โ”‚  placeholder: "Re-enter password"                                       โ”‚ โ”‚
โ”‚  โ”‚  autocomplete: "new-password"                                           โ”‚ โ”‚
โ”‚  โ”‚  aria-describedby: "password-hint"                                      โ”‚ โ”‚
โ”‚  โ”‚  pattern: "(?=.*\d)(?=.*[a-z])"                                         โ”‚ โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ”‚                                                                              โ”‚
โ”‚  Classification Rules (priority order):                                      โ”‚
โ”‚                                                                              โ”‚
โ”‚  1. "password" AND ("confirm" OR "repeat" OR "verify") โ†’ PASSWORD_CONFIRM   โ”‚
โ”‚  2. type="password" โ†’ PASSWORD                                              โ”‚
โ”‚  3. type="email" OR name contains "email" โ†’ EMAIL                           โ”‚
โ”‚  4. type="tel" OR name contains "phone" โ†’ PHONE                             โ”‚
โ”‚  5. name contains "ssn" OR "social" โ†’ SSN                                   โ”‚
โ”‚  6. name contains "zip" OR "postal" โ†’ POSTAL_CODE                           โ”‚
โ”‚  7. name contains "first" AND "name" โ†’ FIRST_NAME                           โ”‚
โ”‚  8. name contains "last" AND "name" โ†’ LAST_NAME                             โ”‚
โ”‚  9. type="date" OR name contains "dob" โ†’ DATE                               โ”‚
โ”‚  10. type="number" โ†’ NUMBER                                                 โ”‚
โ”‚  11. type="url" โ†’ URL                                                       โ”‚
โ”‚  12. <select> element โ†’ SELECT (analyze options)                            โ”‚
โ”‚  13. type="checkbox" โ†’ CHECKBOX (check context)                             โ”‚
โ”‚  14. Default โ†’ TEXT                                                          โ”‚
โ”‚                                                                              โ”‚
โ”‚  Output: Field classification + generation strategy                          โ”‚
โ”‚                                                                              โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

4.3 Data Generation Patterns

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                         Data Generation Patterns                             โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                                                                              โ”‚
โ”‚  EMAIL:                                                                      โ”‚
โ”‚    Pattern: testuser_{random_id}@example.com                                 โ”‚
โ”‚    Example: testuser_42857@example.com                                       โ”‚
โ”‚    Retry:   Increment random_id                                              โ”‚
โ”‚                                                                              โ”‚
โ”‚  PASSWORD:                                                                   โ”‚
โ”‚    Requirements: Parse from pattern attribute or defaults                    โ”‚
โ”‚    Default: 16 chars, 1 upper, 1 lower, 1 digit, 1 special                  โ”‚
โ”‚    Example: SecureP@ss2024!                                                  โ”‚
โ”‚                                                                              โ”‚
โ”‚  PHONE:                                                                      โ”‚
โ”‚    US Format: (555) 123-{random 4 digits}                                   โ”‚
โ”‚    Example: (555) 123-4567                                                   โ”‚
โ”‚                                                                              โ”‚
โ”‚  DATE:                                                                       โ”‚
โ”‚    Past: Random date 18-65 years ago (for DOB)                              โ”‚
โ”‚    Future: Random date within 1 year (for appointments)                      โ”‚
โ”‚    Format: YYYY-MM-DD (HTML5 standard)                                       โ”‚
โ”‚                                                                              โ”‚
โ”‚  NAME:                                                                       โ”‚
โ”‚    Pattern: "Test User {random_id}"                                         โ”‚
โ”‚    First: "Test"                                                             โ”‚
โ”‚    Last: "User_{random_id}"                                                  โ”‚
โ”‚                                                                              โ”‚
โ”‚  ADDRESS:                                                                    โ”‚
โ”‚    Street: "123 Test Street"                                                โ”‚
โ”‚    City: "Testville"                                                         โ”‚
โ”‚    State: "CA" (or from options)                                            โ”‚
โ”‚    Zip: "90210"                                                              โ”‚
โ”‚                                                                              โ”‚
โ”‚  SELECT:                                                                     โ”‚
โ”‚    Strategy: Pick first non-placeholder option                              โ”‚
โ”‚    Or: Match common patterns (United States, etc.)                          โ”‚
โ”‚                                                                              โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

4.4 Validation Error Detection Flow

Form Fill โ”€โ”€โ–ถ Check Validation โ”€โ”€โ–ถ Error Detected?
                                         โ”‚
                          โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                          โ”‚                             โ”‚
                         YES                           NO
                          โ”‚                             โ”‚
                          โ–ผ                             โ–ผ
              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”          โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
              โ”‚  Parse Error Message โ”‚          โ”‚   Success    โ”‚
              โ”‚  Identify Field      โ”‚          โ”‚   Report     โ”‚
              โ”‚  Determine Strategy  โ”‚          โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                          โ”‚
                          โ–ผ
              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
              โ”‚  Strategy Selection  โ”‚
              โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
              โ”‚ "already exists"     โ”‚โ”€โ”€โ–ถ Generate new unique value
              โ”‚ "invalid format"     โ”‚โ”€โ”€โ–ถ Try different format
              โ”‚ "too short/long"     โ”‚โ”€โ”€โ–ถ Adjust length
              โ”‚ "doesn't match"      โ”‚โ”€โ”€โ–ถ Sync related fields
              โ”‚ "required"           โ”‚โ”€โ”€โ–ถ Fill missing field
              โ”‚ Unknown              โ”‚โ”€โ”€โ–ถ Report to user
              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                          โ”‚
                          โ–ผ
              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
              โ”‚  Apply Fix & Retry   โ”‚
              โ”‚  (max 3 attempts)    โ”‚
              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

5. Implementation Guide

5.1 Chrome MCP Tools for Form Handling

form_input - Fill Form Fields

// Fill a text field
mcp__claude-in-chrome__form_input({
  tabId: 12345,
  ref: "ref_1",      // Element reference from read_page
  value: "test@example.com"
})

// Check a checkbox
mcp__claude-in-chrome__form_input({
  tabId: 12345,
  ref: "ref_5",
  value: true        // Boolean for checkboxes
})

// Select dropdown option
mcp__claude-in-chrome__form_input({
  tabId: 12345,
  ref: "ref_3",
  value: "United States"  // Match option text or value
})

find - Locate Form Elements

// Find specific form elements
mcp__claude-in-chrome__find({
  tabId: 12345,
  query: "email input field"
})

// Find error messages
mcp__claude-in-chrome__find({
  tabId: 12345,
  query: "error message or validation warning"
})

computer - Click and Type

// Click submit button
mcp__claude-in-chrome__computer({
  action: "left_click",
  ref: "ref_submit",
  tabId: 12345
})

// Type with keyboard (for special cases)
mcp__claude-in-chrome__computer({
  action: "type",
  text: "test@example.com",
  tabId: 12345
})

// Press Enter to submit
mcp__claude-in-chrome__computer({
  action: "key",
  text: "Enter",
  tabId: 12345
})

5.2 Implementation Phases

Phase 1: Form Discovery (Days 1-2)

Goal: Find and analyze all forms on a page.

Tasks:

  1. Navigate to test page
  2. Use read_page with filter โ€œinteractiveโ€ to find form elements
  3. Group elements by form (look for form boundaries)
  4. Extract field attributes (type, name, required, pattern)

Checkpoint: Successfully list all form fields with their attributes.

Example output:
  Form 1: "Signup" (6 fields)
    - email [email, required]
    - password [password, required, pattern: ...]
    - ...

Phase 2: Field Classification (Days 3-4)

Goal: Classify each field by semantic type.

Tasks:

  1. Implement classification rules (see 4.2)
  2. Handle ambiguous cases with context
  3. Detect field dependencies (password confirmation)
  4. Test on various form types

Checkpoint: Accurate classification for common field types.

Phase 3: Data Generation (Days 5-6)

Goal: Generate appropriate test data for each field type.

Tasks:

  1. Implement generators for each classification
  2. Handle password requirements (parse patterns)
  3. Generate unique identifiers (timestamps, random)
  4. Coordinate dependent fields

Checkpoint: Generate valid data that passes client validation.

Phase 4: Form Filling (Days 7-8)

Goal: Fill forms reliably using generated data.

Tasks:

  1. Fill fields in logical order
  2. Handle different input types (select, checkbox, radio)
  3. Wait for dynamic updates
  4. Verify filled values

Checkpoint: Successfully fill complete forms.

Phase 5: Validation Handling (Days 9-10)

Goal: Detect and recover from validation errors.

Tasks:

  1. Check for error messages after filling
  2. Parse error text to identify issue
  3. Implement retry strategies
  4. Track attempt history

Checkpoint: Automatically recover from common validation errors.

Phase 6: Multi-Step Forms (Days 11-14)

Goal: Handle wizard-style multi-page forms.

Tasks:

  1. Detect when form continues to next step
  2. Track state across steps
  3. Navigate forward/backward
  4. Handle step validation

Checkpoint: Complete multi-step registration flows.


6. Testing Strategy

6.1 Test Scenarios

Scenario Test URL/Description Expected Behavior
Simple form Basic contact form Fill and submit successfully
Validation Form with strict patterns Handle validation, retry
Select fields Country/state dropdowns Select appropriate options
Multi-step Registration wizard Navigate all steps
Error recovery โ€œEmail existsโ€ error Generate new email, retry

6.2 Test Data Patterns

// Test data generator pseudocode
const generateTestData = (fieldType, attempt = 0) => {
  const timestamp = Date.now();
  const uniqueId = `${timestamp}_${attempt}`;

  switch(fieldType) {
    case 'EMAIL':
      return `testuser_${uniqueId}@example.com`;
    case 'PASSWORD':
      return generateSecurePassword();
    case 'PHONE':
      return `(555) ${100 + attempt}-${1000 + timestamp % 9000}`;
    case 'NAME':
      return `Test User ${uniqueId}`;
    // ... more types
  }
};

7. Common Pitfalls & Debugging

7.1 Frequent Issues

Issue Symptom Solution
Field not fillable form_input returns error Check if field is editable, not disabled
Select not working Value not selected Try matching option text exactly
Validation not detected Form seems submitted but isnโ€™t Check for dynamic error messages
Password mismatch Confirm password fails Ensure same value used for both
CAPTCHA blocking Form wonโ€™t submit Report to user (cannot automate)

7.2 Debugging Techniques

// 1. Check page state after each action
mcp__claude-in-chrome__computer({ action: "screenshot", tabId })

// 2. Look for error messages
mcp__claude-in-chrome__find({
  tabId,
  query: "error message or alert"
})

// 3. Check console for JavaScript errors
mcp__claude-in-chrome__read_console_messages({
  tabId,
  pattern: "error|validation|failed"
})

// 4. Re-read page to see current state
mcp__claude-in-chrome__read_page({
  tabId,
  filter: "interactive"
})

8. Real World Outcome

When you complete this project, hereโ€™s a complete form automation session:

You: Fill out and submit the registration at https://example.com/register

Claude: I'll analyze and fill the registration form.

[Navigating to registration page...]
[Analyzing form structure...]

================================================================================
                  FORM AUTOMATION: example.com/register
================================================================================

STEP 1 OF 3: Account Details
-----------------------------

Fields Discovered:
  1. Email Address      [email, required]
  2. Username           [text, required, minlength: 3]
  3. Password           [password, required]
     Requirements: 8+ chars, 1 uppercase, 1 number
  4. Confirm Password   [password, required]

Generating data...
  Email:     testuser_1703520000@example.com
  Username:  testuser_1703520000
  Password:  SecureP@ss2024!

Filling form...
  Email.............. DONE
  Username........... DONE
  Password........... DONE
  Confirm Password... DONE

Clicking "Next"...

VALIDATION ERROR: Username already taken
  Strategy: Append random suffix
  New value: testuser_1703520000_a7f3

Retrying...
  Username........... DONE

Clicking "Next"... SUCCESS

STEP 2 OF 3: Profile Information
--------------------------------

Fields Discovered:
  1. Full Name      [text, required]
  2. Phone          [tel, optional]
  3. Country        [select, required]
  4. State          [select, optional]  // Dependent on Country

Generating data...
  Full Name: Test User
  Phone: (555) 123-4567
  Country: United States
  State: California

Filling form...
  Full Name.......... DONE
  Phone.............. DONE
  Country............ DONE
  [Waiting for state options to load...]
  State.............. DONE

Clicking "Next"... SUCCESS

STEP 3 OF 3: Preferences & Confirmation
---------------------------------------

Fields Discovered:
  1. Newsletter     [checkbox, optional]
  2. Terms          [checkbox, required]
  3. Privacy Policy [checkbox, required]

Filling form...
  Newsletter......... SKIPPED (optional)
  Terms.............. CHECKED
  Privacy Policy..... CHECKED

Ready to submit. Should I:
  1. Click "Create Account" to complete registration
  2. Review all entered data first
  3. Go back and modify something

You: Submit it

Claude: Clicking "Create Account"...

REGISTRATION COMPLETE
---------------------

Success! Account created.
Redirected to: /welcome

Summary:
  Email:    testuser_1703520000@example.com
  Username: testuser_1703520000_a7f3
  Password: SecureP@ss2024!

These credentials have been displayed for testing purposes only.
Shall I take a screenshot of the confirmation page?

9. The Core Question Youโ€™re Answering

โ€œHow can Claude intelligently interact with forms rather than just filling fields blindly?โ€

This isnโ€™t about mindlessly typing into input fields. The key insights:

  1. Claude understands context: โ€œConfirm Passwordโ€ isnโ€™t just a password field - it must match the previous password
  2. Claude adapts to errors: A โ€œusername takenโ€ error triggers a retry with a modified username
  3. Claude tracks state: Multi-step forms require remembering what was entered on previous steps
  4. Claude reasons about semantics: A โ€œCountryโ€ dropdown affects what options appear in โ€œStateโ€

This is reasoning-driven automation, fundamentally different from recorded script playback.


10. Concepts You Must Understand First

Before starting this project, ensure you understand:

Concept Why It Matters Where to Learn
HTML5 form elements Youโ€™ll classify and fill every input type MDN - HTML Forms
Form validation API Understanding how browsers validate MDN - Constraint Validation
CSS selectors for forms Targeting specific inputs MDN - Form CSS
HTTP form submission What happens when a form posts MDN - Sending Form Data
Session/cookies How multi-step forms maintain state MDN - HTTP Cookies
Accessibility tree How form elements appear to screen readers Project 29 learnings

11. Questions to Guide Your Design

Work through these questions BEFORE implementing:

  1. Field Ordering: Should you fill fields in DOM order or some other order? Does order affect validation?

  2. Required vs Optional: How do you handle optional fields? Fill them? Skip them? Ask the user?

  3. Error Classification: How do you distinguish between โ€œemail existsโ€ (retry with new data) and โ€œinvalid emailโ€ (fix format)?

  4. Password Patterns: How do you parse password requirements from pattern attributes or error messages?

  5. Dependent Fields: How do you detect that โ€œStateโ€ depends on โ€œCountryโ€? Whatโ€™s the timing?

  6. Multi-Step State: What happens if you need to go back a step? How do you track what was entered?


12. Thinking Exercise

Before implementing, trace through this form scenario:

<form action="/signup" method="POST">
  <input name="email" type="email" required>
  <input name="password" type="password"
         minlength="8" pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*">
  <input name="password_confirm" type="password" required>
  <select name="plan" required>
    <option value="">Select a plan</option>
    <option value="free">Free</option>
    <option value="pro">Pro ($10/mo)</option>
  </select>
  <button type="submit">Sign Up</button>
</form>

Questions to answer on paper:

  1. What classification does each field receive?
  2. What test data would you generate?
  3. How do you ensure password_confirm matches password?
  4. What happens if the password doesnโ€™t meet the pattern?
  5. Which option should be selected for โ€œplanโ€?
  6. How would you detect a โ€œpassword too weakโ€ error?

13. The Interview Questions Theyโ€™ll Ask

After completing this project, youโ€™ll be ready for:

  1. โ€œHow would you automate testing of a multi-page form wizard?โ€
    • Expected: State tracking, step detection, validation handling
    • Bonus: Discuss back navigation, conditional steps
  2. โ€œWhatโ€™s your strategy for handling CAPTCHAs or bot detection?โ€
    • Expected: Recognize limitations, graceful failure, user handoff
    • Bonus: Discuss rate limiting, human verification patterns
  3. โ€œHow do you test form validation without submitting real data?โ€
    • Expected: Test data generation, unique identifiers, cleanup
    • Bonus: Discuss test environments, data isolation
  4. โ€œWhatโ€™s the difference between client and server validation?โ€
    • Expected: Timing, reliability, user experience
    • Bonus: Discuss validation bypass, security implications
  5. โ€œHow would you handle file upload fields in automation?โ€
    • Expected: Recognize complexity, discuss alternatives
    • Bonus: Discuss upload_image tool, mock files

14. Hints in Layers

If you get stuck, reveal hints progressively:

Hint 1: Form Discovery

Use read_page with filter โ€œinteractiveโ€ to find form elements. Look for patterns:

  • โ€œtextboxโ€ elements are text/email/password inputs
  • โ€œcomboboxโ€ elements are select dropdowns
  • โ€œcheckboxโ€ and โ€œradioโ€ buttons for toggles
  • โ€œbuttonโ€ with โ€œsubmitโ€ for form submission

Group elements that appear together in the accessibility tree.

Hint 2: Field Classification

The accessibility tree includes labels and names. Look at:

textbox "Email Address" [ref_1]
  โ†’ Classification: EMAIL (from label)

textbox "password" [ref_2] (type: password)
  โ†’ Classification: PASSWORD (from type)

textbox "Confirm your password" [ref_3] (type: password)
  โ†’ Classification: PASSWORD_CONFIRM (from label + type)

Use multiple signals together for best classification.

Hint 3: Validation Detection

After filling and attempting submission:

  1. Wait briefly for validation (computer action: wait, duration: 1)
  2. Use find to look for error messages
  3. Re-read the page to check for changes
  4. Look for elements with โ€œerrorโ€, โ€œinvalidโ€, โ€œwarningโ€ in their text

Common error patterns:

  • โ€œEmail already existsโ€ โ†’ Generate new email
  • โ€œPassword is too weakโ€ โ†’ Add more complexity
  • โ€œPasswords donโ€™t matchโ€ โ†’ Re-sync confirm field
Hint 4: Multi-Step Navigation

Detect step transitions by:

  1. URL changes (/step1 โ†’ /step2)
  2. New form elements appearing
  3. Previous fields disappearing
  4. Progress indicators changing

Track state in a structured way:

formState = {
  currentStep: 2,
  data: {
    step1: { email: "...", password: "..." },
    step2: { name: "...", phone: "..." }
  },
  completed: [1]
}

15. Books That Will Help

Topic Book Chapter/Section
Form testing patterns โ€œTesting Web Applicationsโ€ by Hung Q. Nguyen Ch. 8
Input validation โ€œWeb Application Securityโ€ by Andrew Hoffman Ch. 7
Test automation โ€œThe Art of Software Testingโ€ by Glenford Myers Ch. 5
HTML forms โ€œHTML5: The Missing Manualโ€ by Matthew MacDonald Ch. 4
Form UX โ€œForms that Workโ€ by Caroline Jarrett All
Data generation Faker.js Documentation Examples section

16. Extensions & Challenges

16.1 Beginner Extensions

  • Save credentials: Output filled credentials to a file for reference
  • Form templates: Pre-define data patterns for common form types
  • Dry run mode: Analyze form without filling

16.2 Intermediate Extensions

  • Fuzzing mode: Generate edge-case data to test validation
  • Batch processing: Fill multiple forms from a data file
  • Screenshot documentation: Capture each step for test evidence

16.3 Advanced Extensions

  • Smart retry: Learn from errors to improve data generation
  • Form diffing: Compare forms across page versions
  • API integration: Submit via API when HTML form isnโ€™t ideal

17. Learning Milestones

Track your progress through these checkpoints:

Milestone Description Verification
1. Form discovery Can find and list all form fields Field list matches manual inspection
2. Classification Correctly classify field types Email, password, phone recognized
3. Data generation Generate valid test data Data passes client validation
4. Form filling Fill all field types Form shows entered data
5. Validation handling Detect and recover from errors Retry works on โ€œemail existsโ€
6. Multi-step Complete wizard forms Navigate all steps successfully

This guide was expanded from CLAUDE_CODE_MASTERY_40_PROJECTS.md. For the complete learning path, see the project index.