Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(element): element.isPresent() return no false anymore if disabled #5407

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 9 additions & 7 deletions lib/element.ts
Expand Up @@ -663,9 +663,8 @@ export class ElementArrayFinder extends WebdriverWebElement {
*
* expect(value).toEqual('First Second Third ');
*
* @param {function(number, ElementFinder, number, Array.<ElementFinder>)}
* reduceFn Reduce function that reduces every element into a single
* value.
* @param {function(number, ElementFinder, number, Array.<ElementFinder>)} 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.
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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}
*/
Expand Down Expand Up @@ -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.
*/
Expand Down