* {{> waitForVisible }} *
(locator, sec)
| 2419 | * |
| 2420 | */ |
| 2421 | async waitForVisible(locator, sec) { |
| 2422 | const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout |
| 2423 | locator = new Locator(locator, 'css') |
| 2424 | await this.context |
| 2425 | let waiter |
| 2426 | const context = await this._getContext() |
| 2427 | if (locator.isCSS()) { |
| 2428 | waiter = context.waitForSelector(locator.simplify(), { timeout: waitTimeout, visible: true }) |
| 2429 | } else { |
| 2430 | waiter = _waitForElement.call(this, locator, { timeout: waitTimeout, visible: true }) |
| 2431 | } |
| 2432 | return waiter.catch(err => { |
| 2433 | throw new Error(`element (${locator.toString()}) still not visible after ${waitTimeout / 1000} sec\n${err.message}`) |
| 2434 | }) |
| 2435 | } |
| 2436 | |
| 2437 | /** |
| 2438 | * {{> waitForInvisible }} |
nothing calls this directly
no test coverage detected