Closed JeevanHB closed 1 year ago
locator.isVisible(xpath=//workspace[@ng-model="workspace.name"]/a)— ../../../workspaces/page/workspacesPage.js:112 111 | // var text = getPage().locator(this.locator); 112 | console.log("Text is "+ await getPage().locator(this.workspaceNameInListingLoc).isVisible()) | ^ 113 | return await getPage().locator(this.workspaceNameInListingLoc).innerText();
Please guide us what is the syntax we r missing in above code, Isvisble/innerText is not working in our script.
It seems your locator does violate strict mode of Playwright. Strict mode means your locator should and must resolve to only one web element. In stack trace, it resolves to 15 elements.
As per above, a strict mode violation is if a locator resolves to multiple elements. To solve this you can do e.g.
to target a specific element. You can also call .locator('more specific') on your existing locator to make it more specific.
.locator('more specific')
Thanks
locator.isVisible(xpath=//workspace[@ng-model="workspace.name"]/a)— ../../../workspaces/page/workspacesPage.js:112 111 | // var text = getPage().locator(this.locator); 112 | console.log("Text is "+ await getPage().locator(this.workspaceNameInListingLoc).isVisible()) | ^ 113 | return await getPage().locator(this.workspaceNameInListingLoc).innerText();
Please guide us what is the syntax we r missing in above code, Isvisble/innerText is not working in our script.