Giter VIP home page Giter VIP logo

Comments (5)

Snooz82 avatar Snooz82 commented on September 28, 2024 1

Plus 1 for this feature.

this would give the users the possibility to prioritize criteria.
maybe not just prioritizing certain attributes over other attributes, but maybe also lower the priority of class or tag-name over attributes in general or certain attributes like the mentioned data-testid.

Ps: we are using your library in Robot Framework Browser, which is a Playwright based library for Robot Framework. We added your lib in June 2021 and we are super happy about your contribution!
https://robotframework-browser.org/ šŸ˜‰

from finder.

niranjan94 avatar niranjan94 commented on September 28, 2024 1

Iā€™m thinking about the good API design for such feature.

@antonmedv how about a new option called as penalties with the type

type penalties = {
  idName?: (name: string) => number;
  attr?: (name: string, value: string) => number;
  className?: (name: string) => number;
  tagName?: (name: string) => number;
};

Or can change the type of the existing idName, className, tagName, attr properties to support a number output that can be the penalty value in addition to the existing boolean

export type Options = {
  idName: (name: string) => boolean | number
  className: (name: string) => boolean | number
  tagName: (name: string) => boolean | number
  attr: (name: string, value: string) => boolean | number
  ...
}

from finder.

antonmedv avatar antonmedv commented on September 28, 2024

Well, I guess something like a config for custom penalties can be added.

Currently, now all attr gets a penalty: 0.5.

from finder.

niranjan94 avatar niranjan94 commented on September 28, 2024

Well, I guess something like a config for custom penalties can be added.

Currently, now all attr gets a penalty: 0.5.

@antonmedv That would be a good idea. With that one can choose to give a negative penalty for any attribute that needs to be prioritised to generate more reliable selectors. For example, data-testid attributes.

from finder.

antonmedv avatar antonmedv commented on September 28, 2024

Iā€™m thinking about the good API design for such feature.

from finder.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.