I’m a full stack software developer, technical writer, and UI/UX Designer.
I love playing Football, watching football, Weight lifting, and playing Chess. :)
I haven't tried that and maybe it's possible but i'm sure it's not going to work if you randomly spin up browsers using Playwright.
Let me know if you are able to do that :)
go to your project directory
using the terminal,run the command below,
npx playwright open --save-storage websitename.json
a browser will open,now navigate to the website and sign-in/solve captcha,
then close browser. You will notice that a file "websitename.json" has been created.
now in playwright,set you browser context using this code below
Do u know, how to save login session after browser close and want to scraping again and again ?
I haven't tried that and maybe it's possible but i'm sure it's not going to work if you randomly spin up browsers using Playwright.
Let me know if you are able to do that :)
go to your project directory
using the terminal,run the command below,
npx playwright open --save-storage websitename.json
a browser will open,now navigate to the website and sign-in/solve captcha,
then close browser. You will notice that a file "websitename.json" has been created.
now in playwright,set you browser context using this code below
const context = await browser.newContext({
storageState: "websitename.json"
});
you are now automatically logged in. :)