解决selenium.common.exceptions.InvalidArgumentException: Message: invalid argument: invalid 'expiry'

 

浏览器添加cookies

 with open('cookies', 'r', encoding='utf-8') as f:
list_cookies = json.loads(f.readline())
print(list_cookies)
# cookie = [item["name"] + "=" + item["value"] for item in list_cookies]
# cookiestr = '; '.join(item for item in cookie)
# print(cookiestr) driver.get("https://jd.com")
driver.delete_all_cookies() for cookie in list_cookies:
driver.add_cookie(cookie)
driver.get("https://order.jd.com/center/list.action")
return driver

抱错

selenium.common.exceptions.InvalidArgumentException: Message: invalid argument: invalid 'expiry'
(Session info: chrome=77.0.3865.120)

解决方法

with open('cookies', 'r', encoding='utf-8') as f:
list_cookies = json.loads(f.readline())
print(list_cookies)
# cookie = [item["name"] + "=" + item["value"] for item in list_cookies]
# cookiestr = '; '.join(item for item in cookie)
# print(cookiestr) driver.get("https://jd.com")
driver.delete_all_cookies() for cookie in list_cookies:
if 'expiry' in cookie:
del cookie['expiry']
driver.add_cookie(cookie)
driver.get("https://order.jd.com/center/list.action")
return driver
 
 

解决selenium.common.exceptions.InvalidArgumentException: Message: invalid argument: invalid 'expiry'的更多相关文章

  1. 【Selenium】【BugList7】执行driver.find_element_by_id("kw").send_keys("Selenium"),报错:selenium.common.exceptions.InvalidArgumentException: Message: Expected [object Undefined] undefined to be a string

    [版本] selenium:3.11.0 firefox:59.0.3 (64 位) python:3.6.5 [代码] #coding=utf-8 from selenium import webd ...

  2. 解决selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in P

    转载 解决selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be i ...

  3. 报错:selenium.common.exceptions.InvalidArgumentException: Message: invalid argument: missing 'name'

    代码运行到这:driver.add_cookie(cookies),报错了 相信坑了不少人,接下来是解决办法 driver.add_cookie(cookies) cookies = { " ...

  4. Path通过Selenium模拟浏览器抓取,Windows 64解决selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.方法

    1.下载geckodriver.exe: 下载地址:https://github.com/mozilla/geckodriver/releases请根据系统版本选择下载:(如Windows 64位系统 ...

  5. 解决selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home

    解决方案: 1.查看浏览器当前版本:chrome://version/. 2.到https://sites.google.com/a/chromium.org/chromedriver/downloa ...

  6. Selenium click不生效 报错selenium.common.exceptions.InvalidArgumentException

    记录在使用selenium过程中踩的坑------ 在使用selenium时,用click点击网站弹出的文件上传框的"上传文件"按钮不生效,报错selenium.common.ex ...

  7. selenium的报错信息:selenium.common.exceptions.InvalidSelectorException: Message: invalid selector: Compound class names not permitted

    报错信息:selenium.common.exceptions.InvalidSelectorException: Message: invalid selector: Compound class ...

  8. 关于Selenium.common.exceptions.WebDriverException: Message: Invalid locator strategy: css selector 的问题

    在执行脚本时报Selenium.common.exceptions.WebDriverException: Message: Invalid locator strategy: css selecto ...

  9. selenium使用遇到的问题(selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH.)

    1.安装pip3 install selenium 2.使用browser=webdriver.Chrome()时报错 :selenium.common.exceptions.WebDriverExc ...

随机推荐

  1. oracle之二管理undo

    管理undo(PPT-I-299-309) 7.1 undo的作用(SMON) 使用undo tablespace 存放从datafiles 读出的数据块的前镜像,提供以下四种情况所需要的信息     ...

  2. xss中shellcode的调用

    shellcode就是利用漏洞所执行的代码 在完整的xss攻击之中,会将shellcode存放在一定的地方,然后触发漏洞,引发shellcode. 1.远程调用执行js 可将js代码单独放在一个js文 ...

  3. Unit2:活动

    1.基本用法 1.创建活动 Generate LayoutFile 创建布局文件 Launcher Activity 自动注册为主活动 编写顺序 活动Activity 注册.xml 界面res.xx ...

  4. [计算机网络]TCP/IP协议-运输层

    TCP/IP体系结构 TCP/IP四层协议 五层协议 协议 作用 应用层 应用层 HTTP超文本传输协议.FTP文件传输协议 - 运输层 运输层 TCP(面向连接的,可靠的).UDP(无连接的,不保证 ...

  5. Docker实战(6): 导出docker镜像离线包

    前言 离线环境安装Docker 镜像,我已知两种情况,以下操作我将采用在可访问外网的机器上通过镜像迁移的方式来给离线环境安装. 环境:服务器node1可访问外网.服务器node2无法访问外网 两台机器 ...

  6. Windows实战(1):Nginx代理设置及负载均衡配置

    简言 以下配置实现功能: 反向代理 通过轮询的方式实现nginx负载均衡 直接看以下配置文件: #user nobody; worker_processes 1; #error_log logs/er ...

  7. (专题一)01 matlab基础

    功能区:主页,绘图,应用程序 当前文件夹工具栏 命令行窗口:输入命令,按下回车键,会在后面显示执行后的命令 如果命令行很长可以分两行来写,用“...”做续行符 建立当前文件夹:可以用cd命令 例如在d ...

  8. 6.Kafka消息流处理

  9. Sorted Adjacent Differences(CodeForces - 1339B)【思维+贪心】

    B - Sorted Adjacent Differences(CodeForces - 1339B) 题目链接 算法 思维+贪心 时间复杂度O(nlogn) 1.这道题的题意主要就是让你对一个数组进 ...

  10. uniapp vue v-html,显示富文本,内容img图片超出解决办法

    uniapp h5中,v-html,img图片中style=width:auto;会显示图片原来的尺寸,会超出屏幕,替换成width:100%,这样就不会超出屏幕 重要的地方,例如<img sr ...