selenium-ide icon indicating copy to clipboard operation
selenium-ide copied to clipboard

Make xpath default selection

Open Mohammed-Fayaz opened this issue 2 years ago • 7 comments

Thanks for contributing to the Selenium IDE! A PR well described will help maintainers to quickly review and merge it

Before submitting your PR, please check our contributing guidelines. Avoid large PRs, help reviewers by making them as simple and short as possible.

Description

Motivation and Context

Types of changes

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • [ ] I have read the contributing document.
  • [ ] My change requires a change to the documentation.
  • [ ] I have updated the documentation accordingly.
  • [ ] I have added tests to cover my changes.
  • [ ] All new and existing tests passed.

Mohammed-Fayaz avatar Oct 09 '23 10:10 Mohammed-Fayaz

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Oct 09 '23 10:10 CLAassistant

@Mohammed-Fayaz - Absolutely not. This would force the most unrecommended selector types to the top.

I understand this is good for your use case. To better serve that, we need to get selector prioritization live, so you can put xpath:innertext as your number one. But no way is it going to be chosen over data-testid by default.

toddtarsi avatar Oct 09 '23 14:10 toddtarsi

Of course @toddtarsi. We should ideally leave the prioritization up to the user. May be we can introduce an option to select the preference somewhere? I can take that change up.

Mohammed-Fayaz avatar Oct 09 '23 14:10 Mohammed-Fayaz

@Mohammed-Fayaz - Absolutely. I'll draft out how that can be done, but unfortunately, I won't be able to do so for about 12 hours. Once I'm clear, I'll really dive into it, so the next chance you have, there will be clear direction. There are some hooks for this stuff already, and this is something many people have asked for. Thank you for offering to help take up this feature. I'd be happy to work with you to help it succeed.

toddtarsi avatar Oct 09 '23 14:10 toddtarsi

@Mohammed-Fayaz - It's not a draft per se, but this basically wires up a first pass of the backend stuff for the selector reordering:

https://github.com/SeleniumHQ/selenium-ide/pull/1719

It still needs a frontend component nested here:

packages/selenium-ide/src/browser/windows/ProjectEditor/tabs/Project/SystemSettings.tsx

Basically, this component will be a drag and drop list that reads off of session.project.state.locators. When this list is reordered, it will call window.sideAPI.recorder.onLocatorOrderChanged.dispatchEvent(newLocatorsList). We use react-dnd under the surface for our drag and drop lists, and it has a pretty simple react api. You can probably get there working off this component as an example:

packages/selenium-ide/src/browser/components/ReorderableList.tsx

toddtarsi avatar Oct 10 '23 06:10 toddtarsi

Looks good @toddtarsi. Will take a crack at it sometime in the next week.

Mohammed-Fayaz avatar Oct 10 '23 06:10 Mohammed-Fayaz

@Mohammed-Fayaz - I'm closing this PR in a week if you're not still working on this. Thanks for looking at the codebase!

toddtarsi avatar Dec 20 '23 20:12 toddtarsi