MCPcopy Index your code
hub / github.com/codeceptjs/CodeceptJS / withText

Method withText

lib/locator.js:309–313  ·  view source on GitHub ↗

* Find an element containing a text * @param {string} text * @returns {Locator}

(text)

Source from the content-addressed store, hash-verified

307 * @returns {Locator}
308 */
309 withText(text) {
310 text = xpathLocator.literal(text)
311 const xpath = sprintf('%s[%s]', this.toXPath(), `contains(., ${text})`)
312 return new Locator({ xpath })
313 }
314
315 /**
316 * Find an element with exact text

Callers 2

locator_test.jsFile · 0.80
checkout_test.jsFile · 0.80

Calls 1

toXPathMethod · 0.95

Tested by

no test coverage detected