Initial commit: K12C教师岗位胜任力数字化管理方案
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
const puppeteer = require('puppeteer');
|
||||
const path = require('path');
|
||||
|
||||
(async () => {
|
||||
const browser = await puppeteer.launch({
|
||||
headless: true,
|
||||
args: ['--no-sandbox', '--disable-setuid-sandbox']
|
||||
});
|
||||
const page = await browser.newPage();
|
||||
|
||||
// 设置视口大小
|
||||
await page.setViewport({ width: 1400, height: 1200 });
|
||||
|
||||
const filePath = 'file://' + path.resolve(__dirname, 'screenshots.html');
|
||||
console.log('Loading:', filePath);
|
||||
|
||||
await page.goto(filePath, { waitUntil: 'networkidle0' });
|
||||
|
||||
// 等待内容加载
|
||||
await page.waitForSelector('.phone-frame', { timeout: 10000 });
|
||||
|
||||
// 截图整个页面
|
||||
const outputPath = path.resolve(__dirname, 'screenshots-full.png');
|
||||
await page.screenshot({
|
||||
path: outputPath,
|
||||
fullPage: true
|
||||
});
|
||||
|
||||
console.log('Full page screenshot saved:', outputPath);
|
||||
|
||||
await browser.close();
|
||||
console.log('Done!');
|
||||
})();
|
||||
Reference in New Issue
Block a user