This thread is trying to answer question "How do I click a button to redirect to a new page in Playwright?"
you can use this for ref:
async openTargetBlankLink(locator: Locator, url: RegExp): Promise<void> {
const [newPage] = await Promise.all([this.page.context().waitForEvent('page'), locator.click()]);
await newPage.waitForLoadState('load');
await expect(newPage, 'Page is not opened').toHaveURL(url);
await newPage.close();
}```
<button class="MuiButtonBase-root MuiButton-root MuiButton-text MuiButton-textPrimary MuiButton-sizeMedium MuiButton-textSizeMedium MuiButton-root MuiButton-text MuiButton-textPrimary MuiButton-sizeMedium MuiButton-textSizeMedium w-full py-3 font-semibold rounded-md shadow-sm text-md px-14 text-mffu-gray-100 bg-gradient-to-r from-mffu-cream-100 to-mffu-blue-100 hover:from-mffu-cream-100 hover:to-mffu-cream-100 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-mffu-cream-100 css-1uyurgq" tabindex="0" type="submit">Next<span class="MuiTouchRipple-root css-w0pj6f"></span></button>
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].