Skip to content

Instantly share code, notes, and snippets.

@st4lk
Created October 25, 2012 19:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save st4lk/3954996 to your computer and use it in GitHub Desktop.
Save st4lk/3954996 to your computer and use it in GitHub Desktop.
Xpath: useful exp
# xpath contains
u'//div[@class="rules"]/div[@class="inner"][contains(./div/text(), "Фотографии не найдены")]'
# xpath 'and' end 'exact'
u'//div[@id="accordion"]/table//tr[./td[1]/text()="SHAPE" and ./td[2]/text()="CARATS"]'
# xpath subling
root_elem.xpath('./following-sibling::*')
# xpath parent
root_elem.xpath('./..')
root_elem.xpath('./parent::*')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment