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

  2. <small id='carvb'></small><noframes id='carvb'>

      <bdo id='carvb'></bdo><ul id='carvb'></ul>
    1. <tfoot id='carvb'></tfoot>
    2. <legend id='carvb'><style id='carvb'><dir id='carvb'><q id='carvb'></q></dir></style></legend>
    3. 在运行测试时放宽 Chrome 的 CSP (webdriver) (Content-

      时间:2023-09-03
    4. <small id='fy2a6'></small><noframes id='fy2a6'>

        <legend id='fy2a6'><style id='fy2a6'><dir id='fy2a6'><q id='fy2a6'></q></dir></style></legend>
            <tbody id='fy2a6'></tbody>

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

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

                本文介绍了在运行测试时放宽 Chrome 的 CSP (webdriver) (Content-Security-policy)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我正在尝试在使用 proctractor(webdriver、chromedriver)运行测试时放松 Chrome 的 CSP.

                I'm trying to relax Chrome's CSP while running a test using proctractor (webdriver, chromedriver).

                所以解决方案可以是

                1. 根据我的搜索结果,类似--disable-csp"的标志不存在.
                2. webdriver/protractor 的设置.

                我找不到任何解决方案,只能设置一个过滤标头的代理.

                I could not find any solution but to setup a proxy that filters the header.

                有什么想法吗?

                推荐答案

                目前没有原生选项,但您可以使用扩展禁用 CSP.

                currently there are no native option but you can disable CSP using extension.

                步骤:

                1. 下载扩展禁用内容安全策略
                2. 将其保存为.zip,因为它需要修改以在启动时启用禁用CSP"
                3. 解压文件或使用Winrar双击文件background.js编辑
                4. var isCSPDisabled = false; 更改为 true
                5. 保存更改.
                1. Download extension Disable Content-Security-Policy
                2. Save it as .zip, because it need modification to enable "disable CSP" at start
                3. extract the file or if using Winrar double click file background.js to edit
                4. change var isCSPDisabled = false; to true
                5. save change.

                代码

                chrome_options = Options()
                chrome_options.add_extension('path/to/disableCSP.zip') # or disableCSP.xpi
                driver = webdriver.Chrome(chrome_options=chrome_options)
                

                这篇关于在运行测试时放宽 Chrome 的 CSP (webdriver) (Content-Security-policy)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:使用量角器从 chromedriver 获取 HTTP 请求(性能日志 下一篇:如何在 Chrome 中单击通过 webdriver 通过 Ajax 加载的

                相关文章

                最新文章

              1. <legend id='NdO0K'><style id='NdO0K'><dir id='NdO0K'><q id='NdO0K'></q></dir></style></legend>

              2. <tfoot id='NdO0K'></tfoot>
                  <bdo id='NdO0K'></bdo><ul id='NdO0K'></ul>

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

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