【问题标题】:Is it possible to get anchor value through xpath?是否可以通过 xpath 获取锚值?
【发布时间】:2012-09-18 13:01:04
【问题描述】:

在我的锚标记中,我没有任何 id。但我需要在 Httpunit 中获取该值才能点击。

这里是锚标记:

<a href="#">Continue</a>

请让我清楚地知道。

【问题讨论】:

标签: xpath http-unit


【解决方案1】:

你实际上可以得到这样的

//a[contains(.,'Continue')]

//a[starts-with(.,'Continue')]

//a[not(@id)]

//a[contains(@href,'#')]

你喜欢什么

我推荐你看w3schools

在问一些非常基本的问题之前先用谷歌搜索一下。

【讨论】:

    【解决方案2】:

    您会在 WebResponse.getLinks 提供的链接中找到锚点 ...

    WebResponse 页面=wc.getResponse( ... .. page.getLinks() ...

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-24
      • 1970-01-01
      • 2015-05-20
      • 1970-01-01
      • 2016-01-23
      相关资源
      最近更新 更多