A smart web form analyzer and input suggester using LLMs (Large Language Models).
This project provides a Flask-based backend server and a browser extension to:
- Record HTML/CSS snapshots and user events from web pages.
- Analyze web forms using LLMs (Ollama or OpenRouter/Cerebras).
- Suggest valid input values and ranges for form fields, in Persian, based on the HTML structure.
- Generate Katalon Studio test scripts from recorded user interactions.
- Create comprehensive test case combinations from confirmed field data.
- Provide AI-powered test improvement through an interactive GUI.
- Form Field Extraction: Automatically detects
<input>,<textarea>, and<select>fields from HTML - LLM-Powered Suggestions: Uses LLMs to infer field types, validation rules, and generate realistic test values
- Multi-language Support: Provides suggestions in Persian with English processing capabilities
- Snapshot Recording: Captures page HTML, CSS, and user events for reproducible testing
- Katalon Test Generation: Converts recorded user events into Katalon Studio test scripts with smart wait times
- AI-Powered Test Improvement GUI: Interactive interface for improving generated Katalon tests using LLM assistance
- Test Case Generation: Creates combinatorial test cases from confirmed field suggestions and exports to CSV
- Chat History: Maintains conversation context for better AI interactions when improving tests
- Port Availability Check: Automatically checks if the server port is available before starting
- Graceful Shutdown: Proper application cleanup and shutdown handling
- Smart Timing Calculation: Excludes browser extension processing time from Katalon test wait commands
- Confirmation System: Allows users to confirm and save field suggestions for better test generation
POST /snapshot— Save HTML, CSS, and event data snapshotsPOST /events— Save user events, generate Katalon test scripts, and launch AI improvement GUIPOST /suggest_inputs— Analyze HTML and return input suggestions as JSONPOST /update_input_suggestion— Update field suggestions and get new LLM-generated examplesPOST /confirm_suggestion— Confirm and save field suggestions from usersPOST /generate_test_cases— Generate combinatorial test cases from Katalon files and confirmation dataPOST /shutdown— Gracefully shutdown the Flask server
- Python 3.8+
- Ollama (for local LLM) or an OpenRouter/Cerebras API key
- Node.js (for browser extension development, optional)
You can use either of the following methods:
-
Clone the repository:
git clone https://github.com/ArNayyeri/html_LLM_suggester.git cd html_LLM_suggester -
Install Python dependencies:
pip install -r requirements.txt
Key dependencies include:
flask,flask-cors— Web server frameworkpydantic,bs4,beautifulsoup4— Data parsing and validationopenai,ollama— LLM integrationtiktoken— Token counting for LLMsdeep-translator— Translation servicestkinter— GUI framework (built-in)threading,webbrowser— System utilities (built-in)csv,math,itertools— Data processing (built-in)socket,urllib.parse— Network utilities (built-in)
-
(Optional) Set up Ollama or get an OpenRouter/Cerebras API key.
-
Run the server:
python recorder_server.py
You will be prompted to choose between local (Ollama) or API (OpenRouter/Cerebras).
- Download the latest pre-built release from the Releases page of this repository.
- Extract and run the executable or provided files as described in the release notes.
- See the
my_recorder_extension/folder for a Chrome extension to record page data. - Load it in Chrome via
chrome://extensions> "Load unpacked".
-
Start the Server:
python recorder_server.py # Choose 'local' for Ollama or 'api' for OpenRouter/Cerebras -
Record User Actions:
- Install the browser extension
- Navigate to your target website
- Perform actions (clicking, typing, submitting forms)
- Events are automatically recorded and snapshots are saved
-
Get Field Suggestions:
- The extension analyzes forms and gets LLM suggestions in Persian
- Review and confirm suggestions through the extension popup
- Confirmed suggestions are saved for later use in test generation
-
Generate Katalon Tests:
- Recorded events are converted to Katalon test format with smart timing
- AI improvement GUI opens automatically for test enhancement
- Interactive chat interface allows for test optimization
-
Create Test Cases:
- Generate combinatorial test cases from confirmed field data
- Export to CSV for use in testing frameworks
- Uses both confirmed user data and LLM-generated examples
This tool automatically converts recorded user events into Katalon Studio test scripts with the following features:
- Smart Wait Time Calculation: Adds realistic wait times between actions based on actual user timing, excluding browser extension processing time
- Event Type Mapping: Converts various user events (clicks, input changes, form submissions) into appropriate Katalon commands
- Extension Event Filtering: Automatically excludes extension-specific events from test generation
- AI-Powered Improvement: After generating tests, an interactive GUI opens for LLM-assisted test optimization
The tool creates Katalon test scripts with:
pausestatements for realistic timing between actionsclickfor user interactionstypefor input field interactionssubmitfor form submissionsopenfor page navigation- Proper element selectors based on recorded events (prioritizes id > css > xpath)
After the /events endpoint processes user events, an interactive GUI automatically opens featuring:
-
Current Test Tab:
- Displays the generated Katalon test script in readable format
- Allows manual editing and saving
- Shows test commands in a scrollable text area
- Buttons for saving, regenerating, and opening in browser
-
AI Assistant Tab:
- Interactive chat interface with LLM
- Contextual understanding of your test with maintained chat history
- Supports both local (Ollama) and API (OpenRouter/Cerebras) services
- Real-time conversation for test improvement
- Send Message: Ask specific questions about test improvement
- Apply AI Suggestions: Let AI automatically improve the test based on conversation
- Get New Suggestions: Request fresh analysis and suggestions
- Clear History: Reset the conversation context
- Save Current Test: Save the improved test to file
- Regenerate Test: Recreate test from original events
- Open in Browser: View the test in browser format
- Ask specific questions like "How can I make this test more robust?"
- Request additions like "Add assertions to verify the form submission was successful"
- Get help with "What validations should I add to this test?"
- The AI maintains context throughout the conversation for better suggestions
After generating Katalon tests, you can automatically create comprehensive test case combinations:
- Smart Field Analysis: Extracts input fields from Katalon test scripts
- Confirmation Integration: Uses user-confirmed field suggestions when available from
/confirm_suggestionendpoint - Combinatorial Test Generation: Creates all possible combinations of field examples
- LLM-Enhanced Examples: Generates additional examples when confirmations are insufficient
- CSV Export: Saves test cases in CSV format for easy import into testing tools
- Intelligent Field Matching: Matches Katalon fields with confirmation data using flexible identification
POST /generate_test_cases— Generate test case combinations from Katalon files
The system automatically looks for confirmation files (from /confirm_suggestion endpoint) to use validated field examples. If no confirmations are found, it generates examples using LLM analysis based on field types and original values.
Example generated CSV:
username,password,email
user1,pass123,test1@example.com
user2,pass456,test2@example.com
admin,admin123,admin@company.com
testuser,testpass123,testuser@domain.comA typical response from /suggest_inputs:
[
{
"name": "نام پروژه",
"id": "input-209",
"type": "text",
"range": "حداکثر 255 کاراکتر",
"examples": [
"پروژه نمونه 1",
"پروژه نمونه 2",
"پروژه تست",
"سامانه مدیریت",
"برنامه کاربردی"
]
}
]Example of a generated Katalon test script from recorded events:
| Command | Target | Value |
|---|---|---|
| open | https://example.com/form | |
| pause | 2000 | Wait 2.0s |
| click | id=username | |
| pause | 1000 | Wait 1.0s |
| type | id=username | john_doe |
| pause | 3000 | Wait 3.0s |
| click | id=submit-btn | |
| pause | 2000 | Wait 2.0s |
| submit | id=main-form |
recorder_server.py— Main Flask backend with all functionalitymy_recorder_extension/— Chrome extension for recording web page datasnapshots/— Saved data organized by recording sessionsrun_[timestamp]_[uid]/— Individual recording sessionsrecorded_events.json— User interaction eventskatalon_test.html— Generated Katalon test script[event]_[timestamp].html— Page snapshots[event]_[timestamp].css— Page stylesheetsconfirmation_[timestamp]_[field]_[url].json— User-confirmed field suggestionsresult_suggested_inputs_[timestamp].json— LLM-generated suggestionsinput_suggestion_updates_[timestamp]_[field].json— Updated field suggestionstemp_katalon_test.html— Temporary test files for browser viewing
- Automatic token counting using tiktoken for LLM optimization
- Context truncation for large HTML documents while preserving target elements
- Smart content selection to stay within model token limits
- Persian-to-English translation for LLM processing
- English-to-Persian translation for user-facing content
- Maintains cultural context in generated examples
- Graceful degradation when translation services fail
- Fallback example generation when LLM calls fail
- Port availability checking before server startup
- Comprehensive error logging and user feedback