【发布时间】:2020-08-16 09:28:46
【问题描述】:
我尝试了以下方法:
t.switchTo("frameID");
var ele = Selector("#ele");
await t.click(ele);
又一次尝试:
Selector(() =>{return document.getElementById("frameId").contentDocument.getElementById("#ele")});
这会引发以下错误:选择器的函数应返回 DomElement、NodeList、HtmlCollection、NULL 或未定义。
HTML DOM 如下:
<html>
<body>
<frameset>
<frame id='frame1'>
#document
<html>
<body>
<p id='ele1'>Hello World</p>
</body>
</html>
</frame>
</frameset>
</body>
</html>
【问题讨论】:
-
能否分享您要测试的页面的 HTML DOM?
-
嗨 Rahul,我已经编辑了我的问题以包含页面的 HTML DOM。
-
我希望你使用 t.switchTo("frame1") 而不是 t.switchTo("frameID") 因为 frame id 的实际值是 frame1。除此之外,我看不到任何其他错误。
标签: testing automation automated-tests e2e-testing testcafe