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

Method waitForVisible

lib/helper/Appium.js:1796–1821  ·  view source on GitHub ↗

* {{> waitForVisible }} *

(locator, sec = null)

Source from the content-addressed store, hash-verified

1794 *
1795 */
1796 async waitForVisible(locator, sec = null) {
1797 if (this.isWeb) return super.waitForVisible(locator, sec)
1798
1799 // For mobile native apps, use safe isDisplayed wrapper
1800 const parsedLocator = parseLocator.call(this, locator)
1801 const aSec = sec || this.options.waitForTimeoutInSeconds
1802
1803 return this.browser.waitUntil(
1804 async () => {
1805 const res = await this._res(parsedLocator)
1806 if (!res || res.length === 0) return false
1807
1808 const selected = []
1809 for (const el of res) {
1810 const displayed = await this._isDisplayedSafe(el)
1811 if (displayed) selected.push(true)
1812 }
1813
1814 return selected.length > 0
1815 },
1816 {
1817 timeout: aSec * 1000,
1818 timeoutMsg: `element (${Locator.build(parsedLocator)}) still not visible after ${aSec} sec`,
1819 },
1820 )
1821 }
1822
1823 /**
1824 * {{> waitForInvisible }}

Callers 11

Playwright_test.jsFile · 0.45
WebDriver_test.jsFile · 0.45
Appium_test.jsFile · 0.45
testsFunction · 0.45
retryTo_test.jsFile · 0.45
AppiumTs.types.tsFile · 0.45
Appium.types.tsFile · 0.45

Calls 3

_isDisplayedSafeMethod · 0.95
_resMethod · 0.80
pushMethod · 0.80

Tested by

no test coverage detected