Cypress · Middle · Question 16 of 77
How do you handle a link that opens a new tab in Cypress?
- 1New tabs open inside the same test automatically
- 2Use
cy.switchTab(1)after clicking the link - 3Check the
hrefor removetarget; tabs aren't supported
Show the answer
Correct answer: Check the href or remove target; tabs aren't supported
Explanation
Cypress controls one tab. Checking the link's href or removing target=_blank before clicking tests the behaviour in place.