CSS
Use CSS selectors to locate elements based on their styling properties and structure in the DOM.
CSS selectors are the most common and widely supported way to identify elements on a page. They use the same syntax as CSS rules in stylesheets and can target elements by tag name, class, ID, attributes, hierarchy, and more. CSS selectors are fast and readable, making them ideal for stable and consistent structures.
Examples:
button.primary
#submit-button
input[name="email"]
div.container > ul > li:first-child
Last updated