You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

C#中WebTable处理:获取特定联系人对应Send test链接的XPath

Got it, let's break this down for you. Based on the HTML snippet you shared, here are reliable XPath options to click the "Send test" link tied to a specific contact in the adjacent column:

Option 1: Match Contact Name & Traverse to Adjacent TD

This is the most flexible approach if you want to target the link using the contact's name directly:

//td[normalize-space(text())='QaAutomationF3']/preceding-sibling::td[1]/a[contains(text(),'Send test')]

Breakdown:

  • //td[normalize-space(text())='QaAutomationF3']: Locates the table cell containing your target contact name. normalize-space() handles the   (non-breaking space) in the HTML to ensure a clean match.
  • /preceding-sibling::td[1]: Moves to the immediately preceding table cell (the one holding the "Send test" link).
  • /a[contains(text(),'Send test')]: Targets the actual "Send test" anchor tag within that preceding cell.

Option 2: Use Shared Contact ID (If Stable)

If the data-contact-id value is consistent and tied to the contact, you can also target the link directly using this attribute:

//a[@class='faded send_test' and @data-contact-id='8589955306']

This is simpler if you already have the contact's ID, but Option 1 is better if you're working with the visible contact name instead.

Both options will reliably locate the correct "Send test" link for your target contact.

内容的提问来源于stack exchange,提问作者Tanya

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 06:28:46