Loading...
Loading...
Compare original and translation side by side
page.click('button')page.fill('input[name="username"]', 'user123')page.waitForSelector('selector')page.click('button')page.fill('input[name="username"]', 'user123')page.waitForSelector('selector')$PLAYWRIGHT_MCP_API_KEY$PLAYWRIGHT_MCP_API_KEYplaywright-mcp start --port 8080 --headless--debug/mcp/executeconst response = fetch('http://localhost:8080/mcp/execute', {
method: 'POST',
headers: {'Authorization': `Bearer ${process.env.PLAYWRIGHT_MCP_API_KEY}`},
body: JSON.stringify({action: 'goto', url: 'https://example.com'})
});/mcp/interact--config path/to/config.json$PLAYWRIGHT_MCP_API_KEYplaywright-mcp start --port 8080 --headless--debug/mcp/executeconst response = fetch('http://localhost:8080/mcp/execute', {
method: 'POST',
headers: {'Authorization': `Bearer ${process.env.PLAYWRIGHT_MCP_API_KEY}`},
body: JSON.stringify({action: 'goto', url: 'https://example.com'})
});/mcp/interact--config path/to/config.json$PLAYWRIGHT_MCP_API_KEY$PLAYWRIGHT_MCP_API_KEYmcpClient.execute({action: 'fill', selector: 'input', value: 'data'}). Use WebSockets for real-time updates on . Ensure compatibility with Node.js 14+; handle CORS by adding $PLAYWRIGHT_MCP_API_KEYmcpClient.execute({action: 'fill', selector: 'input', value: 'data'})/mcp/ws--allow-origins *page.waitForTimeout(5000)try {
await page.click('nonexistent');
} catch (error) {
console.error('Element not found:', error.message);
// Retry or fallback
}--debug$PLAYWRIGHT_MCP_API_KEYpage.waitForTimeout(5000)try {
await page.click('nonexistent');
} catch (error) {
console.error('Element not found:', error.message);
// 重试或执行回退逻辑
}--debug$PLAYWRIGHT_MCP_API_KEYplaywright-mcp start --port 8080/mcp/executeplaywright-mcp execute --url 'https://site.com' --script 'page.evaluate(() => document.querySelector("#data").textContent)'playwright-mcp start --port 8080/mcp/executeplaywright-mcp execute --url 'https://site.com' --script 'page.evaluate(() => document.querySelector("#data").textContent)'