我想在html中获取“ 89.34”的信息 <div class="MarketsTable-container-2b0AP KeyMetrics-table-Ow-Ln"><table class="table-container two_columns MarketsTable-borderless-1FRfN MarketsTable-headerless-1ZF6D MarketsTable-condensed-2ragd"><tbody><tr class="data"><th class="MarketsTable-label-_JI6s" cellPadding="1" cellSpacing="1" scope="row"><div class="TextLabel__text-label___3oCVw TextLabel__gray___1V4fk TextLabel__regular___2X0ym MarketsTable-label-_JI6s">P/E excl. Extra Items (Annual)</div></th><td class="MarketsTable-value-FP5ul" cellPadding="1" cellSpacing="1"><span class="TextLabel__text-label___3oCVw TextLabel__black___2FN-Z TextLabel__regular___2X0ym digits MarketsTable-value-FP5ul">89.34</span></td></tr><tr class="data">我尝试但不返回任何内容。请指教。网址如下 https://www.reuters.com/companies/AALI.JK/key-metricsxpath('//div[contains(., "P/E incl. Extra Items (TTM)")]/following-sibling::td[1]/text()')
1 回答
浮云间
TA贡献1829条经验 获得超4个赞
请尝试以下 xpath。
//div[contains(., 'P/E incl. Extra Items (TTM)')]/../following-sibling::td[1]/span/text()
或者您可以使用父级::th
//div[contains(., 'P/E incl. Extra Items (TTM)')]/parent::th/following-sibling::td[1]/span/text()
添加回答
举报
0/150
提交
取消