0

I am trying to specify three different cookies for a website's 3 different paths. But when I specify a path, the add_cookie() method acts differently and changes the domain I gave to it. It places a dot at the beginning of the domain.

This is how it is supposed to be

This is how it is

I added a dummy cookie for this but this happens every time. Let me share the code.

from selenium import webdriver

driver = webdriver.Chrome()
driver.get("https://icp.administracionelectronica.gob.es/icpplustiem/index.html")
name = "x"
value = "y"
domain = "icp.administracionelectronica.gob.es"
path = "/sjsjsjsjsj"
driver.add_cookie({'name': name, 'value': value, 'domain': domain, "path": path})

I simply go to the website to not take InvalidDomainException and add the cookies. But it changes the domain. So it doesn't use the cookie I added in the necessary requests.

ghostcasper
  • 99
  • 2
  • 7
  • 1
    Check out https://developer.mozilla.org/en-US/docs/Web/API/Document/cookie and this answer https://stackoverflow.com/a/39708227/10413416 – Infern0 Sep 27 '22 at 08:31

0 Answers0