【发布时间】:2021-10-31 12:55:41
【问题描述】:
在我正在测试的网站上,我有一个链接——点击它会弹出一个弹出窗口。 我能够找到该链接,但是单击该链接会导致“未捕获的异常 TypeError:无法读取属性弹出窗口...”。如果我抑制异常测试通过但我仍然看不到弹出窗口。
我尝试过等待,但没有成功。如果有人遇到类似问题,那么想在这里检查一下吗?
弹出弹窗的链接元素在下方
<a class="locpickerSelect" data-blank="<span>Select Location</span>" data-change="<span>Change Selection</span>" href="#"><span>Select Location</span></a>
弹出窗口在源代码中添加了一个额外的 div,下面是我单击链接时在源代码中看到的内容
<div class="PopupOverlay" style="inset: 0px; position: fixed;"></div>
<div class="PopupShadow" style="width: 940px; height: 352px; top: 5px; left: 216px;"></div>
<div class="PopupFrame" style="width: 940px; height: 352px; left: 216px; top: 5px;">
<a class="ClosePopup icon cancel-circle"></a>
<iframe seamless="seamless" frameborder="0" width="100%" height="100%" src="https://<myurl>;forFeature=&selectOrgId=" style="display: block; height: 352px;"></iframe>
</div>
【问题讨论】:
-
请分享您的 cypress 代码 sn-p。
-
不能分享太多,但这就是它的样子,我可以在 Cypress runner 中看到它能够定位元素但点击部分抛出异常`描述('popupTest',函数( ) { it('启动 ID', function(){ cy.visit("https://
/") cy.get('.locpickerSelect').click({force: true}) } ) } ) `
标签: cypress ui-automation browser-automation