[Webtest] How to click an image link?
Tim Miller
webtest@lists.canoo.com
Tue, 12 Jul 2005 09:44:22 -0700
Thanks Marc,
This now works. It would be nice if case could be ignored but I guess
that would be a function of XPath?
Tim
-----Original Message-----
From: webtest-admin@lists.canoo.com
[mailto:webtest-admin@lists.canoo.com] On Behalf Of Marc Guillemot
Sent: Tuesday, July 12, 2005 4:32 AM
To: webtest@lists.canoo.com
Subject: Re: [Webtest] How to click an image link?
The xpath is evaluated against the DOM which itself is the result of the
parsing therefore some changes are performed to=20
the source html code like for instance changing attribute names to
lowercase.
Try:
<click description=3D"Click the 'Show Chart' tab"
=20
xpath=3D"//img[@onclick=3D"loadPage('/edgedynamics/portal/jsp/analyt=
ics
/explorer_chart.jsp');"]"
/>
Marc.
Tim Miller wrote:
> This seems close to working. I changed the syntax slightly to add the
> missing "]" and quotes so I have the following:
>=20
> =20
>=20
> <click description=3D"Click the 'Show Chart' tab"
>=20
> =20
>
xpath=3D"//img[@ONCLICK=3D"loadPage('/edgedynamics/portal/jsp/analyt=
ics
/explorer_chart.jsp');"]"=20
> />
>=20
> =20
>=20
> But, the button cannot be found.
>=20
> =20
>=20
> com.canoo.webtest.engine.StepFailedException: No element found with=20
> xpath=20
>
"//img[@ONCLICK=3D"loadPage('/edgedynamics/portal/jsp/analytics/explorer_=
c
hart.jsp');"]".,=20
> Step: Click at=20
>
file:C:/home/qauser01/ApplicationTests/Suite-p2.4-a2.3.2/gm-test/Analyti
cs/VerifyViewTest.xml:73:=20
> with (stepid=3D"<unknown>",=20
>
XPath=3D"//img[@ONCLICK=3D"loadPage('/edgedynamics/portal/jsp/analytics/e=
xpl
orer_chart.jsp');"]",=20
> stepType=3D"click")
>=20
> =20
>=20
> =20
>=20
> =20
>=20
> Regards,
>=20
> Tim
>=20
> =20
>=20
> =20
>=20
>
------------------------------------------------------------------------
>=20
> *From:* webtest-admin@lists.canoo.com=20
> [mailto:webtest-admin@lists.canoo.com] *On Behalf Of *Nimesh Muley
> *Sent:* Thursday, July 07, 2005 9:46 PM
> *To:* webtest@lists.canoo.com
> *Subject:* RE: [Webtest] How to click an image link?
>=20
> =20
>=20
> Hi,
>=20
> =20
>=20
> We had a similar requirement in one of our projects and following was=20
> the solution for the same.
>=20
> =20
>=20
> Use the <click> step. For the image use XPATH expression.
>=20
> E.g. in your case it would be
>=20
> <click=20
>
xpath=3D"//img[@onclick=3DloadPage('/edgedynamics/portal/jsp/analytics/ex=
plo
rer_chart.jsp');"=20
> stepid=3D"View the chart"/>
>=20
> =20
>=20
> The onclick attribute is used to locate the image in the example
above.=20
> Similarly I believe you can use other attributes instead of onclick=20
> attribute.
>=20
> =20
>=20
> Regards,
>=20
> - Nimesh
>=20
> -----Original Message-----
> *From:* Tim Miller [mailto:tmiller@edgedynamics.com]
> *Sent:* Friday, July 08, 2005 12:30 AM
> *To:* webtest@lists.canoo.com
> *Subject:* [Webtest] How to click an image link?
>=20
> Is there a way to click an image so the onclick event is triggered
with WebTest? Html follows.
>=20
> =20
>=20
> =20
>=20
> <td>
>=20
> <img name=3D"chart" =
src=3D"/edgedynamics/portal/images/chart_off.gif"
>=20
> border=3D"0"
>=20
> ONMOUSEOVER=3D"showOnButton('chart');"
>=20
> ONMOUSEOUT=3D"showOffButton('chart');"
>=20
>
ONCLICK=3D"loadPage('/edgedynamics/portal/jsp/analytics/explorer_chart.js=
p
');">
>=20
> </td>
>=20
> =20
>=20
> =20
>=20
> Thanks,
>=20
> Tim
>=20
> =20
>=20
> =20
>=20
> (This email message is for the sole use of the intended
recipient(s)
> and may contain confidential information. Any unauthorized
review,
> use, disclosure or distribution is prohibited. If you are not the
> intended recipient, please contact the sender by reply email and
> destroy all copies of the original message.)
>=20
> =20
>=20
>=20
>=20
> MASTEK
> "Making a valuable difference"
> Mastek in NASSCOM's 'India Top 20' Software Service Exporters List.
> In the US, we're called MAJESCO
>=20
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Opinions expressed in this e-mail are those of the individual and not=20
> that of Mastek Limited, unless specifically indicated to that effect.=20
> Mastek Limited does not accept any responsibility or liability for it.
> This e-mail and attachments (if any) transmitted with it are=20
> confidential and/or privileged and solely for the use of the intended=20
> person or entity to which it is addressed. Any review,
re-transmission,=20
> dissemination or other use of or taking of any action in reliance upon
> this information by persons or entities other than the intended=20
> recipient is prohibited. This e-mail and its attachments have been=20
> scanned for the presence of computer viruses. It is the responsibility
> of the recipient to run the virus check on e-mails and attachments=20
> before opening them. If you have received this e-mail in error, kindly
> delete this e-mail from all computers.
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>=20
_______________________________________________
WebTest mailing list
WebTest@lists.canoo.com
http://lists.canoo.com/mailman/listinfo/webtest