zoukankan      html  css  js  c++  java
  • 解决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
    
    
  • 相关阅读:
    Oracle Vm VirtualBox 搭建 yum 环境
    Vmware Workstation _linux yum 仓库搭建
    redhat5 设置静态ip
    管理表空间和数据文件
    表空间详解
    ocp linux 基础要点
    事务
    Hash哈希类型
    SortedSet有序集合类型
    set集合类型
  • 原文地址:https://www.cnblogs.com/an5456/p/11715938.html
Copyright © 2011-2022 走看看