Why can't I retrieve some cookies in Selenium Chrome using get_cookies()

46 views Asked by At

I've encountered an issue with Selenium and Chrome where I'm unable to retrieve all the cookies. I've tried the following methods:

  • Opening the browser through VNC and copying the request as cUrl (not all cookies are present in the copied request, while it works fine in regular Safari and Chrome).

  • Using the driver.get_cookies() method.

  • Using selenium-wire to intercept the needed request.

Could someone explain why this works for a regular browser but doesn't work for Selenium?

len(intercepted_request.headers['cookie'].split('; '))
# 26
len(driver.get_cookies())
# 26

When I try to copy request as cUrl and get cookies from copied value it work. But only for simple browser, not for Selenium Chrome or Chromium

len(copied_cookies.split('; '))
# 31
0

There are 0 answers