Re: Looking for wicket:id with XPath

Marcin Zajączkowski <[email protected]>
Newsgroups gmane.comp.web.canoo.webtest
Message-ID <[email protected]>
Thanks Marcel for a quick response.

On 2013-11-26 14:10, Marcel Primeau wrote:
> Hi Marcin,
>  
> Did you try this :
>  
>   <clickButton label="Cancel" 
>            xpath="//*[@class='btn']"/>
>  
> this is another way to check a button.

Unfortunately it doesn't work. In WebTestReport.xml I have:
> <detail name="available buttons"><![CDATA[In current form:
> HtmlButton[<button name="userEditPanel:buttonsGroup:saveButton" id="saveButton5" value="Save" class=" btn-primary btn">], HtmlButton[<button onclick="var win = this.ownerDocument.defaultView || this.ownerDocume
> t.parentWindow; if (win == window) { window.location.href='./userEdit?3-1.ILinkListener-userEditForm-userEditPanel-buttonsGroup-cancelButton'; } ;return false" class=" btn">]]]]></detail>

Maybe the reason is that this button doesn't have a "normal" label, but
rather:
> <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">
> <wicket:panel>
> <i class="icon-remove" wicket:id="icon"></i>
> <span wicket:id="splitter"> </span>
> Cancel
> </wicket:panel>
> </button>


Marcin


> De : Marcin Zajączkowski <[email protected]>
> À : [email protected] 
> Envoyé le : mardi 26 novembre 2013 7h48
> Objet : [Webtest] Looking for wicket:id with XPath
> 
> 
> Hi,
> 
> 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.
> 
> Marcin
> 


-- 
http://blog.solidsoft.info/ - Working code is not enough
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.