[Webtest] How to click an image link?
Ian Pojman
webtest@lists.canoo.com
Mon, 11 Jul 2005 11:53:13 -0500
find the "Xpath explorer" application, and try to build a correct
expression that way, it beats guessing ...
/ian
On 7/8/05, Tim Miller <tmiller@edgedynamics.com> wrote:
> =20
> =20
>=20
> This seems close to working. I changed the syntax slightly to add the
> missing "]" and quotes so I have the following:=20
>=20
> =20
>=20
> <click description=3D"Click the 'Show Chart' tab"=20
>=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
>=20
> com.canoo.webtest.engine.StepFailedException: No element
> found with xpath
> "//img[@ONCLICK=3D"loadPage('/edgedynamics/portal/jsp/analytics/explorer_=
chart.jsp');"]".,
> Step: Click at
> file:C:/home/qauser01/ApplicationTests/Suite-p2.4-a2.3.2/gm-test/Analytic=
s/VerifyViewTest.xml:73:
> with (stepid=3D"<unknown>",
> XPath=3D"//img[@ONCLICK=3D"loadPage('/edgedynamics/portal/jsp/analytics/e=
xplorer_chart.jsp');"]",
> stepType=3D"click")=20
>=20
> =20
>=20
> =20
>=20
> =20
>=20
> Regards,=20
>=20
> Tim=20
>=20
> =20
>=20
> =20
> =20
> ________________________________
> =20
>=20
> From: webtest-admin@lists.canoo.com [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
> =20
> =20
>=20
> Hi,=20
> =20
>=20
> =20
> =20
>=20
> We had a similar requirement in one of our projects and following was the
> solution for the same.=20
> =20
>=20
> =20
> =20
>=20
> Use the <click> step. For the image use XPATH expression.=20
> =20
>=20
> E.g. in your case it would be=20
> =20
>=20
> <click
> xpath=3D"//img[@onclick=3DloadPage('/edgedynamics/portal/jsp/analytics/ex=
plorer_chart.jsp');"
> stepid=3D"View the chart"/>=20
> =20
>=20
> =20
> =20
>=20
> The onclick attribute is used to locate the image in the example above.
> Similarly I believe you can use other attributes instead of onclick
> attribute.=20
> =20
>=20
> =20
> =20
>=20
> Regards,=20
> =20
>=20
> - Nimesh=20
> =20
>=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? Is there a way to click a=
n
> image so the onclick event is triggered with WebTest? Html follows.
> =20
> =20
> <td>
> <img name=3D"chart"
> src=3D"/edgedynamics/portal/images/chart_off.gif"
> border=3D"0"
> ONMOUSEOVER=3D"showOnButton('chart');"
> ONMOUSEOUT=3D"showOffButton('chart');"
> =20
> ONCLICK=3D"loadPage('/edgedynamics/portal/jsp/analytics/explorer_chart.js=
p');">
> </td>
> =20
>=20
> =20
>=20
> =20
>=20
> Thanks,=20
>=20
> Tim=20
>=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, disclosu=
re
> 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
> =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 th=
at
> of Mastek Limited, unless specifically indicated to that effect. Mastek
> Limited does not accept any responsibility or liability for it. This e-ma=
il
> and attachments (if any) transmitted with it are confidential and/or
> privileged and solely for the use of the intended person or entity to whi=
ch
> it is addressed. Any review, re-transmission, dissemination or other use =
of
> or taking of any action in reliance upon this information by persons or
> entities other than the intended recipient is prohibited. This e-mail and
> its attachments have been scanned for the presence of computer viruses. I=
t
> is the responsibility of the recipient to run the virus check on e-mails =
and
> attachments before opening them. If you have received this e-mail in erro=
r,
> kindly delete this e-mail from all computers.
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~