解决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. Linux驱动之GPIO子系统和pinctrl子系统

    前期知识   1.如何编写一个简单的Linux驱动(一)--驱动的基本框架   2.如何编写一个简单的Linux驱动(二)--设备操作集file_operations   3.如何编写一个简单的Lin ...

  2. in多值优化

    〇.问题 今天ocp群里有人问 SELECT * FROM table WHERE id IN(11,2,3,44,...) 在in里面有大量数据4000+,有什么 好的处理方式吗? 我的优化方案的总 ...

  3. JS进阶 | 解决JQ keyup事件延迟的问题

    写在前面 在使用keyup事件时,存在一个问题,假如想要做出类似于表单验证的demo:表单输入账号 “xxx” 后  再去ajax异步去后台数据库匹配,但是keyup事件的原理是每次键盘事件弹起就会检 ...

  4. Linux实战(3):升级最新内核

    # 先查看一下当前内核版本 uname -r # 升级内核 rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch. ...

  5. CRM、用户管理权限

    CRM目录结构 from django.shortcuts import HttpResponse,render,redirect from django.conf.urls import url f ...

  6. Boolean.valueOf(String)

    Boolean.valueOf(String) a. 当 String 的参数值在不区分大小写的时候等于 "true" ,则 Boolean.valueOf(String) 返回值 ...

  7. css定位于xpath的区别

    css选择  是依据页面的数据样式定位的, 有标签选择, 类选择, id选择, 或者他们的交并集, 除此之外没有其他的辅助元素了 xpath  是路径表达式,所有元素和内容都可以成为路径的一部分. 两 ...

  8. burp suite 之 Decoder(解码) Comparer(比较器) Extender(扩展)

    Decoder模块 将原始数据转换成各种编码和哈希表的简单工具,它能够智能地识别多种编码格式 Decoder as..解码 Encode as...编码 Hash : 哈希值计算 Smart deco ...

  9. 1、了解JVM

    1.JVM.JRE.JDK JVM:是可以将要运行的程序编译成机器语言并去执行的一个平台,具有跨语言.跨平台的特性,运行时需要依赖JRE中的类库 JRE:包含了JVM以及代码运行时的类库,时Java程 ...

  10. Python-函数式编程-map reduce filter lambda 三元表达式 闭包

    lambda 匿名函数,核心是作为算子,处理逻辑只有一行但具有函数的特性,核心用于函数式编程中 三元运算符 其实本质上是if分支的简化版,满足条件返回 if 前面的值,不满足条件返回 else后面的值 ...