18 lines
583 B
TypeScript
18 lines
583 B
TypeScript
// index.js
|
|
import { chromium } from 'playwright-extra';
|
|
import stealth from 'puppeteer-extra-plugin-stealth'
|
|
|
|
chromium.use(stealth());
|
|
|
|
(async () => {
|
|
const browser = await chromium.launch({ headless: false }); // 需要可视化就 false
|
|
const context = await browser.newContext();
|
|
const page = await context.newPage();
|
|
await page.goto('https://bot.sannysoft.com/'); // 常用自测页
|
|
console.log('Title:', await page.title());
|
|
await page.screenshot({ path: 'stealth.png', fullPage: true });
|
|
setTimeout(async () => {
|
|
await browser.close();
|
|
}, 1000_000);
|
|
})();
|