Created
March 16, 2023 08:27
-
-
Save lifeart/61dcd1b1833cd5dcb8d0823bfd8bf248 to your computer and use it in GitHub Desktop.
Playwright using current browser
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
// ref https://twitter.com/underoot/status/1633430089802084352?s=52&t=0yc3BUdFiWnN-uQfrkt3xw | |
(async () = { | |
const port = 12345; // N port | |
const browser = await chromium. connectOverCDP(`http://localhost:${port}`); | |
const defaultContext = browser. contexts()[0]; | |
const page await defaultContext.newPage(); | |
// Do something with page | |
}); | |
/* | |
~ /Applications/Google\ Chrome.app/Contents/Mac0S/Google\ Chrome \ | |
-profile-directory="Profile 1" \ | |
-remote-debugging-port=N | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment