如何使testcafe尊重` `标签

问题描述 投票:4回答:1

我的应用程序在某个时刻将<base>标签注入网站,然后创建一个新的<script>标签与相对src

例如,设置<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 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" />

突然之前相对的URL build.js变成了http://localhost:8080/account/build.js,这与<base>中的设置不一致

知道怎么解决这个问题吗?

我在跑步

测试咖啡馆:1.1.0

javascript automated-tests e2e-testing testcafe base-tag
1个回答
1
投票

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

© www.soinside.com 2019 - 2024. All rights reserved.