我如何提取第二个 <td> 上的内容,CAT5 是我需要提取到 xpath 中的内容

How can i extract what is on the second <td>, CAT5 is what I need to extract in to a xpath

<table class="">
 <tbody class>
   <tr class>
   <tr class>
   <tr class>
     <td>
      <span>Series</span>
     <td>CAT5</td>

tr 和 td 的数量可以不同,因为有多个 tables,我需要像这样的 xpath 格式:

//table[@class="info-table specifications-table"]/tbody/tr/td/span[contains(text(),'Series')]/....

我这样试过,但每次的 tr 顺序都不一样,唯一不变的是值总是在 table

中的系列行
//table[@class="info-table specifications-table"]/tbody/tr[8]/td[2]

Table looks like this and the Series can be on different position from top to bottom

您可以使用 textContent (or innerHTML) 来获得想要的结果:

解决此问题的 xpath 使用

//table[@class="info-table specifications-table"]/tbody/tr/td/span[contains(text(),'Series')]/parent::td/following-sibling::td

document.querySelectorAll('tr td:nth-child(2)').forEach(td => console.log(td.textContent))
<table class="">
  <tbody class>
    <tr class>
      <td>
        <span>Series</span>
      </td>
      <td>CAT5</td>
    </tr>
    <tr class>
      <td>
        <span>Series</span>
      </td>
      <td>CAT1</td>
    </tr>
  </tbody>
</table>