Window/Tab Switching
Selenium:
Use getWindowHandles() to get all open tabs/windows and switch using switchTo().window(handle).
Set String handles = driver.getWindowHandles();
for (String h : handles) {
driver.switchTo().window(h);
}
Playwright:
Use context.waitForEvent('page') to capture the new tab as a Page object.
const [newPage] = await Promise.all([
context.waitForEvent('page'),
page.click('a[target=_blank]')
]);
await newPage.bringToFront();
Cypress:
No direct support for multiple tabs. Stub window.open or force the link to open in the same tab.
cy.window().then((win) = {
cy.stub(win, 'open').as('tabOpen');
});
cy.get('a').click();
cy.get('@tabOpen').should('be.called');