-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Do we have storage_state in seleniumbase like we have it in playwright? #3825
-
this is the storage state i'm refering in playwright:
https://playwright.dev/python/docs/auth
For example in playwright I can do this:
storage = context.storage_state(path="state.json")
For example to login into a gmail account and save the storage_state in a json file, recover that and then when you start the seleniumbase again you are loged in into your gmail account
Can this be done with seleniumbase?
Beta Was this translation helpful? Give feedback.
All reactions
There's a user_data_dir
parameter that you can use to preserve the user-data-dir between scripts.
(Note that the non UC Mode user_data_dir
is incompatible with one that'll be used with UC Mode.)
There are other ways to preserve data and state as well. For instance, with cookies:
-
SeleniumBase/examples/raw_cookies.py
(An example where the login cookie is saved and later reloaded to bypass login)
There are also methods for getting and setting both local and session storage:
sb.cdp.get_local_storage_item(key) sb.cdp.get_session_storage_item(key) sb.cdp.set_local_storage_item(key, value) sb.cdp.set_session_storage_item(key, value)
Replies: 1 comment
-
There's a user_data_dir
parameter that you can use to preserve the user-data-dir between scripts.
(Note that the non UC Mode user_data_dir
is incompatible with one that'll be used with UC Mode.)
There are other ways to preserve data and state as well. For instance, with cookies:
- SeleniumBase/examples/raw_cookies.py
(An example where the login cookie is saved and later reloaded to bypass login)
There are also methods for getting and setting both local and session storage:
sb.cdp.get_local_storage_item(key) sb.cdp.get_session_storage_item(key) sb.cdp.set_local_storage_item(key, value) sb.cdp.set_session_storage_item(key, value)
Beta Was this translation helpful? Give feedback.