Last active
August 22, 2018 09:26
-
-
Save wwj718/3c2027d3fbe6fbb67baa61ed33f1afb1 to your computer and use it in GitHub Desktop.
用于scratch同步镜像数据
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
from pyppeteer import launch | |
async def main(): | |
browser = await launch() | |
page = await browser.newPage() | |
await page.goto('http://www.baidu.com') | |
# await asyncio.sleep(10) # 等待加载图片 | |
await page.screenshot({'path': '/tmp/example.png'}) | |
await browser.close() | |
asyncio.get_event_loop().run_until_complete(main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment