Web Recorder
The Web Recorder is a powerful feature in PostQode's Web Agent that allows you to record your browser interactions and automatically generate automation scripts. Instead of manually writing automation code, you can simply perform actions in the browser, and PostQode will capture and convert them into reusable test scripts.
What is Web Recorder?
Web Recorder captures your real-time browser interactions including:
- Page navigation
- Button clicks
- Form inputs
- Dropdown selections
- Scroll actions
- Mouse movements
- Keyboard inputs
These recorded actions are then converted into automation scripts in your preferred framework (Playwright, Selenium, Cypress, etc.).
See It in Action
Watch the Web Recorder capture a login flow and generate a Playwright test in seconds:
Prerequisites
Before using Web Recorder, ensure you have:
- PostQode extension installed and configured
- Browser settings properly configured
- Web Agent mode activated
- Active browser connection established
How to Use Web Recorder
Step 1: Activate Web Agent Mode
- Open the PostQode chat interface in VS Code
- Click on the mode dropdown at the top of the chat panel
- Select "Web Agent" from the available modes
- Verify that your browser connection is active (green indicator)
Step 2: Start Recording
There are two ways to start recording:
Method 1: Using the Recorder Button
- Look for the Recorder button in the Web Agent toolbar
- Click the "Start Recording" button (usually a red circle icon)
- The recorder will activate, indicated by a recording status indicator
Method 2: Using Natural Language Command
Start recording my browser actions
or
Enable web recorder and navigate to https://example.com
Step 3: Perform Your Actions
Once recording is active:
- Navigate to your target website
- Interact with elements (click, type, select, etc.)
- Complete your workflow or test scenario
- All actions are automatically captured in real-time
Example Workflow:
1. Navigate to https://example-shop.com
2. Click on "Products" menu
3. Search for "laptop"
4. Click on the first product
5. Add to cart
6. Proceed to checkout
Step 4: Stop Recording
When you've completed your actions:
Method 1: Using the Recorder Button
- Click the "Stop Recording" button (usually a square icon)
- The recording will stop and be processed
Method 2: Using Natural Language Command
Stop recording and generate the script
Step 5: Review and Generate Script
After stopping the recording:
- PostQode will display a summary of recorded actions
- You can review each step that was captured
- Request script generation in your preferred framework
Example:
Generate a Playwright script from the recorded actions
or
Convert the recording to Selenium Python code
Recording Features
Automatic Element Detection
Web Recorder intelligently identifies web elements using:
- ID attributes (highest priority)
- CSS selectors
- XPath expressions
- Text content
- ARIA labels
- Data attributes
This ensures your generated scripts are robust and maintainable.
Smart Wait Handling
The recorder automatically detects and includes:
- Page load waits
- Element visibility waits
- Network request completions
- Dynamic content loading
Action Annotations
Each recorded action includes:
- Timestamp of when it occurred
- Element selector used
- Action type (click, type, select, etc.)
- Input values (for form fields)
- Screenshot of the page state
Advanced Recording Options
Selective Recording
You can pause and resume recording to capture only specific interactions:
Pause recording
Perform actions you don't want to record...
Resume recording
Recording with Assertions
Add verification steps during recording:
Record this workflow and add an assertion that the page title contains "Success"
Recording Multiple Scenarios
Record different test scenarios in sequence:
Start recording scenario 1: User login
Perform login actions...
Stop recording and start recording scenario 2: Add product to cart
Generated Script Formats
Web Recorder can generate scripts in multiple formats:
Playwright (TypeScript)
import { test, expect } from '@playwright/test';
test('recorded workflow', async ({ page }) => {
await page.goto('https://example.com');
await page.click('button:has-text("Sign In")');
await page.fill('input[name="email"]', '[email protected]');
await page.fill('input[name="password"]', 'password123');
await page.click('button[type="submit"]');
await expect(page).toHaveURL(/.*dashboard/);
});
Playwright (JavaScript)
const { test, expect } = require('@playwright/test');
test('recorded workflow', async ({ page }) => {
await page.goto('https://example.com');
// ... rest of the script
});
Selenium (Python)
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
driver = webdriver.Chrome()
driver.get('https://example.com')
driver.find_element(By.CSS_SELECTOR, 'button.sign-in').click()
# ... rest of the script
Cypress
describe('Recorded Workflow', () => {
it('should complete user journey', () => {
cy.visit('https://example.com');
cy.get('button').contains('Sign In').click();
cy.get('input[name="email"]').type('[email protected]');
// ... rest of the script
});
});
Best Practices
1. Plan Your Recording
Before starting:
- ✅ Know the complete workflow you want to record
- ✅ Have test data ready (usernames, emails, etc.)
- ✅ Ensure the website is accessible and stable
- ✅ Close unnecessary browser tabs
2. Perform Actions Deliberately
During recording:
- ✅ Wait for pages to fully load before interacting
- ✅ Perform actions at a natural pace
- ✅ Avoid unnecessary clicks or navigation
- ✅ Use clear, identifiable form inputs
3. Keep Recordings Focused
- ✅ Record one logical workflow per session
- ✅ Break complex scenarios into smaller recordings
- ✅ Avoid recording exploratory browsing
- ✅ Stop recording when the workflow is complete
4. Review Before Generating
- ✅ Check the recorded action summary
- ✅ Verify all critical steps were captured
- ✅ Remove any unwanted actions if possible
- ✅ Add assertions for important verifications
5. Optimize Generated Scripts
After generation:
- ✅ Review the generated code for accuracy
- ✅ Add meaningful test names and descriptions
- ✅ Include proper error handling
- ✅ Add comments for complex interactions
- ✅ Parameterize test data for reusability
Common Use Cases
1. User Registration Flow
Start recording
Navigate to https://app.example.com/signup
Fill registration form
Submit and verify success message
Stop recording
Generate Playwright script
2. E-commerce Checkout
Record the complete checkout process from product selection to order confirmation
3. Form Validation Testing
Record form submission with invalid data and verify error messages
4. Multi-Step Wizards
Record navigation through a multi-step form wizard with data entry at each step
5. Search and Filter Operations
Record search functionality with various filters and sorting options
Troubleshooting
Recording Not Starting
Symptoms:
- Recorder button doesn't respond
- No recording indicator appears
Solutions:
- Verify browser connection is active (green indicator)
- Refresh the browser connection in settings
- Restart VS Code and reconnect
- Check that Web Agent mode is properly activated
Actions Not Being Captured
Symptoms:
- Some clicks or inputs are missing from the recording
- Incomplete action sequence
Solutions:
- Perform actions more slowly to ensure capture
- Wait for page elements to fully load before interacting
- Avoid rapid consecutive actions
- Check if elements are in iframes (may require special handling)
Generated Script Has Errors
Symptoms:
- Script fails to run
- Selectors not found
- Timing issues
Solutions:
- Review and update element selectors
- Add explicit waits for dynamic content
- Verify the website structure hasn't changed
- Test the script in isolation to identify issues
Recording Contains Unwanted Actions
Symptoms:
- Extra clicks or navigation recorded
- Exploratory actions included
Solutions:
- Use pause/resume to control what gets recorded
- Plan your workflow before starting
- Re-record the specific section if needed
- Manually edit the generated script to remove unwanted steps
Tips for Better Recordings
Use Stable Selectors
When possible, interact with elements that have:
- Unique IDs
- Stable CSS classes
- Data-testid attributes
- Meaningful ARIA labels
Add Context with Comments
During recording, you can add comments:
Add a comment: "This step verifies the user is logged in"
Handle Dynamic Content
For dynamic content:
Record this workflow and wait for the loading spinner to disappear before each action
Test Data Management
Use consistent test data:
Record using test user: [email protected] with password: Test123!
Integration with Other Features
Combine with Inspect Tool
Use the Inspect tool to:
- Identify optimal selectors before recording
- Verify element properties during recording
- Debug selector issues in generated scripts
Export to Test Suites
Generated scripts can be:
- Added to your existing test suite
- Integrated with CI/CD pipelines
- Shared with team members
- Version controlled in your repository
Enhance with AI
After recording:
Enhance this recorded script with better error handling and assertions
or
Optimize the generated script for better performance and maintainability
Next Steps
- Learn about the Web Inspector
- Generate automation scripts
- Try your first web task
- Configure browser settings
Additional Resources
- Video Tutorial: Watch Web Recorder in action
- Community: Join our Discord for tips and support
- Examples: Check out sample recordings in our GitHub repository
Need Help? If you encounter issues with Web Recorder, visit our troubleshooting guide or reach out on Discord.