Skip to content

Commit 7890d39

Browse files
author
yanghucheng@021.com
committedApr 20, 2018
add puppeteer
1 parent d32f43e commit 7890d39

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed
 

‎mauto-eastday.png

392 KB
Loading

‎package.json

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"mongoose": "^4.11.9",
1212
"node-xlsx": "^0.11.0",
1313
"nodemailer": "^4.1.0",
14+
"puppeteer": "^1.3.0",
1415
"top": "^0.2.3"
1516
},
1617
"devDependencies": {

‎puppeteer/puppeteer.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const puppeteer = require('puppeteer');
2+
3+
(async () => {
4+
const browser = await puppeteer.launch();
5+
const page = await browser.newPage();
6+
await page.goto('https://mauto.eastday.com');
7+
await page.screenshot({path: 'mauto-eastday.png'});
8+
page.on('console', msg => console.log('PAGE LOG:', msg.text()));
9+
10+
await page.evaluate(() => console.log(`url is ${location.href}`));
11+
12+
await page.evaluate(() => console.log(`url is ${location.href}`));
13+
14+
await browser.close();
15+
})();

‎readme.md

+2
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@
1010
- nodemon node项目监听文件改变重启服务
1111
- nodemailer NodeJS 邮件发送模块,支持定制基于 Mustache 的模板正文。
1212
- node_redis 是为 NodeJS 而写的 Redis client,它支持所有 Redis 命令。
13+
- glob 模块,便捷匹配路径下所有文件。etc. ‘src/**/*.html’
14+

0 commit comments

Comments
 (0)
Please sign in to comment.