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