我想编写自动测试,测试在kibana UI中是否有日志,并且我在使用java向kibana发送http请求时遇到问题。在浏览器中,一切运行正常,但是当我从Jsoup库发送HTTP请求时(curl也会发生同样的情况),kibana向我显示以下内容:
Please upgrade your browser This Elastic installation has strict
security requirements enabled that your current browser does not meet.
看起来kibana正在执行一些易受攻击的js,如果执行正确,它将停止加载kibana UI。
<script>
// Since this is an unsafe inline script, this code will not run
// in browsers that support content security policy(CSP). This is
// intentional as we check for the existence of __kbnCspNotEnforced__ in
// bootstrap.
window.__kbnCspNotEnforced__ = true;
</script>
<script src="/bundles/app/kibana/bootstrap.js"></script>
你知道如何从代码中解决这个问题吗?我认为这个安全特性可以在kibana.yaml中禁用,但我不想仅仅为了测试而禁用它。
发布于 2021-09-17 11:03:09
我放弃了这样的自动测试,但我想在这里回答一个可能的解决方案(我没有测试它,但它应该可以工作)。
您可以使用Headless Chrome browser。它运行的是没有UI的chrome浏览器,可以与使用selenium库的chrome驱动程序一起使用。更多信息:https://www.scrapingbee.com/blog/introduction-to-chrome-headless/
https://stackoverflow.com/questions/63897826
复制相似问题