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


    解决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
    
     
  • 相关阅读:
    (一)3、安装jexus
    走向全栈之坑—开始实践
    java Collection.stream操作
    redis常用命令练习
    Spring4
    java数据提交时问题
    常见协议默认端口
    重写equals方法
    redis
    xml
  • 原文地址:https://www.cnblogs.com/brady-wang/p/12524706.html
Copyright © 2020-2023  润新知