What I’m trying to achieve is to go to an email inbox, pick the first email, which is where the otp is sent, and then extract the OTP and check if the one entered by the user matches it or not.
Something like:

test("otp-test", async ({ page }) => {
    //someEmailURL is the url address of the inbox
    await page.goto("someEmailURL");
    // 12345687-874512, this part of the ID varies each time tested as a new email is generated
    await page.locator("tr#row_random-12345687-874512").getByRole("cell", 
    { name: "OTP Verification"}).click();`your text`
}

How can I handle tr#row_random-12345687-874512, given 12345687-874512 this varies everytime I test?

New contributor

not_hisokaYet is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.