selenium.common.exceptions.WebDriverException: Message: unable to set cookie

简介: selenium.common.exceptions.WebDriverException: Message: unable to set cookie

问题

使用selenium 的chrome 添加cookie


chrome.add_cookie(cookie_dict)        # 添加cookie

报错

selenium.common.exceptions.WebDriverException: Message: unable to set cookie

解决:

必须首先加载网站,这样Selenium 才能知道cookie 属于哪个网站


chrome.get("https://www.baidu.com/")


chrome.add_cookie(cookie_dict)

相关文章
|
5月前
|
容器
Unable to create tempDir. java.io.tmpdir is set to /tmp
Unable to create tempDir. java.io.tmpdir is set to /tmp
237 1
|
3月前
|
Web App开发 数据采集 Java
【Python】已完美解决:selenium.common.exceptions.SessionNotCreatedException: Message: session not created
【Python】已完美解决:selenium.common.exceptions.SessionNotCreatedException: Message: session not created
258 0
|
2月前
Unable to create tempDir. java.io.tmpdir is set to /tmp
Unable to create tempDir. java.io.tmpdir is set to /tmp
24 0
|
3月前
|
Web App开发 测试技术 Python
【Python】已解决:selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrom
【Python】已解决:selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrom
223 6
|
5月前
|
IDE 开发工具 Python
selenium.common.exceptions.NoSuchDriverException: Message: Unable to obtain driver for MicrosoftEdge
selenium.common.exceptions.NoSuchDriverException: Message: Unable to obtain driver for MicrosoftEdge
480 3
|
5月前
selenium.common.exceptions.InvalidElementStateException: Message: Unable to perform W3C actions.
selenium.common.exceptions.InvalidElementStateException: Message: Unable to perform W3C actions.
86 0
|
Web App开发 Python Windows
selenium.common.exceptions.WebDriverException: Message: session not created(已解决)
selenium.common.exceptions.WebDriverException: Message: session not created(已解决)
125 0
|
13天前
|
Web App开发 JavaScript Java
自动化测试的利剑:Selenium WebDriver入门与实践
【9月更文挑战第21天】在软件开发的海洋中,自动化测试犹如一艘船,帮助开发者们快速航行至质量保证的彼岸。本文将作为你的罗盘,指引你了解和掌握Selenium WebDriver这一强大的自动化测试工具。通过深入浅出的方式,我们将探索Selenium WebDriver的基本概念、安装过程以及编写简单测试脚本的方法。无论你是刚接触自动化测试的新手,还是希望提升测试技能的开发者,这篇文章都将为你提供有价值的指导。
|
13天前
|
Web App开发 测试技术 持续交付
自动化测试的利器:Selenium与Python的完美结合
【9月更文挑战第21天】在软件开发的世界里,测试是确保产品质量的关键步骤。随着敏捷开发和持续集成的流行,自动化测试工具变得尤为重要。本文将介绍如何使用Selenium和Python进行高效的自动化测试,不仅提供代码示例,还深入探讨如何设计测试用例、选择正确的测试框架、以及如何整合到CI/CD流程中。无论你是初学者还是有经验的开发者,这篇文章都将为你提供宝贵的见解和实用的技巧。
25 3
|
26天前
|
Web App开发 Java 测试技术
自动化测试的利器:Selenium WebDriver入门与实践
【9月更文挑战第8天】在软件开发的海洋中,测试是确保我们不会溺水的那根救生索。Selenium WebDriver,作为自动化测试的明星工具,让这根救生索更加结实可靠。本文将带你快速上手Selenium WebDriver,从基础设置到实际操作,再到实战演练,让你的开发之旅更加平稳顺畅。
下一篇
无影云桌面