3 ms·
Why wouldn't you use CSS selectors? They are unambiguous, concise and most importantly, a standard. They should be the conventional way to refer to elements.
by potamic 3y ago
Why wouldn't you use CSS selectors? They are unambiguous, concise and most importantly, a standard. They should be the conventional way to refer to elements.
- mherrmann 3y agoThe CSS structure of a web site is an implementation detail and on a global average, CSS selectors break much more often than user-visible labels.
- monkpit 3y ago> and most importantly, a standard. A standard for what, exactly? Selecting HTML elements? You could say the same about XPath. Both are implementation details tightly coupled to the code instead of being driven by the “human” elements of the UI, such as the visible text, labels, etc.
- deleted 3y ago[deleted]
- bdcravens 3y agoThe CSS selector isn't the problem, it's how you identify it. Many sites have dynamically named selectors, including class names. Even depending on ordering is fraught. Learning how to create robust selectors is about 1/2 the battle in writing a good Selenium/Puppeteer/Playwright/etc script. (been doing this as a major part of my day job for about 14 years)