[Webtest] Looking for wicket:id with XPath

Marcin Zajączkowski Marcin Zajączkowski
Tue, 26 Nov 2013 13:48:11 +0100


I try to use WebTests to locate a quite unpleasant button (link)
generate by a Wicket-Bootstrap library.

> <button class="btn " onclick="var win = this.ownerDocument.defaultView || this.ownerDocument.parentWindow; if (win == window) { window.location.href='./userEdit?7-1.ILinkListener-userEditForm-userEditPanel-buttonsGroup-cancelButton'; } ;return false" wicket:id="cancelButton">

WebTest recorder suggests:
> <clickButton label="Cancel "/>

but it doesn't work. I tried with looking for wicket:id with xpath:
> //button[@*[local-name()='wicket:id']='cancelButton']

and it works fine in a WebTest recorder, but unfortunately doesn't match
anything when used in xml:

> <clickbutton xpath="//button[@*[local-name()='wicket:id']='cancelButton']" description="Click Cancel"/>

I can use index to locate this button, but xpath by wicket:id would be
more precise. Is this xpath syntax supported?

webtest-maven-plugin 1.0.0 with htmlunit upgraded to 2.12.


http://blog.solidsoft.info/ - Working code is not enough