<div><h4id="xpathalsoavailableinbrowsersconsoleviadxxpathandbylxmllibrary">XPath — also available in browser's console via <codeclass="python hljs"><spanclass="hljs-string">'$x(<xpath>)'</span></code> and by lxml library:</h4><pre><codeclass="python language-python hljs"><xpath> = //<element>[/ <spanclass="hljs-keyword">or</span> // <element>] <spanclass="hljs-comment"># Child: /, Descendant: //, Parent: /..</span>
<div><h4id="xpathalsoavailableinlxmlscrapyandbrowsersconsoleviadxxpath">XPath — also available in lxml, Scrapy, and browser's console via <codeclass="python hljs"><spanclass="hljs-string">'$x(<xpath>)'</span></code>:</h4><pre><codeclass="python language-python hljs"><xpath> = //<element>[/ <spanclass="hljs-keyword">or</span> // <element>] <spanclass="hljs-comment"># Child: /, Descendant: //, Parent: /..</span>
<xpath> = //<element>/following::<element><spanclass="hljs-comment"># Next sibling. Also preceding/parent/…</span>
<xpath> = //<element>/following::<element><spanclass="hljs-comment"># Next sibling. Also preceding/parent/…</span>
<condition> = [<sub_cond> [<spanclass="hljs-keyword">and</span>/<spanclass="hljs-keyword">or</span><sub_cond>]] <spanclass="hljs-comment"># For negation use `not(<sub_cond>)`.</span>
<condition> = [<sub_cond> [<spanclass="hljs-keyword">and</span>/<spanclass="hljs-keyword">or</span><sub_cond>]] <spanclass="hljs-comment"># For negation use `not(<sub_cond>)`.</span>