如何让TestCafe遵循`<base>`标签

4
我的应用程序某个地方将 <base> 标签注入到网站中,然后创建一个新的相对 src<script> 标签。
例如设置 <base href="http://localhost:8080/chapters/de/auth/"> 并注入 <script src="build.js" type="text/javascript" />,结果浏览器会从 http://localhost:8080/chapters/de/auth/build.js 下载该脚本。
但在 testcafe 中运行相同的应用程序时,结果略有不同。插入的 base 是 <base href-hammerhead-stored-value="http://localhost:8080/chapters/de/auth/" href="http://localhost:1337/Lj6CFUfNF/http://localhost:8080/chapters/de/auth/">,脚本则是 <script src-hammerhead-stored-value="build.js" src="http://localhost:1337/Lj6CFUfNF!s!utf-8/http://localhost:8080/account/build.js" type="text/javascript" />
突然间之前相对路径 build.js 变成了 http://localhost:8080/account/build.js,这与 <base> 中设置的路径不一致。
有任何想法如何解决这个问题吗?
我正在运行:
testcafe: 1.1.0
1个回答

1

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接