const { chromium } = require('playwright'); (async () => { const browser = await chromium.launch({headless: false}); const page = await browser.newPage(); const myRoliaLogin = 'myRoliaLoginId', myRoliaPassword = 'myRoliaPassword'; const landingPageUrl = 'https://www.rolia.net/zh/list.php?f=0'; await page.goto(`https://www.rolia.net/mem/signOn.php?ref=${landingPageUrl}`); await page.fill('input[id="signonuserid"]', myRoliaLogin); await page.fill('input[id="signonpassword"]', myRoliaPassword); await page.click('input[name="signonsubmit"]'); const roliaUserId = 'someoneRoliaLoginId'; const roliaUserPostsUrl = `https://www.rolia.net/zh/advancedSearch.php?f=0&searchSubmit=1&part=0&author=${roliaUserId}&zone=0&level=0&byAuthorOnly=true`; await page.goto(roliaUserPostsUrl); await page.screenshot({ path: `${roliaUserId}.png` }); await browser.close(); })();
简介:https://dev.to/arjunattam/fast-and-reliable-cross-browser-testing-with-playwright-eig