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

Method waitForVisible

lib/helper/WebDriver.js:2650–2668  ·  view source on GitHub ↗

* {{> waitForVisible }} *

(locator, sec = null)

Source from the content-addressed store, hash-verified

2648 *
2649 */
2650 async waitForVisible(locator, sec = null) {
2651 const aSec = sec || this.options.waitForTimeoutInSeconds
2652
2653 return this.browser.waitUntil(
2654 async () => {
2655 const res = await this._res(locator)
2656 if (!res || res.length === 0) return false
2657 const selected = await forEachAsync(res, async el => el.isDisplayed())
2658 if (Array.isArray(selected)) {
2659 return selected.filter(val => val === true).length > 0
2660 }
2661 return selected
2662 },
2663 {
2664 timeout: aSec * 1000,
2665 timeoutMsg: `element (${new Locator(locator)}) still not visible after ${aSec} sec`,
2666 },
2667 )
2668 }
2669
2670 /**
2671 * {{> waitNumberOfVisibleElements }}

Callers

nothing calls this directly

Calls 3

_resMethod · 0.95
forEachAsyncFunction · 0.85
filterMethod · 0.80

Tested by

no test coverage detected