I have a button that has a name property, such as <button class="MuiButtonBase-root MuiButton-root MuiButton-text jss43" tabindex="0" type="button" name="organization-dropdown"><span class="MuiButton-label"></button>
And when I use await page.getByRole("button", { name:'organization-dropdown', exact: true, }).toBeVisible()
I get a timeout and its not found When I test it in headed I can see the button exists so i am guessing that the getByRole is not working as I expect
Any help would be greatly appreciated
This thread is trying to answer question "Why is locating a button by its name property using getByRole in Playwright failing and resulting in a timeout?"
Yeah toBeVisible()
is quite specific:
"Ensures that Locator points to an attached and visible DOM node."
https://playwright.dev/docs/actionability#attached
https://playwright.dev/docs/actionability#visible
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].