Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authorization is reset after opening a saved browser profile #2596

Closed
Pidoffka opened this issue Mar 12, 2024 · 6 comments
Closed

Authorization is reset after opening a saved browser profile #2596

Pidoffka opened this issue Mar 12, 2024 · 6 comments
Labels
question Someone is looking for answers UC Mode / CDP Mode Undetected Chromedriver Mode / CDP Mode

Comments

@Pidoffka
Copy link

I encountered a problem that when using profile saving in the browser, after some time the authorization on the site crashes:

  • The site itself does not reset the authorization, since in a regular browser it hangs endlessly
  • There is no specific reset lag based on authorization time, i.e. this happens arbitrarily, which means that this is another argument in favor of resetting authorization after n time
  • The browser is saved and activated with the following driver settings
    driver = Driver(uc=True, proxy=proxy,
user_data_dir=folderPath, multi_proxy=True)

My question: This is anomalous behavior, if the site with which I interact does not contribute to the drop of my authorization, or with my settings this is quite possible, after some time the browser may for some reason, for example, be saved incorrectly and not record some data which are needed for authorization?

@mdmintz mdmintz added question Someone is looking for answers UC Mode / CDP Mode Undetected Chromedriver Mode / CDP Mode labels Mar 13, 2024
@mdmintz
Copy link
Member

mdmintz commented Mar 13, 2024

Not sure exactly what you mean by "using profile saving in the browser".

If you're sharing a non UC Mode user_data_dir with UC Mode Chrome, then you'll run into issues since the two formats aren't compatible. If you set user_data_dir in UC Mode, then that dir must be created by UC Mode and only used by UC Mode.

Also, if you're running multithreaded tests, then setting a user_data_dir may lead to conflicts. You may also run into other multithreading issue if not using pytest for the multithreading.

@mdmintz mdmintz closed this as completed Mar 13, 2024
@Pidoffka
Copy link
Author

@mdmintz If I use the UC mode, as I wrote above, then what do I need to ensure that authorization from the browser does not fail in the following scenario:

  • open the browser
  • log in
  • save the session

Then

  • open the browser
  • checking authorization

So that the reset does not occur due to seleniumbase?

@Pidoffka
Copy link
Author

I mean drop authorization on the website

@mdmintz
Copy link
Member

mdmintz commented Mar 13, 2024

@Pidoffka You said "save the session". You need to be more specific.

Do you mean setting a user_data_dir, which automatically saves session data across tests that reuse that user_data_dir?

Or do you mean reusing the existing browser session via pytest --rs, which keeps the browser open for all tests?

@Pidoffka
Copy link
Author

@mdmintz i mean user_data_dir, and after the browser session ends driver.close() driver.quit() Before logging in, I access the same profile and my authorization fails

@mdmintz
Copy link
Member

mdmintz commented Mar 15, 2024

@Pidoffka - Duplicate of #2432 (comment) / #2331 (comment)

If you need multiple profiles, set a different user_data_dir for each one that you want. Only the Default profile is supported.

If you're setting the user_data_dir while using UC Mode, then make sure you read #2118 (comment) first. (Don't mix a regular user_data_dir with one that is used by UC Mode Chrome, as the two formats are not compatible.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Someone is looking for answers UC Mode / CDP Mode Undetected Chromedriver Mode / CDP Mode
Projects
None yet
Development

No branches or pull requests

2 participants