Skip to content

Instantly share code, notes, and snippets.

@hamletbatista
Created April 2, 2019 19:55
Show Gist options
  • Select an option

  • Save hamletbatista/37a04a3b97ca009656682548f9de9581 to your computer and use it in GitHub Desktop.

Select an option

Save hamletbatista/37a04a3b97ca009656682548f9de9581 to your computer and use it in GitHub Desktop.
import asyncio
from pyppeteer import connect
from time import sleep
async def inspect_urls(urls):
#example URI. Copy and paste from Chrome output
#run Chrome using (Mac):
#mkdir ~/chrome-dev
#/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222 --no-first-run --user-data-dir=~/chrome-dev
ws = "ws://127.0.0.1:9222/devtools/browser/52112a5a-7555-4743-a37f-5fb26bd81b92"
browser = await connect({"browserWSEndpoint": ws})
page = await browser.newPage()
#optional viewport resize
await page.setViewport({"width": 1920, "height": 1280})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment