1. <small id='bvh6G'></small><noframes id='bvh6G'>

      <i id='bvh6G'><tr id='bvh6G'><dt id='bvh6G'><q id='bvh6G'><span id='bvh6G'><b id='bvh6G'><form id='bvh6G'><ins id='bvh6G'></ins><ul id='bvh6G'></ul><sub id='bvh6G'></sub></form><legend id='bvh6G'></legend><bdo id='bvh6G'><pre id='bvh6G'><center id='bvh6G'></center></pre></bdo></b><th id='bvh6G'></th></span></q></dt></tr></i><div id='bvh6G'><tfoot id='bvh6G'></tfoot><dl id='bvh6G'><fieldset id='bvh6G'></fieldset></dl></div>
        <bdo id='bvh6G'></bdo><ul id='bvh6G'></ul>
      1. <tfoot id='bvh6G'></tfoot>

        <legend id='bvh6G'><style id='bvh6G'><dir id='bvh6G'><q id='bvh6G'></q></dir></style></legend>

        如何修复“无效的参数:无效的‘到期’"在向

        时间:2023-10-08
        <legend id='dhqL8'><style id='dhqL8'><dir id='dhqL8'><q id='dhqL8'></q></dir></style></legend>

            • <bdo id='dhqL8'></bdo><ul id='dhqL8'></ul>

              • <small id='dhqL8'></small><noframes id='dhqL8'>

                <tfoot id='dhqL8'></tfoot>

                  <tbody id='dhqL8'></tbody>
              • <i id='dhqL8'><tr id='dhqL8'><dt id='dhqL8'><q id='dhqL8'><span id='dhqL8'><b id='dhqL8'><form id='dhqL8'><ins id='dhqL8'></ins><ul id='dhqL8'></ul><sub id='dhqL8'></sub></form><legend id='dhqL8'></legend><bdo id='dhqL8'><pre id='dhqL8'><center id='dhqL8'></center></pre></bdo></b><th id='dhqL8'></th></span></q></dt></tr></i><div id='dhqL8'><tfoot id='dhqL8'></tfoot><dl id='dhqL8'><fieldset id='dhqL8'></fieldset></dl></div>
                  本文介绍了如何修复“无效的参数:无效的‘到期’"在向 chromedriver 添加 cookie 时在 Selenium 中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在尝试将 cookie 添加到浏览器,但出现以下错误:

                  I'm trying to add cookies to a browser, but getting the following error:

                  消息:无效参数:无效的到期"(会话信息:chrome=75.0.3770.90)

                  Message: invalid argument: invalid 'expiry' (Session info: chrome=75.0.3770.90)

                  此代码显示了我如何加载和添加 cookie.

                  This code shows how I load and add cookies.

                  for cookie in pickle.load(open(r'{0}{1}_cookie.pkl'.format(settings.COOKIES_PATH, self.tv_username), 'rb')):
                      self.browser.add_cookie(cookie)
                  

                  cookie 的值:

                  {'__utmc': '226258911', '_sp_id.cf1a': '0b243b32-8dee-46d9-a243-bb4d2bfcb805.1560942815.1.1560942821.1560942815.5941cbc0-0500-4a17-8f6c-4ee3f133f67c', 'km_vs': '1', '__utmt': '1', '__utma': '226258911.510671571.1560942814.1560942814.1560942814.1', 'km_ai': 'm6caeIAUtEqx%2BIWda%2F7klZER%2F1Y%3D', 'kvcd': '1560942821112', '__utmb': '226258911.2.10.1560942814', 'km_lv': '1560942821', '__utmz': '226258911.1560942814.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)', 'etg': 'undefined', '_sp_ses.cf1a':'*'}
                  

                  它适用于以前版本的 chrome.任何帮助将不胜感激!

                  It worked fine with previous version of chrome. Any help would be appreciated!

                  推荐答案

                  问题是您尝试添加的 cookie 格式与 selenium 预期的格式不同.

                  The problem is that you are trying to add the cookies with a different format than the selenium expects.

                  python selenium api 参考 说你必须用这样的字典插入 cookie

                  The python selenium api reference says that you have to insert the cookies with a dict like that

                  driver.add_cookie({'name' : 'foo', 'value' : 'bar'})
                  

                  因此您必须调整循环以使用键值格式

                  So you have to adapt your loop to use a key,value format

                  for key, value in pickle.load(open(r'{0}{1}_cookie.pkl'.format(settings.COOKIES_PATH, self.tv_username), 'rb')):
                      self.browser.add_cookie({'name' : key, 'value' : value})
                  

                  这篇关于如何修复“无效的参数:无效的‘到期’"在向 chromedriver 添加 cookie 时在 Selenium 中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何在 pyinstaller 中包含 chromedriver? 下一篇:如何在 Chrome 中使用 Selenium 处理另存为对话框

                  相关文章

                  最新文章

                  1. <legend id='yQjI6'><style id='yQjI6'><dir id='yQjI6'><q id='yQjI6'></q></dir></style></legend>
                    <i id='yQjI6'><tr id='yQjI6'><dt id='yQjI6'><q id='yQjI6'><span id='yQjI6'><b id='yQjI6'><form id='yQjI6'><ins id='yQjI6'></ins><ul id='yQjI6'></ul><sub id='yQjI6'></sub></form><legend id='yQjI6'></legend><bdo id='yQjI6'><pre id='yQjI6'><center id='yQjI6'></center></pre></bdo></b><th id='yQjI6'></th></span></q></dt></tr></i><div id='yQjI6'><tfoot id='yQjI6'></tfoot><dl id='yQjI6'><fieldset id='yQjI6'></fieldset></dl></div>

                    <small id='yQjI6'></small><noframes id='yQjI6'>

                    <tfoot id='yQjI6'></tfoot>
                    • <bdo id='yQjI6'></bdo><ul id='yQjI6'></ul>