Safe to use Pickle with SeleniumBase uc=True #2303
JonWakefield
started this conversation in
General
Replies: 1 comment
-
That'll probably still work. You can set a custom SeleniumBase has special methods for cookies. These let you save and load cookies to/from files: self.save_cookies(name="cookies.txt")
self.load_cookies(name="cookies.txt") For working with cookies, see https://www.selenium.dev/documentation/webdriver/interactions/cookies/ Here are the other SeleniumBase cookie methods: self.delete_all_cookies()
# Duplicates: self.clear_all_cookies()
self.delete_saved_cookies(name="cookies.txt") Also, you can preload cookies. (See #2242 (comment)) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I am wondering if it safe to use pickle to store and retrieve cookies all while being undetected. (
driver = Driver(uc=True)
)What I am trying to do:
Currently, when I load up my bot I have to log into the website each time; however if I use pickle and save the cookies I can bypass the login phase.
I am wondering if this is a safe action or if this could potentially lead to me getting caught?
Here is a brief code snippet of what I am doing:
`
from seleniumbase import Driver
import pickle
// Create a driver
driver = Driver(uc=True)
// log in using cookies:
driver.get(url)
// load cookies:
cookies = pickle.load(open("cookies.pkl", "rb"))
// add cookies
for cookie in cookies:
driver.add_cookies(cookie)
// Perform additional website actions
// ...
// ...
`
Note: the code works, just wondering if combing pickle with uc=True will lead to me getting detected or if I should still be okay.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions