[testcafe] .click正文邮件中的超链接,无法激活链接

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

我尝试仅针对单击链接超链接进行自动化,该链接将重定向并触发到新选项卡以进行激活,但是它不起作用,已经尝试使用选择器和xpath

这里来自检查

<a title="Activation" href="<base_url>?activation_token=k6ZkSyodTa2AXyv73Z5Z%2Fg" target="_other" rel="nofollow" xpath="1">ACTIVATE</a>

这是我的简单代码

import { Selector, t } from 'testcafe'
import xPathToCss from 'xpath-to-css'
import XPathSelector from './xpath-selector'
fixture('test 2').page('https://www.mailinator.com/v3/#/#inboxpane')
test.only('click link activation', async t => {
    const activateLink = Selector('body:nth-child(2) p:nth-child(2) > a:nth-child(1)')  
    await t.click(activateLink) // keeps failing
})
javascript typescript testing automated-tests testcafe
1个回答
0
投票
此问题已通过添加await t.switchToIframe('#msg_body')解决。
© www.soinside.com 2019 - 2024. All rights reserved.