python - 使用 selenium:如何在使用 python 关闭驱动程序后保持登录状态
问题描述
每次我使用 selenium 在 chrome 驱动程序中打开新窗口时都不需要登录 chrome 驱动程序
options = Options()
options.add_argument("user-data-dir=C:\\Users\\oyo\\AppData\\Local\\Google\\Chrome\\User Data")
driver = webdriver.Chrome(chrome_options=options)
driver.get('https://web.whatsapp.com/')
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: crashed
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location C:\Program Files (x86)\Google\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
(Driver info: chromedriver=2.42.591088 (7b2b2dca23cca0862f674758c9a3933e685c27d5),platform=Windows NT 10.0.17134 x86_64)
解决方案
我不知道这样做的方法,除非使用 cookie。
driver.manage().addCookie(arg0)
推荐阅读
- c++ - 为什么我的程序的功能没有正确运行?
- android - Android:更改 TimePickerDialog 选择器(圆形)背景颜色
- python - .find 没有返回完整的对象
- asp.net-core-2.0 - If Else 枚举类型
- java - 有效地构建真值表 (CPT)
- php - JSON编码的PHP不是一个对象?
- css - 为什么 Firefox 和 Chrome 的 inline-block 的结果不同?
- java - 如何找到 iFrame 元素
- scrapy - 从无限滚动页面获取链接
- java - 为什么我的 getTimeZone().getDisplayName 报告偏移量错误?