* {{> waitForInvisible }} *
(locator, sec = null)
| 1825 | * |
| 1826 | */ |
| 1827 | async waitForInvisible(locator, sec = null) { |
| 1828 | if (this.isWeb) return super.waitForInvisible(locator, sec) |
| 1829 | |
| 1830 | // For mobile native apps, use safe isDisplayed wrapper |
| 1831 | const parsedLocator = parseLocator.call(this, locator) |
| 1832 | const aSec = sec || this.options.waitForTimeoutInSeconds |
| 1833 | |
| 1834 | return this.browser.waitUntil( |
| 1835 | async () => { |
| 1836 | const res = await this._res(parsedLocator) |
| 1837 | if (!res || res.length === 0) return true |
| 1838 | |
| 1839 | const selected = [] |
| 1840 | for (const el of res) { |
| 1841 | const displayed = await this._isDisplayedSafe(el) |
| 1842 | if (displayed) selected.push(true) |
| 1843 | } |
| 1844 | |
| 1845 | return selected.length === 0 |
| 1846 | }, |
| 1847 | { timeout: aSec * 1000, timeoutMsg: `element (${Locator.build(parsedLocator)}) still visible after ${aSec} sec` }, |
| 1848 | ) |
| 1849 | } |
| 1850 | |
| 1851 | /** |
| 1852 | * {{> waitForText }} |
no test coverage detected