You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In DOM sometimes we have multiple elements ".item" with a text containing "Add", e.g. "Add", "Add problem" or just a text "Addison Ryan" (a user full name).
When a test clicks on a link (".item") with the text "Add", it can't use locate(".item").withText("Add") because all "Add*" elements match (and thus any of them can be "randomly" selected).
It would be handy to have a method withTextEquals() (an analogy to the Playwright helper's method seeTextEquals()) that selects a locator which's text equals to passed argument.
XPath allows .= and text()=, see https://stackoverflow.com/a/34595441/10172701
IMHO .= is better for our case as it computes string as a concatenation of all strings inside element, so it behaves similar as contains(., ${text}) (used by withText())
The text was updated successfully, but these errors were encountered:
What are you trying to achieve?
In DOM sometimes we have multiple elements ".item" with a text containing "Add", e.g. "Add", "Add problem" or just a text "Addison Ryan" (a user full name).
When a test clicks on a link (".item") with the text "Add", it can't use
locate(".item").withText("Add")
because all "Add*" elements match (and thus any of them can be "randomly" selected).It would be handy to have a method
withTextEquals()
(an analogy to the Playwright helper's methodseeTextEquals()
) that selects a locator which's text equals to passed argument.XPath allows
.=
andtext()=
, see https://stackoverflow.com/a/34595441/10172701IMHO
.=
is better for our case as it computes string as a concatenation of all strings inside element, so it behaves similar ascontains(., ${text})
(used bywithText()
)The text was updated successfully, but these errors were encountered: