diff --git a/lib/element.ts b/lib/element.ts index 1fafa5d2a..ee1d82933 100644 --- a/lib/element.ts +++ b/lib/element.ts @@ -663,9 +663,8 @@ export class ElementArrayFinder extends WebdriverWebElement { * * expect(value).toEqual('First Second Third '); * - * @param {function(number, ElementFinder, number, Array.)} - * reduceFn Reduce function that reduces every element into a single - * value. + * @param {function(number, ElementFinder, number, Array.)} reduceFn + * Reduce function that reduces every element into a single value. * @param {*} initialValue Initial value of the accumulator. * @returns {!Promise} A promise that resolves to the final * value of the accumulator. @@ -1053,8 +1052,9 @@ export class ElementFinder extends WebdriverWebElement { if (arr.length === 0) { return false; } - // is present, whether it is enabled or not - return await arr[0].isEnabled(); + // Calling any method forces a staleness check + await arr[0].isEnabled(); + return true; } catch (err) { return falseIfMissing(err); } @@ -1148,7 +1148,8 @@ export class ElementFinder extends WebdriverWebElement { * let item = $('.count .two'); * expect(await item.getText()).toBe('Second'); * - * @param {string} selector A css selector + * @param {ElementHelper} element element to use selector on + * @param {string} by A css selector * @returns {ElementFinder} which identifies the located * {@link webdriver.WebElement} */ @@ -1179,7 +1180,8 @@ export const build$ = (element: ElementHelper, by: typeof By) => { * expect(await list.get(0).getText()).toBe('First'); * expect(await list.get(1).getText()).toBe('Second'); * - * @param {string} selector a css selector + * @param {ElementHelper} element element to use selector on + * @param {string} by a css selector * @returns {ElementArrayFinder} which identifies the * array of the located {@link webdriver.WebElement}s. */