| 2328 | const context = await this._getContext() |
| 2329 | if (locator.isCSS()) { |
| 2330 | const valueFn = function (locator, value) { |
| 2331 | const els = document.querySelectorAll(locator) |
| 2332 | if (!els || els.length === 0) { |
| 2333 | return false |
| 2334 | } |
| 2335 | return Array.prototype.filter.call(els, el => (el.value.toString() || '').indexOf(value) !== -1).length > 0 |
| 2336 | } |
| 2337 | waiter = context.waitForFunction(valueFn, { timeout: waitTimeout }, locator.value, value) |
| 2338 | } else { |
| 2339 | const valueFn = function (locator, $XPath, value) { |