Reputation: 11
import { fixture, Selector } from 'testcafe';
fixture`Fixture import`.only
.page('https://testcafe.io/documentation/402634/guides');
test('Click a button', async t => {
await t.maximizeWindow()
const ab = Selector('a[href="/documentation/402837/guides/basic-guides/assertions"]')
await t.click(ab, {modifiers: {ctrl:true}})
await t.wait(5000)
});
I'm trying to open a link in new tab using ctrl + click, the testcase was getting pass, not throwing any error but the link is opening in the same tab.
Upvotes: 1
Views: 297
Reputation: 6318
TestCafe does not open new windows using the Ctrl + mouse click
combination. The ctrl
modifier only sets the ctrlKey
property of the MouseEvent to true
.
If you want to open a new window, you can use the openWindow
method: https://testcafe.io/documentation/402694/reference/test-api/testcontroller/openwindow
Upvotes: 1