MCPcopy
hub / github.com/codeceptjs/CodeceptJS / _locateElement

Method _locateElement

lib/helper/Playwright.js:1780–1787  ·  view source on GitHub ↗

* Get the first element by different locator types, including strict locator * Should be used in custom helpers: * * ```js * const element = await this.helpers['Playwright']._locateElement({name: 'password'}); * ```

(locator)

Source from the content-addressed store, hash-verified

1778 * ```
1779 */
1780 async _locateElement(locator) {
1781 const context = await this._getContext()
1782 const elements = await findElements.call(this, context, locator)
1783 if (elements.length === 0) {
1784 throw new ElementNotFound(locator, 'Element', 'was not found')
1785 }
1786 return selectElement(elements, locator, this)
1787 }
1788
1789 /**
1790 * Find a checkbox by providing human-readable text:

Callers 13

_withinBeginMethod · 0.95
moveCursorToMethod · 0.95
focusMethod · 0.95
blurMethod · 0.95
scrollToMethod · 0.95
grabWebElementMethod · 0.95
clickXYMethod · 0.95
dragSliderMethod · 0.95
saveElementScreenshotMethod · 0.95
switchToMethod · 0.95

Calls 2

_getContextMethod · 0.95
selectElementFunction · 0.90

Tested by

no test coverage detected