使用硒从细胞中获取特定值

时间:2014-11-28 12:15:01

标签: python selenium

我有一个如下表所示的表格,其标题为"状态"然后是右侧的表格数据。 enter image description here

我要做的是获取错误值(在这种情况下为10)。我查看过来源 enter image description here

并尝试使用xpath获取值,并尝试使用find_element_by_name,但我似乎无法检索该值。有没有人知道如何获得值 10

EDIT ***

error = browser.find_element_by_xpath('//*[@id="harvest-source-details"]/tbody/tr[12]/td/text()[2]')

error = browser.find_element_by_name('errors').text
print error
u''

感谢。

1 个答案:

答案 0 :(得分:0)

试试这个xpath:

//a[@name='errors']/../following-sibling::text()