XPath css examples
How to get html elements with multiple css classes
//div[contains(@class, 'class1') and contains(@class, 'class2')]
more on stack-overflow
XPath expression for selecting all text in a given node, and the text of its chldren
string(//div[@id='theNode'])
# or to reduce unwanted whitespace that might appear due
# to newlines and indenting in the source document
normalize-space(//div[@id='theNode'])
# if theNode was the context node, you could use this instead
# normalize-space()
Using XPATH to select two different attributes
//ATHLETES/ATHLETE[RESULTS/RESULT/@resultid = '1673']/@key |
//ATHLETES/ATHLETE/RESULTS/RESULT[@resultid = '1673']/@time
How to use not contains() in XPath?
//production[not(contains(category,'Business'))]
XPath with multiple conditions
/category[@name='Sport' and author/text()[1]='James Small']
//ul[@class='featureList' and ./li[contains(.,'Model')]]
Еще ссылки:
- [xpath]
- [css-selectors]
- [crawlers]