0

In the test that I'm running using Selenium on Python, I simply create a new driver instance like so:

options.add_argument("user-data-dir=cookies")  # enables cookies                                                    
driver = webdriver.Chrome(ChromeDriverManager().install(), options=options)

and then I log in to the test website and call driver.quit(). Finally, I create another instance using the same user-data-dir and try to perform actions as a logged-in user but the tests fail since the user isn't logged in.

What seems like is happening is that the cookies containing the login aren't being saved or loaded and I'm not sure why. I've tried using pickle before to manage cookies and I've run into similar problems which is why I switched over to just adding user-data-dir to the options.

Has anyone run into a similar issue? How did you get around it?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.