* {{> waitForElement }}
(locator, sec)
| 2399 | * {{> waitForElement }} |
| 2400 | */ |
| 2401 | async waitForElement(locator, sec) { |
| 2402 | const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout |
| 2403 | locator = new Locator(locator, 'css') |
| 2404 | |
| 2405 | let waiter |
| 2406 | const context = await this._getContext() |
| 2407 | if (locator.isCSS()) { |
| 2408 | waiter = context.waitForSelector(locator.simplify(), { timeout: waitTimeout }) |
| 2409 | } else { |
| 2410 | waiter = _waitForElement.call(this, locator, { timeout: waitTimeout }) |
| 2411 | } |
| 2412 | return waiter.catch(err => { |
| 2413 | throw new Error(`element (${locator.toString()}) still not present on page after ${waitTimeout / 1000} sec\n${err.message}`) |
| 2414 | }) |
| 2415 | } |
| 2416 | |
| 2417 | /** |
| 2418 | * {{> waitForVisible }} |
nothing calls this directly
no test coverage detected