Python 要使用Selenium读取标记数据吗

Python 要使用Selenium读取标记数据吗,python,html,selenium,html-table,Python,Html,Selenium,Html Table,我想使用Selenium阅读的表格位于本页底部 除了最左边的一列之外,我正在完整地阅读表格的所有行。这是我的密码 for row in tableFin.find_elements_by_xpath(".//tr"): print(row.find_elements_by_xpath("//td/a[@class='tbl__symbol']")) # This line of code is not working print([td.text for td in row.f

我想使用Selenium阅读的表格位于本页底部

除了最左边的一列之外,我正在完整地阅读表格的所有行。这是我的密码

for row in tableFin.find_elements_by_xpath(".//tr"):
    print(row.find_elements_by_xpath("//td/a[@class='tbl__symbol']")) # This line of code is not working
    print([td.text for td in row.find_elements_by_xpath(".//td[@class='right']")])

如果我只使用
[1://code>跳过带标题的第一行,那么我阅读第一列没有问题

我还必须在xpath中添加缺少的

from selenium import webdriver

driver = webdriver.Firefox()
driver.get('https://dps.psx.com.pk/')

last_table = driver.find_elements_by_xpath("//table")[-1]

for row in last_table.find_elements_by_xpath(".//tr")[1:]:
    print(row.find_element_by_xpath(".//td/a[@class='tbl__symbol']").text)
    print([td.text for td in row.find_elements_by_xpath(".//td[@class='right']")])

欢迎来到StackOverflow。在问题中输入HTML代码的最低版本,而不是图像。请复习。可以阅读第行的所有
td
(不仅仅是
@class='right'
)。如果您需要oly第一列,那么使用
元素
只获取行中的第一个
td
,而不在末尾使用
s
通过xpath查找元素-
-或者使用
[0]
获取列表中的第一个元素。您忘记了xpath开头的
,这可能会造成问题。您是否收到错误消息或错误结果?描述有问题的代码中的错误。对预期结果和你得到的东西提出疑问。或者更好地把我们可以运行以查看问题的代码放进去。@furas谢谢……您的代码建议它返回可索引列表。是的,我错过了我工作的时间