I want to create the test
- Click on element with middle button on the mouse
- Verify content of page in new tab
I know how to create new Browser context, but I don't know how to switch to new page. Thank you for any help in advance.
I want to create the test
I know how to create new Browser context, but I don't know how to switch to new page. Thank you for any help in advance.
you can use the ElementHandle.click() method to simulate a mouse click on a particular element.
const browser = await playwright.chromium.launch();
const page = await browser.newPage();
// Navigate to a web page
await page.goto('https://www.example.com');
// Find the element that links to a new webpage
const linkElement = await page.$('a[href="https://www.example.com/new-page"]');
// Simulate a mouse click on the element
await linkElement.click()