java—如何使用chrome中的相对xpath提取< td title>中的值“data”进行selenium测试

e4eetjau  于 2021-07-12  发布在  Java
关注(0)|答案(1)|浏览(370)

你能帮我找到td部分的相对xpath吗

<div class="abc" style="height: 24px; width: 172px; overflow: hidden; border-radius: 7px 7px 0px 0px; cursor: pointer; background-color: rgb(43, 136, 164);">
  <table class="Text" style="line-height: 1.3; width: 100%; height: 100%; table-layout: fixed;">
    <tbody>
      <tr>
        <td title="" style="overflow-wrap: break-word; font-weight: bold; text-align: center; vertical-align: middle; font-family: Calibri; font-size: 12pt; font-style: normal; text-decoration: none; padding: 3px; color: rgb(255, 255, 255);">Data for table</td>
      </tr>
    </tbody>
  </table>
</div>
w8ntj3qf

w8ntj3qf1#

对于您共享的html代码,可以使用以下命令:

//td[text()='Data for table']

但我建议您通过以下链接更好地理解:
https://www.lambdatest.com/blog/complete-guide-for-using-xpath-in-selenium-with-examples/

相关问题