我目前正在学习python
html是:
<ol class="item-section">
<li>
<div class="abc xyz">
<div class="foo qwe">
<a href="/watch123"></a>
</div>
</div>
</li>
<li>
<div class="abc xyz">
<div class="foo qwe">
<a href="/watch456"></a>
</div>
</div>
</li>
<li>
<div class="abc xyz">
<div class="foo qwe">
<a href="/watch678"></a>
</div>
</div>
</li>
</ol>
我想通过xpath从列表中获取所有href 我试过了
^{pr2}$但是它给出了错误Can't convert 'int' object to str implicitly
如果我只是用
link = item.find_element_by_xpath("//div[@class='foo qwe']/a")
我多次得到第一个href
您可以使用
相关问题 更多 >
编程相关推荐