Replies: 3 comments
-
It looks like you're attempting to click on the SVG
In this case, ideally, you'd instead be querying for the native checkbox control using an accessible label, like so: const header = await this.screen.findByTestId('erow-GroupCode-0');
const check = this.within(header).getByRole("checkbox");
await check.click(); Once you're reviewed that, if you're still having this kind of problem, it's really an issue with how you're using Playwright, and it has nothing to do with Playwright Testing Library. I suggest you try to debug your tests using Playwright's robust debugging capabilities before opening an issue here: |
Beta Was this translation helpful? Give feedback.
-
SVG const check = this.within(header).getByText("check") meanwhile i will try this and keep you posted using getByRole() const header = await this.screen.findByTestId('erow-GroupCode-0'); await check.click(); |
Beta Was this translation helpful? Give feedback.
-
The ✅ Query + click SVG using
playwright-testing-library/test/fixture/locators.test.ts Lines 122 to 128 in d5a665b ❌ Query + click playwright-testing-library/test/fixture/locators.test.ts Lines 130 to 139 in d5a665b Markupplaywright-testing-library/test/fixtures/page.html Lines 30 to 38 in d5a665b |
Beta Was this translation helpful? Give feedback.
-
while trying to click the checkbox using the following test, it fails with the following error: selector resolved to hidden <title>check</title>
async checkActiveStatusdom(text) {
const header = await this.screen.findByTestId('erow-GroupCode-0');
console.log(" header" + header)
const base = this.within(header).getByText("LINEHOLDER")
console.log("base value" + base);
const check = this.within(header).getByText("check")
console.log(" value " + check)
await expect(base).toContainText(text);
console.log("text assertion successful")
await check.click(); ---> fails
}
output:
headerLocator@query-by-test-id=["erow-GroupCode-0"]
base valueLocator@query-by-test-id=["erow-GroupCode-0"] >> get-by-text=["LINEHOLDER"]
value Locator@query-by-test-id=["erow-GroupCode-0"] >> get-by-text=["check"]
text assertion successful
Beta Was this translation helpful? Give feedback.
All reactions