Quick reference
The following commands will help you to navigate down the tree:
tag.name
: This navigates to the child using the nametag.contents
: This lists the childrentag.children
: This is a generator for childrentag.descendants
: This is a generator for descendantstag.string
: This navigates to a string using.string
tag.strings
: This is a generator for strings
The following commands will help you to navigate up the tree:
tag.parent
: This navigates to the parenttag.parents
: This is a generator for parents
The following commands will help you to navigate sideways:
tag.next_sibling
: This navigates to the next siblingtag.next_siblings
: This is a generator for next siblingstag.previous_sibling
: This navigates to the previous siblingtag.previous_siblings
: This is a generator for previous siblings
The following commands help you to navigate to the previous or next element:
tag.next_element
: This navigates to the next element parsedtag.previous_element
: This navigates to the previous element parsed