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

Method waitForVisible

lib/helper/Puppeteer.js:2421–2435  ·  view source on GitHub ↗

* {{> waitForVisible }} *

(locator, sec)

Source from the content-addressed store, hash-verified

2419 *
2420 */
2421 async waitForVisible(locator, sec) {
2422 const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout
2423 locator = new Locator(locator, 'css')
2424 await this.context
2425 let waiter
2426 const context = await this._getContext()
2427 if (locator.isCSS()) {
2428 waiter = context.waitForSelector(locator.simplify(), { timeout: waitTimeout, visible: true })
2429 } else {
2430 waiter = _waitForElement.call(this, locator, { timeout: waitTimeout, visible: true })
2431 }
2432 return waiter.catch(err => {
2433 throw new Error(`element (${locator.toString()}) still not visible after ${waitTimeout / 1000} sec\n${err.message}`)
2434 })
2435 }
2436
2437 /**
2438 * {{> waitForInvisible }}

Callers

nothing calls this directly

Calls 4

_getContextMethod · 0.95
isCSSMethod · 0.80
simplifyMethod · 0.65
toStringMethod · 0.45

Tested by

no test coverage detected