Sample HTML Code: <div id="row"><span data-testid="spanD" click="clicked()"></span></div> Playwright Code to access element:
const editBtn = page.locator(id='#row') await editBtn.getByTestId('spanD').click()
This always fails and times out. When i print the getByTestId it adds an 's' to the id given
This thread is trying to answer question "How to fix the error when accessing an element with getByTestId in Playwright?"
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].