【发布时间】:2018-10-12 16:37:54
【问题描述】:
我目前在 chrome 中的 testcafe 上运行了一个扩展,方法是在 chrome 上安装扩展并运行:testcafe chrome:userProfile test.js
我的扩展中的content_script 注入了一个指向web_accessible_resource index.html 资产的iframe。但是,当我使用 t.switchToIframe 切换到 iframe 上下文时,testcafe 会返回“您要切换到的 iframe 的内容未加载”
据我所见,当它的格式为chrome-extension://[PACKAGE ID]/[PATH]) 时,testcafe-hammerhead 似乎没有重写 iframe src,所以我尝试将 url 更改为指向一个 url,即 localhost:8080/index。 html 但这也不起作用。
如果我创建一个 html 文件,使用 js 文件注入 iframe,我就可以让测试运行并与 iframe 交互。因此,我认为这与内容脚本的运行方式以及它们如何将内容注入 DOM 有关。
还有其他人遇到过这个问题/对如何为一般扩展编写测试有更好的建议吗?
谢谢
【问题讨论】:
标签: testing iframe google-chrome-extension automated-tests testcafe