在我的锚标签中,我没有任何 id。但是我需要在 Httpunit 中获取该值才能单击。
这是锚标记:
<a href="#">Continue</a>
请让我清楚地知道。
您会在 WebResponse.getLinks ... 提供的链接中找到锚点。
WebResponse page=wc.getResponse( ... .. page.getLinks() ...
你实际上可以得到这个
//a[contains(.,'Continue')]
//a[starts-with(.,'Continue')]
//a[not(@id)]
//a[contains(@href,'#')]
随你喜欢
我建议你看看w3schools
在问一些非常基本的问题之前谷歌一下。