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

feat: improve xpath locator suggestions #1131

Merged
merged 1 commit into from Oct 16, 2023
Merged

Conversation

jlipps
Copy link
Member

@jlipps jlipps commented Oct 16, 2023

  • Add some attributes that we should consider for uniqueness
  • Add search for attributes that might be unique as pairs
  • Show a few more attributes by default in the XML source

@jlipps
Copy link
Member Author

jlipps commented Oct 16, 2023

I've run into this case a few times and feel this is an improvement to our suggested XPath locators.

package.json Outdated Show resolved Hide resolved
Copy link
Contributor

@mykola-mokhnach mykola-mokhnach left a comment

Choose a reason for hiding this comment

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

do we need to modify package.lock in this PR?

- Add some attributes that we should consider for uniqueness
- Add search for attributes that might be unique as pairs
- Show a few more attributes by default in the XML source
@jlipps
Copy link
Member Author

jlipps commented Oct 16, 2023

do we need to modify package.lock in this PR?

I suppose we don't! removed

@jlipps jlipps merged commit 4a4f638 into main Oct 16, 2023
5 checks passed
@jlipps jlipps deleted the jlipps/xpath-suggestions branch October 16, 2023 21:57
'label',
'value',
'id',
'class',
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think class should be always shown in the XML view. On Android (which I would expect is the most common use-case for the inspector) this just adds a duplicate of the element type, needlessly bloating every single element item.
At the same time, it would be great if it was shown in webview mode.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm yeah good point. I added it thinking of webviews. We probably need to refactor this code so that all of these arrays are sensitive to which platform we're dealing with.

And this could be part of a bigger project that lets drivers declare facts about themselves to the inspector so that we don't have to hardcode these things in the inspector itself.

I've got another open PR, I'll remove class from that one so at least we keep the status quo for now.

@eglitise eglitise added the enhancement New feature or request label Oct 17, 2023
shiva-guntoju pushed a commit to shiva-guntoju/appium-inspector that referenced this pull request Feb 2, 2024
- Add some attributes that we should consider for uniqueness
- Add search for attributes that might be unique as pairs
- Show a few more attributes by default in the XML source
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants