[testcafe].click hyperlink inside body mail 激活 link 无效
[testcafe].click hyperlink inside body mail for activation link not work
我尝试仅针对点击超链接进行自动化,该超链接将重定向并触发到新选项卡以进行激活,但它不起作用,已经尝试使用选择器和 xpath
这里来自 inspect
<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
})
问题已通过添加 await t.switchToIframe('#msg_body')
解决。
我尝试仅针对点击超链接进行自动化,该超链接将重定向并触发到新选项卡以进行激活,但它不起作用,已经尝试使用选择器和 xpath
这里来自 inspect
<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
})
问题已通过添加 await t.switchToIframe('#msg_body')
解决。