added code example
This commit is contained in:
11
content/docs/2023/mediaart-programming2/10/2_async_intro.js
Normal file
11
content/docs/2023/mediaart-programming2/10/2_async_intro.js
Normal file
@@ -0,0 +1,11 @@
|
||||
const puppeteer = require('puppeteer');
|
||||
|
||||
const main = async () =>
|
||||
puppeteer.launch({ headless: false })
|
||||
.then(browser => browser.newPage()
|
||||
.then(page => page.goto('https://www.youtube.com/')
|
||||
.then(_response => page.screenshot({ path: "./ss.png" })
|
||||
.then(_ => page.close()
|
||||
.then(_ => browser.close())))));
|
||||
|
||||
main();
|
||||
Reference in New Issue
Block a user