playwright
playwright copied to clipboard
Playwright Agent Generator fails to handle new tab scenarios correctly
I'm encountering an issue with Playwright Agent when performing UI automation testing involving new tabs:
Scenario: When clicking an "Add/New" button on the original page, the system opens a new tab displaying the operation interface.
Current Problems:
- Tab tool inconsistency: The Playwright MCP tab tool occasionally fails, causing the AI to incorrectly use page.goto() on the original page to navigate to the new page's URL
- Incorrect code generation: Even when the tab tool works properly, generator_read_log doesn't include code for tab switching, resulting in generated test code that continues executing operations on the original page object
Expected Behavior: The generator should produce code similar to this to handle new tabs correctly:
const newPagePromise = page.context().waitForEvent('page', { timeout: 1000 });
await page.getByText('Add').click();
const newPage = await newPagePromise;
Impact: Currently unable to generate reliable new tab handling code through the generator, requiring manual corrections and reducing the efficiency of automated test development.
@pavelfeldman Hi! Questions:
- Are there recommended solutions for handling new tab scenarios?
- Are there any improvement plans for the Generator in this area?
- Are there configuration options to optimize this behavior?
Thank you very much for your guidance! 🙏