How To Take Screenshot Of A Given Url Using Python
I'm trying to take a screenshot from the given URL. Tried html2canvas library in javascript, dropped off since it doesn't support some CSS formats. Now trying to capture the screen
Solution 1:
Did you try use Pyppeteer https://github.com/miyakogi/pyppeteer?
With fullPage
parameter you can take a screenshot of the entire page.
import asyncio
from pyppeteer import launch
asyncdefmain():
browser = await launch(headless=True)
page = await browser.newPage()
await page.goto('https://stackoverflow.com/questions/51000899/better-way-to-take-screenshot-of-a-url-in-python')
await page.screenshot({'path': 'screen.png', 'fullPage': True})
await browser.close()
asyncio.get_event_loop().run_until_complete(main())
EDIT
https://github.com/miyakogi/pyppeteer is not maintained. New project: https://github.com/pyppeteer/pyppeteer
Post a Comment for "How To Take Screenshot Of A Given Url Using Python"