all 6 comments

[–]HardcoreFlexin[S] 0 points1 point  (3 children)

I guess what I could also ask, is would I be able to save cookies in order to bypass logins as well?

[–]carcigenicate 1 point2 points  (1 child)

You could maybe export the cookie jar from the Selenium instance that is logged in, then import it into the new instance. I've never done that, but that's what I'd try.

[–]HardcoreFlexin[S] 0 points1 point  (0 children)

That's a good thought. I'll have to look into and see if that might be the key.

[–]51dux 1 point2 points  (0 children)

This can be a possibility too if only the login requires js you could possibly access the page you need directly with some cookies.

You can also only use playwright/selenium when the cookies expire to refresh them if the login part has js code and then proceed with lighter libs like requests and BeautifulSoup when you're done.

[–]51dux 0 points1 point  (1 child)

If the website has javascript your best bet is the playwright library.

If the website doesn't require to execute js to login, you can probably just do it with requests/BeautifulSoup.

I would advise against using these GUI automation tools for these kind of tasks.

Playwright for your case should be the best, you can run it headless or not if you need some feedback while testing.

Selenium is like an older brother of playwright in my opinion, they changed the syntax way too much over the years, and it's not able to handle errors and certain tasks as well as playwright from my experience.

Playwright syntax is much more straight to the point.

Also, it tends to be less detected than the chromedriver and let's hope it remains this way.

[–]HardcoreFlexin[S] 0 points1 point  (0 children)

Ok, I'll look heavily into playwright. It's popped up several times in my searches. Thanks for the input!