0

I used Selenium to successfully log in to a portal. However, when attempting to extract cookies, I received an empty list. Interestingly, I noticed the cookies are visible in the network tab but are hidden under "Show filtered cookies." Inside network request we can see this cookie section

I attempted to extract cookies from various endpoints, but every attempt resulted in an empty list. I also tried retrieving cookies using the script execution method:

cookies = driver.execute_script("return document.cookie")

Can anyone help debugging get those cookies?

1
  • those were filtered out of the request for one reason or another... (so they're irrelevant anyway to the requests you are monitoring in dev tools) All of those are also httponly, so you can't read them via javascript. Commented Jun 18, 2024 at 17:27

1 Answer 1

0

chrome_option = webdriver.ChromeOptions() chrome_option.add_argument('user-data-dir=cookies') driver = webdriver.Chrome(chrome_option)

The get_cookies() method doesn't work at all for me either. You can use this, it saves all browser cookies, including photos, videos and everything.

In order to use it, you have to put this first, then check if there are words like (login. signup...) on the login page, if is there, then log in first.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.