For default Selenium get_cookies() method returns list of dicts e.g.
current_cookies: [{'domain': '.domain.com',
'expiry': 1667110148,
'httpOnly': False,
'name': '_ym_isad',
'path': '/',
'sameSite': 'None',
'secure': True,
'value': '2'},
{'domain': '.domain.com',
'expiry': 1698574147,
'httpOnly': False,
'name': '_ym_uid',
'path': '/',
'sameSite': 'None',
'secure': True,
'value': '1667038148592302065'}]
I want it to be a cookiejar object so that I could use methods which cookie jar use e.g. cookie.expires, cookie.name etc
My current code When I am getting cookies from request.session everything is ok - it automatically creates cookiejar objects but when I use Selenium it creates dicts and I have no idea of how to change this to cookiejar
Code for selenium to obtain cookies
options = webdriver.ChromeOptions()
options.add_argument('headless')
s = Service('/Users/almeco/Downloads/projects/research/refs/seo_tools_ref/sdf/chromedriver')
driver = webdriver.Chrome(service=s, options=options)
driver.get('https://my.adcombo.com/login')
time.sleep(2)
driver.find_element(By.XPATH, '/html/body/div[2]/div/div/div[2]/div/loginform/form/input[1]').send_keys(
'email_address')
driver.find_element(By.XPATH, '/html/body/div[2]/div/div/div[2]/div/loginform/form/input[2]').send_keys(
'pass')
driver.find_element(By.XPATH, '/html/body/div[2]/div/div/div[2]/div/loginform/form/button').click()
time.sleep(3)
current_cookies = driver.get_cookies()
The above code returns list of dicts instead of lists of cookie jar objects. My question is how to get cookie jar objects instead of dicts.
https://docs.python.org/3/library/http.cookiejar.html
And then something like: