解决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. db2官方文档

    开局贴链接.这个东西是真坑,下载竟然需要账号... (我就做一下记录,别喷我)

  2. JVM初认识

    运行时数据区域 程序计数器:程序计数器是一块较小的内存空间,它可以看作是当前线程所执行的字节码的行号指示器.在虚拟机的概念模型里,字节码解释器工作时就是通过改变这个计数器的值来选取下一条需要执行的字节 ...

  3. 绝了!一个妹子 rm -rf 把公司整个数据库删没了...

    经历了两天不懈努力,终于恢复了一次误操作删除的生产服务器数据.对本次事故过程和解决办法记录在此,警醒自己,也提示别人莫犯此错.也希望遇到问题的朋友能找到一丝灵感解决问题. 01 事故背景 安排一个妹子 ...

  4. 01.vue数据绑定

    Vue特点 渐进式: 渐进, 可以理解成一步一步的. 在使用Vue的时候, 我们不需要把整个Vue框架的东西都用上, 可以一步一步的根据需要慢慢的替换之前的代码. 自底向上逐层应用: 由底层开始, 把 ...

  5. 吴恩达-机器学习+udacity从机器学习到深度学习

  6. Magicodes.IE之花式导出

    总体设计 Magicodes.IE是一个导入导出通用库,支持Dto导入导出以及动态导出,支持Excel.Word.Pdf.Csv和Html.在本篇教程,笔者将讲述如何使用Magicodes.IE进行花 ...

  7. IP地址的获取

    //ip地址的获取:非原创,之前在其他地方看到,拿过来备份下: public static String getIPAddress(HttpServletRequest request) { Stri ...

  8. Python-local variable 'raw_password' referenced before assignment

    where? 执行Python程序的时候,报这个错 why? 变量作用域问题,在分支中定义的变量,当满足条件的时候则可以正确得到变量,当不满足条件的时候则报这个错 way? 把变量从分支中抽离到分支上 ...

  9. Python练习题 014:完数

    [Python练习题 014] 一个数如果恰好等于它的因子之和,这个数就称为"完数".例如6=1+2+3.编程找出1000以内的所有完数. -------------------- ...

  10. python基础知识 变量 数据类型 if判断

    cpu 内存 硬盘 操作系统 cpu:计算机的运算和计算中心,相当于人类的大脑 飞机 内存:暂时存储一些数据,临时加载数据和应用程序 4G 8G 16G 32G 速度快,高铁 断电即消失 造价高 硬盘 ...