4

I'm willing to save an authorization cookie to not enter credentials again every time when I'm doing a online shop automation.

I have saved cookies after login as described there How to save and load cookies using python selenium webdriver.
After test run I am downloading shop page to have same cookies domain and webdriver domain. But there is a lot of subdomain cookies looking like this one and I'm getting an exception when I am trying to set it to webdriver

'.online-shop.com'

There are no subdomains in the HTTP conversation I have recoreded during login process. Selenium doesn't allow set cookie of another domain and I can't set subdomain cookie.

E.g. I cant do the following (I am getting exception):

for cookie in driver.get_cookies():
    driver.add_cookie(cookie)

Is there a way to set subdomain cookies?

Community
  • 1
  • 1
academica
  • 325
  • 3
  • 13

0 Answers0