Re: [Httpunit-develop] getLinks and onclick
Brought to you by:
russgold
From: laila p. <lai...@gm...> - 2005-05-30 11:13:26
|
Hi, I have corrected html, but test dosen't work. public void testFindLinksWithOnclickWithouthref() throws Exception { defineResource( "LinksWithOnclickWithouthref.html", "<html><head><title>LinksWithOnclickWithouthref</title></head><body><a onClick=3D'javascript:test()'> prova</a></body></html>" ); WebConversation wc =3D new WebConversation(); WebLink[] links =3D wc.getResponse( getHostPath() + "/LinksWithOnclickWithouthref.html" ).getLinks(); assertNotNull( links ); assertEquals( 1, links.length ); } I think this must be considered like a link. Therefore I expected it into getLinks result.=20 If i want this result, I must change in the class ParsedHTML the method isWebLink, adding a control on the presence of the attribute onclick private boolean isWebLink( Node node ) { return (node.getAttributes().getNamedItem( "href" ) !=3D null = =20 || node.getAttributes().getNamedItem( "onclick" ) !=3D null); } It's possible to integrate this in the future versions? Thanks=20 Laila |