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

      <tfoot id='V7o0G'></tfoot>
    1. <small id='V7o0G'></small><noframes id='V7o0G'>

        <bdo id='V7o0G'></bdo><ul id='V7o0G'></ul>

        在量角器测试中从 localStorage 设置项目

        时间:2023-06-15

            <bdo id='DH0ez'></bdo><ul id='DH0ez'></ul>

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

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

                • 本文介绍了在量角器测试中从 localStorage 设置项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  describe('The feature', function() {     
                      beforeEach(function () {
                         browser.executeScript('localStorage.setItem("key","value");');
                      });
                  
                     it('should do this', function() {
                  
                     });
                  });
                  

                  但是当使用 chromedriver 2.10 和 chrome 37 对 selenium 运行测试时出现此错误

                  but i get this error when the test is run against selenium with chromedriver 2.10 and chrome 37

                  Executing: [execute script: window.localStorage.setItem("key","value");, []])
                  15:31:29.747 WARN - Exception thrown
                  org.openqa.selenium.WebDriverException: <unknown>: Failed to read the 'localStorage'
                  property from 'Window': Storage is disabled inside 'data:' URLs.
                  (Session info: chrome=37.0.2062.120)
                  (Driver info: chromedriver=2.10.267518,platform=Linux 3.11.0-26-generic x86_64) (WARNING:  
                  The server did not provide any stacktrace information)
                  

                  知道问题出在哪里吗?

                  推荐答案

                  根据 在量角器测试中从 localStorage 中删除一个项目,当您尝试访问 localStorage 而不点击浏览器时会发生这种情况(例如,browser.get) 在您使用 Chrome 驱动程序时首先.解决方案似乎是首先点击浏览器(可能是您的根页面)以在 Chrome 中加载一个页面,以便您可以操作 localStorage.这至少是我为我们的项目所做的.希望这会有所帮助!

                  According to one of the answers at Remove an item from localStorage in a protractor test, this happens when you try to access localStorage without hitting the browser (say, browser.get) first when you are using the Chrome driver. The solution seems to be to hit the browser first (maybe your root page) to get a page loaded in Chrome so that you can manipulate the localStorage. That at least is what I have been doing for our project. Hope this helps!

                  这篇关于在量角器测试中从 localStorage 设置项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:量角器错误消息“不支持的命令行标志"在铬? 下一篇:如何处理量角器中未找到元素的异常

                  相关文章

                  <tfoot id='7qnuD'></tfoot>

                    <small id='7qnuD'></small><noframes id='7qnuD'>

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

                      <bdo id='7qnuD'></bdo><ul id='7qnuD'></ul>