* {{> waitForVisible }} *
(locator, sec = null)
| 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 }} |
no test coverage detected