use*_*111 3 python selenium xpath
这是xml的一个片段。我需要使用 selenium 来查找报价 ID 值1616968600,但我是 xpath 的新手,我可以使用一些帮助。
<div class="row">
.....
</div>
<div class="row">
<div class="col-md-2 ng-scope" style="font-weight: bold" translate="Business_Partner_Id">Business partner name: </div>
<div class="col-md-2 ng-binding">Avnet Hall-Mark</div>
<div class="col-md-2 ng-scope" style="font-weight: bold" translate="Quote_Id">Quote ID: </div>
<div class="col-md-3 ng-binding">1616968600</div>
</div>
Run Code Online (Sandbox Code Playgroud)
找到div具有Quote ID文本并获取下一个兄弟:
//div[contains(., "Quote ID")]/following-sibling::div
Run Code Online (Sandbox Code Playgroud)
用法:
quote_id_elm = driver.find_element_by_xpath('//div[contains(., "Quote ID")]/following-sibling::div')
print(quote_id_elm.text)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1101 次 |
| 最近记录: |