【问题标题】:How to make testcafe respect the `<base>` tag如何让 testcafe 尊重 `<base>` 标签
【发布时间】:2019-08-10 05:33:33
【问题描述】:

我的应用程序在某些时候将&lt;base&gt; 标记注入网站,然后创建一个新的&lt;script&gt; 标记与相对src

例如设置&lt;base href="http://localhost:8080/chapters/de/auth/"&gt; 并注入&lt;script src="build.js" type="text/javascript" /&gt; 导致浏览器从http://localhost:8080/chapters/de/auth/build.js 下载脚本。

在 testcafe 中运行相同的应用程序时,结果会略有不同。插入的碱基是&lt;base href-hammerhead-stored-value="http://localhost:8080/chapters/de/auth/" href="http://localhost:1337/Lj6CFUfNF/http://localhost:8080/chapters/de/auth/"&gt;,脚本是&lt;script src-hammerhead-stored-value="build.js" src="http://localhost:1337/Lj6CFUfNF!s!utf-8/http://localhost:8080/account/build.js" type="text/javascript" /&gt;

原来的相对网址build.js突然变成了http://localhost:8080/account/build.js,和&lt;base&gt;中设置的不符

知道如何解决这个问题吗?

我在跑步

testcafe:1.1.0

【问题讨论】:

    标签: javascript automated-tests e2e-testing testcafe base-tag


    【解决方案1】:

    问题的原因在于注入basescript标签的顺序。 如果script元素在base元素之前注入,会导致错误。 请在以下情况下跟踪我们的进展 https://github.com/DevExpress/testcafe/issues/3585 GitHub 上的问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-02-04
      • 1970-01-01
      • 2011-01-10
      • 1970-01-01
      • 1970-01-01
      • 2015-09-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多