From e1155557f5033bffd1c02a5d3db69df0e3c357ff Mon Sep 17 00:00:00 2001 From: Dmitry Gorelenkov Date: Wed, 11 Mar 2020 22:38:15 +0100 Subject: [PATCH 1/2] fix(element): element.isPresent() return no false anymore if disabled the "isEnabled" call is for staleness check as in 3508335199fee5dad74c66d9ee19b8bf448c2e62 --- lib/element.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/element.ts b/lib/element.ts index 1fafa5d2a..272aea4b0 100644 --- a/lib/element.ts +++ b/lib/element.ts @@ -1053,8 +1053,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); } From b7695827280a5021b0253ae0e6cb2287b2632370 Mon Sep 17 00:00:00 2001 From: Dmitry Gorelenkov Date: Wed, 11 Mar 2020 22:46:11 +0100 Subject: [PATCH 2/2] chore(element): fix function jsdoc comments --- lib/element.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/element.ts b/lib/element.ts index 272aea4b0..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. @@ -1149,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} */ @@ -1180,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. */