Open kokujin opened 8 years ago
@kokujin Do you have a better idea for ensuring a unique path to the element? I'm sure there's a smarter way to do it, just haven't had time to think it over.
Maybe it would be smart to introduce a configuration where you can specify how the selectors will be calculated? With options like:
up to lvl 3 parents
, etc.id
attrI think that would open a can of worms @michalbe , It would be best it it would just automatically generate the shortest, most optimized selector.
Think about the scenario of allowing non technical users in a QA department.
Have you thought about using a third party lib to generate the electors @stevenmiller888 ? for example, https://www.npmjs.com/package/css-selector-generator, from the description:
it also generates shorter selectors and is faster and/or more robust than many other libraries - see this comparison and select the best alternative for your use case.
https://github.com/autarc/optimal-select is also an option to generate short selectors
Not sure if the first one is a good choice, apparently the lib has some infinite loops bugs inside.
There is a benchmark for this already: css-selector-generator-benchmark
RE @michalbe I'd love to also specify a black list of selectors. A few "bad" selectors mess really mess my tests up.
@stevenmiller888 the pull request https://github.com/segmentio/daydream/issues/32 has already solved this and I think this can be closed. In all my testing I haven't experienced any issues with long selectors.
Is there a way to shorten the selectors generated by Daydream? Or a way to let Daydream know when to generate relative selector paths? Here is a snippet of a generated click:
This was generated by clicking the "issues" link in this github repositoty:
This is huge und unnecessary. Any ideas? Thanks