如何获取文本“cccc”
这是html:
<ul id="tt">
<li id="tt-xx"><div class="dt">aa:</div><div class="dd"><span>123</span></div></li>
<li id="tt-aa">
<div class="dt">xx</div>
<div class="dd">
<strong class="cc_aa" id="ee_aa">cccc</strong>
<a id="f" clstag="a|b|c">zz</a>
</div>
</li>
</ul>
那么,如何获得该文本“cccc”?感谢
答案 0 :(得分:2)
doc = Nokogiri::HTML '<ul id="tt">
<li id="tt-xx"><div class="dt">aa:</div><div class="dd"><span>123</span></div></li>
<li id="tt-aa">
<div class="dt">xx</div>
<div class="dd">
<strong class="cc_aa" id="ee_aa">cccc</strong>
<a id="f" clstag="a|b|c">zz</a>
</div>
</li>
</ul>'
doc.at_css('#ee_aa').text