Selenium addCookie getting Invalid Cookie Domain Exception even though I'm on the right domain

*爱你&永不变心* 提交于 2019-12-05 18:48:47

I had a somewhat similar problem where I was getting the "You may only set cookies for the current domain" error for no apparent reason.

I solved it by striping the cookie of all the parameters except name and value:

(Python)

cookies = pickle.load(open("cookies.pkl", "rb"))
for cookie in cookies:
    print cookie
    new_cookie={}
    new_cookie['name']=cookie['name']
    new_cookie['value']=cookie['value']
    driver.add_cookie(new_cookie)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!