Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Do we have storage_state in seleniumbase like we have it in playwright? #3825

Answered by mdmintz
juanfrilla asked this question in Q&A
Discussion options

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?

You must be logged in to vote

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:

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

Comment options

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:

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)
You must be logged in to vote
0 replies
Answer selected by mdmintz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /