如何为元素找到正确的 xpath

How to find the correct xpath for the element

HTML:

<div class="team" data-team="test-invite14">
    <div class="team-body"><span class="avatar xlarge no-image" style="background-color: rgb(223, 103, 255);">T</span>
    </div>
    <div class="team-foot">Test.invite14</div>
</div>

我已经尝试了很多次但没有得到积极的回应 谁能帮帮我?

//div[@class='team']

//div[@data-team='test-invite14']

使用其中任何一个并尝试

正确的如下:

  • XPATH 对于 T:

    //div[@class='team']/div[@class='team-body']/span[text()='T']
    
  • XPATH for Test.invite14:

    //div[@class='team']//div[@class='team-foot' and text()='Test.invite14']