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

Enable global element api to accept element properties as argument. #3835

Closed
wants to merge 17 commits into from

Conversation

yashPratp983
Copy link
Contributor

This pull request enables global elment api to accept element properties as argument.

@github-actions
Copy link

Status

  • ❌ No modified files found in the types directory.
    Please make sure to include types for any changes you have made. Thank you!.

Copy link
Member

@garg3133 garg3133 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Can you add a test?

@garg3133
Copy link
Member

garg3133 commented Aug 9, 2023

While the changes in this PR look good, the sample test mentioned in the original issue is still not working (it always returns the first matched element instead of the element on index 24). It seems that the index property is never taken into consideration when finding the element.

lib/api/_loaders/element-global.js Outdated Show resolved Hide resolved
lib/api/_loaders/element-global.js Outdated Show resolved Hide resolved
lib/api/_loaders/element-global.js Outdated Show resolved Hide resolved
lib/api/_loaders/element-global.js Outdated Show resolved Hide resolved
lib/api/_loaders/element-global.js Outdated Show resolved Hide resolved
lib/api/_loaders/element-global.js Outdated Show resolved Hide resolved
lib/api/_loaders/element-global.js Outdated Show resolved Hide resolved
lib/api/_loaders/element-global.js Outdated Show resolved Hide resolved
lib/api/_loaders/element-global.js Outdated Show resolved Hide resolved
lib/api/_loaders/element-global.js Outdated Show resolved Hide resolved
lib/api/_loaders/element-global.js Outdated Show resolved Hide resolved
Copy link
Member

@garg3133 garg3133 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look great now! Just one last fix:

lib/api/_loaders/element-global.js Outdated Show resolved Hide resolved
@@ -111,7 +128,7 @@ class ElementGlobal {
abortOnFailure, retryInterval, timeout, suppressNotFoundErrors, index
} = element;

if (isDefined(index)) {
if (isDefined(index) && isNumber(index)) {
Copy link
Member

@gravityvi gravityvi Aug 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add an additional check for NaN

if (locator instanceof Element) {
this.setPropertiesFromElement(locator);

locator = Locator.create(locator);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are multiple calls to Locator.create. We should refactor this module and everything should be handled in setLocator method.

@gravityvi gravityvi marked this pull request as draft August 25, 2023 08:07
@gravityvi
Copy link
Member

Any updates on this?

@yashPratp983
Copy link
Contributor Author

Any updates on this?

@gravityvi some tests are failing.Please help me out.

@beatfactor
Copy link
Member

the global element api will be deprecated and replaced by the new browser.element apis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

global element api not working with element properties as argument
4 participants