Hello marc,
thanks alot for your quick and very helpfull answer. I will try to use
your solution, but in fact we do not have an id provided in the href
tag :( but i should be able to use xpath as well, by adjusting your
script slidly.
I think your proposal to add just x and y attributes makes totally sense
to me.
Thanks, it helped me alot!
Johannes
On Thu, 2007-02-22 at 11:11 +0100, Marc Guillemot wrote:
> Hallo Johannes,
>
> this isn't currently supported but server side image map will be
> available in next htmlunit release so we can already plan to integrate
> it. What would make most sense? To add x and y attributes to clickElement?
>
> In the mean time you need a workaround to achieve that while hiding the
> complexity could be to define a macro like following:
>
> <macrodef name="clickElementWithPosition" description="a workaround as
> long as server side image maps aren't supported">
> <attribute name="htmlId" description="the image id"/>
> <attribute name="x" description="the x position"/>
> <attribute name="y" description="the y position"/>
>
> <sequential>
> <!-- groovy step doesn't accept parameters and properties aren't
> expanded in its body, we have to save them temporarily -->
> <storeProperty name="tmp.x" value="@{x}"/>
> <storeProperty name="tmp.y" value="@{y}"/>
> <storeProperty name="tmp.htmlId" value="@{htmlId}"/>
> <groovy>
> // retrieve 'parameters'
> def x = step.webtestProperties.x
> def y = step.webtestProperties.y
> def htmlId = step.webtestProperties.htmlId
>
> def page = step.context.currentResponse
> def img = page.getHtmlElementById(htmlId)
> def link = img.getEnclosingElement('a')
> link.setAttributeValue('href', link.hrefAttribute + "?${x},${y}")
> </groovy>
> <clickElement htmlId="@{htmlId}" description="perform click outside
> groovy script to have last response in resport"/>
> </sequential>
> </macrodef>
>
>
> which can be called with
>
> <clickElementWithPosition htmlId="myImageId" x="123" y="456"/>
>
> (as always my mailer still doesn't perform syntax verification of
> ant/groovy code, small fixes may be needed)
>
> Marc.
> Johannes Buehler wrote:
> > Hello,
> > i have a internet map application, which i would like to test with canoo
> > webtest. Is it possible to simulate a click on such an imagemap? Thats
> > what i have in the image / href tag:
> > <a
> > href='/navigator/basicviewer.jsp?MAP_NAME=map_one&ACTIONID=1172068456500&ACTION_COORDINATES='
> > ><img ismap border='0'
> > src='basicviewer_tunnelimage.jsp?layerset_index=0&BBOX=2893804.847826087,5230000.0,4271196.152173913,6110000.0&LAYERS=layer_51165,layer_51166,layer_51169&STYLES=style_layer_51165,style_layer_51166,style_layer_51169'
> > width='720' height='460'alt='Kartendarstellung' title='Kartendarstellung'
> > />
> >
> > The interesting thing is that the values for the ACTION_COORDINATES are
> > taken from the mouseclick on the imagemap. To get an better idea of the
> > application you can have a look at http://ims3.bkg.bund.de/navigator.
> > In fact i would like to check the returning page after a click on a map.
> >
> > Kind regards
> > Johannes Bühler
>
> _______________________________________________
> WebTest mailing list
> [email protected]
> http://lists.canoo.com/mailman/listinfo/webtest
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest