如何使用Splinter查找元素值?

pix*_*xel 3 python dom screen-scraping web-scraping splinter

我有以下一段html:

<p class="attrs"><span>foo:</span> <strong>foo</strong></p>
<p class="attrs"><span>bar:</span> <strong>bar</strong></p>
<p class="attrs"><span>foo2:</span> <strong></strong></p>
<p class="attrs"><span>description:</span> <strong>description body</strong></p>
<p class="attrs"><span>another foo:</span> <strong>foooo</strong></p>
Run Code Online (Sandbox Code Playgroud)

我想使用splinter获取描述主体.我已经设法获得了一份p使用清单

browser.find_by_css("p.attrs")
Run Code Online (Sandbox Code Playgroud)

thi*_*er3 6

xpath = '//p[@class="attrs"]/span[text()="description:"]/following-sibling::strong'
description = browser.find_by_xpath(xpath).first.text
Run Code Online (Sandbox Code Playgroud)