# QuBeCare Login Form Troubleshooting Guide ## Issue: LiveKit Agent Not Filling QuBeCare Login Form ### Potential Causes and Solutions #### 1. **Page Loading Issues** - **Problem**: Form elements not loaded when agent tries to fill them - **Solution**: - Ensure page is fully loaded before attempting form filling - Add delays after navigation: `await asyncio.sleep(3)` - Check page load status with JavaScript #### 2. **Dynamic Form Elements** - **Problem**: QuBeCare uses React/Vue.js with dynamically generated form elements - **Solution**: - Use enhanced form detection with JavaScript execution - Wait for elements to appear in DOM - Use MutationObserver to detect when forms are ready #### 3. **Shadow DOM or iFrames** - **Problem**: Login form is inside shadow DOM or iframe - **Solution**: - Check for iframe elements: `document.querySelectorAll('iframe')` - Switch to iframe context before form filling - Handle shadow DOM with special selectors #### 4. **CSRF Protection or Security Measures** - **Problem**: Site blocks automated form filling - **Solution**: - Simulate human-like interactions - Add random delays between actions - Use proper user agent and headers #### 5. **Incorrect Selectors** - **Problem**: Form field selectors have changed or are non-standard - **Solution**: - Use the enhanced form detection method - Try multiple selector strategies - Inspect actual DOM structure ### Debugging Steps #### Step 1: Run the Debug Script ```bash cd agent-livekit python debug_form_detection.py ``` #### Step 2: Check Agent Logs Look for these log messages: - "Auto-detecting all input fields on current page..." - "Enhanced detection found X elements" - "Filling field 'selector' with value 'value'" #### Step 3: Manual Testing 1. Navigate to https://app.qubecare.ai/provider/login 2. Use agent command: `get_form_fields` 3. If no fields found, try: `refresh_input_fields` 4. Use the new specialized command: `fill_qubecare_login email@example.com password123` #### Step 4: Browser Developer Tools 1. Open browser dev tools (F12) 2. Go to Console tab 3. Run: `document.querySelectorAll('input, textarea, select')` 4. Check if elements are visible and accessible ### Enhanced Commands Available #### New QuBeCare-Specific Command ``` fill_qubecare_login email@example.com your_password ``` #### Enhanced Form Detection ``` get_form_fields # Now includes JavaScript-based detection refresh_input_fields # Manually refresh field cache ``` #### Debug Commands ``` navigate_to_url https://app.qubecare.ai/provider/login get_form_fields fill_qubecare_login your_email@domain.com your_password submit_form ``` ### Common Issues and Fixes #### Issue: "No form fields found" **Fix**: 1. Wait longer for page load 2. Check if page requires login or has redirects 3. Verify URL is correct and accessible #### Issue: "Error filling form field" **Fix**: 1. Check if field is visible and enabled 2. Try clicking field first to focus it 3. Use different selector strategy #### Issue: Form fills but doesn't submit **Fix**: 1. Use `submit_form` command after filling 2. Try pressing Enter key on form 3. Look for submit button and click it ### Technical Implementation Details The enhanced form detection now: 1. Uses multiple detection strategies 2. Executes JavaScript to find hidden/dynamic elements 3. Provides detailed field information including visibility 4. Identifies login-specific fields automatically 5. Handles modern web application patterns ### Next Steps if Issues Persist 1. **Check Network Connectivity**: Ensure agent can reach QuBeCare servers 2. **Verify Credentials**: Test login manually in browser 3. **Update Selectors**: QuBeCare may have updated their form structure 4. **Check for Captcha**: Some login forms require human verification 5. **Review Browser Profile**: Ensure correct browser profile is being used ### Contact Support If the issue persists after trying these solutions: 1. Provide debug script output 2. Share agent logs 3. Include browser developer tools console output 4. Specify exact error messages received