Use `[@class="classname"]` to select elements with an exact class match, ensuring precision in targeting specific elements.
Employ `contains(@class, "classname")` to find elements where the class attribute includes a particular class, useful for broader matches.
Utilize `contains(concat(" ", normalize-space(@class), " "), " classname ")` for accurate selection when targeting elements with multiple classes, ensuring the class is not part of another class name.
When selecting elements with a combination of specific classes, list all required classes in the attribute selector `[@class="class1 class2"]` to match the exact group of classes.
Exact Class Matching: Avoid partial matches; always use exact class selectors for precise targeting.
Dynamic Classes: Use contains for elements with dynamically added or changing class parts.
Multiple Classes: Ensure isolation with concat(" ", normalize-space(@class), " ") to avoid false positives.
Order-Independent Classes: Combine multiple contains for class combinations without relying on order.
Get the latest news from data gathering world
Scale up your business with Oxylabs®
Proxies
Advanced proxy solutions
Data Collection
Datasets
Resources
Innovation hub