feat: add playwright usage docs

This commit is contained in:
engigu
2026-03-19 18:08:26 +08:00
parent ce9fb9aa76
commit 7d102f33ec
10 changed files with 456 additions and 15 deletions
+32
View File
@@ -0,0 +1,32 @@
/*
下面是测试实例
*/
const puppeteer = require('puppeteer-core');
(async () => {
// 连接 Browserless(注意 token
const browser = await puppeteer.connect({
browserWSEndpoint: 'ws://localhost:3000?token=your-secret-token'
});
const page = await browser.newPage();
// 访问百度
await page.goto('https://www.baidu.com', {
waitUntil: 'networkidle2',
timeout: 30000
});
// 截图
await page.screenshot({
path: 'baidu.png',
fullPage: true
});
console.log('✅ 截图完成:baidu.png');
await browser.close();
})();