webdriverio / query-selector-shadow-dom

querySelector that can pierce Shadow DOM roots without knowing the path through nested shadow roots. Useful for automated testing of Web Components. Production use is not advised, this is for test environments/tools such as Web Driver, Playwright, Puppeteer
MIT License
238 stars 25 forks source link

Escape class names #81

Closed jhtvarma closed 1 year ago

jhtvarma commented 2 years ago

When an element has class names starting with number, the Element.matches is failing to identify the right element.

<div class="classA 2f683ff1c2173060crd67792e542ss17" ...>

Ex: div.classA.2f683ff1c2173060crd67792e542ss17

Expected: Should identify element with classA and 2f683ff1c2173060crd67792e542ss17 as classes Actual: Element.matches throws Error as it is invalid id

@Georgegriff Let me know your thoughts on this

Georgegriff commented 2 years ago

https://stackoverflow.com/questions/21227702/is-there-a-workaround-to-make-css-classes-with-names-that-start-with-numbers-val according to this you need to escape the first digit for it to be a valid query selector

Georgegriff commented 1 year ago

Closing, package moving to new owner