Synopsis
Description
Thebdg dom submit command provides smart form submission with automatic waiting:
- React-compatible - Dispatches proper synthetic events
- Navigation detection - Waits for page navigation if triggered
- Network stability - Waits for pending requests to complete
- Timeout protection - Configurable maximum wait time
- 0-based indexing - Works with query results or direct selectors
submit understands form submission semantics and waits appropriately for the submission to complete.
Arguments
CSS selector or numeric index (from
bdg dom query results, 0-based)- Selector:
"button[type='submit']","#login-btn","form button" - Index:
0,1,2(from previous query results)
Options
Element index when selector matches multiple elements (0-based)
Wait for page navigation after submit (default: auto-detect)
Wait for network idle after submit (milliseconds)
Maximum time to wait for completion (milliseconds)
Output in JSON format
Output Format
Human-readable Output
JSON Output
Examples
Basic Form Submission
Submit by Index
Submit with Custom Timeout
Force Navigation Wait
Quick Submit (No Network Wait)
Complete Form Workflow
Login Form
Multi-Step Form
AJAX Form (No Navigation)
Waiting Behavior
The command automatically detects the appropriate waiting strategy:Navigation Wait
Triggered when:- Form has
actionattribute with different URL - Submit button has
formactionattribute --wait-navigationflag is set
Page.loadEventFiredCDP event- URL change confirmation
- Timeout if navigation doesn’t occur
Network Wait
Always applied (configurable):- Waits for all pending XHR/Fetch requests to complete
- Default: 1000ms after last network activity
- Configurable via
--wait-networkflag
Combined Wait
For traditional form submissions:- Navigation wait (if detected)
- Then network wait (for post-navigation requests)
Exit Codes
Success - Form submitted
Invalid arguments - Missing selector or invalid options
Element not found - Selector didn’t match any element
Stale element - Index from previous query is no longer valid
Session not active - Start a session first
Timeout - Navigation or network didn’t complete in time
Troubleshooting
Timeout Errors
If submission times out:No Navigation Detected
For AJAX forms that don’t navigate:Multiple Submit Buttons
Tips
The command waits for network stability to ensure AJAX requests complete. This prevents race conditions in automated workflows.
Comparison
bdg dom submit vs bdg dom click
| Feature | submit | click |
|---|---|---|
| Navigation wait | ✓ Auto-detect | ✗ Manual |
| Network wait | ✓ Built-in | ✗ Manual |
| Form semantics | ✓ Understands forms | ✗ Generic click |
| Timeout handling | ✓ Configurable | ✗ Basic |
| Best for | Form submissions | General interactions |
Related Commands
Form Discovery
Discover form structure and submit buttons
Fill Fields
Fill form fields before submission
Click Elements
Generic element clicking without form semantics
Forms Guide
Complete form interaction workflows

