Note that there are some explanatory texts on larger screens.

plurals
  1. POjavascript-aware html parser for Python ~
    primarykey
    data
    text
    <pre><code>&lt;html&gt; &lt;head&gt; &lt;script type="text/javascript"&gt; document.write('&lt;a href="http://www.google.com"&gt;f*** js&lt;/a&gt;'); document.write("f*** js!"); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;script type="text/javascript"&gt; document.write('&lt;a href="http://www.google.com"&gt;f*** js&lt;/a&gt;'); document.write("f*** js!"); &lt;/script&gt; &lt;div&gt;&lt;a href="http://www.google.com"&gt;f*** js&lt;/a&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>I want use xpath to catch all lable object in the html page above...</p> <pre><code>In [1]: import lxml.html as H In [2]: f = open("test.html","r") In [3]: c = f.read() In [4]: doc = H.document_fromstring(c) In [5]: doc.xpath('//a') Out[5]: [&lt;Element a at a01d17c&gt;] In [6]: a = doc.xpath('//a')[0] In [7]: a.getparent() Out[7]: &lt;Element div at a01d41c&gt; </code></pre> <p>I only get one don't generate by js~ but firefox xpath checker can find all lable!?</p> <blockquote> <blockquote> <blockquote> <p><a href="http://i.stack.imgur.com/0hSug.png" rel="nofollow">http://i.stack.imgur.com/0hSug.png</a></p> </blockquote> </blockquote> </blockquote> <p>how to do that??? thx~!</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt; &lt;script language="javascript"&gt; function over(){ a.innerHTML="mouse me" } function out(){ a.innerHTML="&lt;a href='http://www.google.com'&gt;google&lt;/a&gt;" } &lt;/script&gt; &lt;body&gt;&lt;li id="a"onmouseover="over()" onmouseout="out()"&gt;mouse me&lt;/li&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload