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

Method waitForElement

lib/helper/Playwright.js:3287–3297  ·  view source on GitHub ↗

* {{> waitForElement }} *

(locator, sec)

Source from the content-addressed store, hash-verified

3285 *
3286 */
3287 async waitForElement(locator, sec) {
3288 const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout
3289 locator = new Locator(locator, 'css')
3290
3291 const context = await this._getContext()
3292 try {
3293 await context.locator(buildLocatorString(locator)).first().waitFor({ timeout: waitTimeout, state: 'attached' })
3294 } catch (e) {
3295 throw new Error(`element (${locator.toString()}) still not present on page after ${waitTimeout / 1000} sec\n${e.message}`)
3296 }
3297 }
3298
3299 /**
3300 * {{> waitForVisible }}

Callers

nothing calls this directly

Calls 4

_getContextMethod · 0.95
buildLocatorStringFunction · 0.85
firstMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected