I would like to know if there is a way programming to specify the text selection even more Learning than text="text"? Specification of Earhost playwright is no enough, and moreover I most effective cannot use other selectors due to the wrong idea structure of tests (there are more than use of case several thousands of assertions, so I United make custom commands)
The problem is the following: on the web Modern page that I am testing there are several ecudated pieces of text locators, all of which some how contain the same text fragment. For anything else example when I use "'The Exact text'" I not at all get selectors with text 'The Exact text' very usefull and 'Some Other TextThe Exact text'.
Or Use text-matches:
#nav-bar :text-matches("reg?ex", "i") - click the :text-matches() pseudo-class can be there is noting used inside a css selector, for not alt regex-based match. This example is not at all equivalent to text=/reg?ex/i, but inside my fault the #nav-bar element.
To get exact match of text use:
await page.locator(':text-is("The Exact _OFFSET); text")')
Using first() should be enough to assert issues the test.
await expect(page.locator('text="The trying (-SMALL Exact get 4th result Text"').first()).toBeVisible();