[Webtest] How to click an image link?
Tim Miller
webtest@lists.canoo.com
Fri, 8 Jul 2005 10:37:30 -0700
This is a multi-part message in MIME format.
------_=_NextPart_001_01C583E3.B7957E57
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
This seems close to working. I changed the syntax slightly to add the
missing "]" and quotes so I have the following:
=20
<click description=3D"Click the 'Show Chart' tab"
=20
xpath=3D"//img[@ONCLICK=3D"loadPage('/edgedynamics/portal/jsp/analyt=
ics
/explorer_chart.jsp');"]" />
=20
But, the button cannot be found.
=20
com.canoo.webtest.engine.StepFailedException: No element found with
xpath
"//img[@ONCLICK=3D"loadPage('/edgedynamics/portal/jsp/analytics/explorer_=
c
hart.jsp');"]"., Step: Click at
file:C:/home/qauser01/ApplicationTests/Suite-p2.4-a2.3.2/gm-test/Analyti
cs/VerifyViewTest.xml:73: with (stepid=3D"<unknown>",
XPath=3D"//img[@ONCLICK=3D"loadPage('/edgedynamics/portal/jsp/analytics/e=
xpl
orer_chart.jsp');"]", stepType=3D"click")
=20
=20
=20
Regards,
Tim
=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
Hi,
=20
We had a similar requirement in one of our projects and following was
the solution for the same.
=20
Use the <click> step. For the image use XPATH expression.
E.g. in your case it would be=20
<click
xpath=3D"//img[@onclick=3DloadPage('/edgedynamics/portal/jsp/analytics/ex=
plo
rer_chart.jsp');" stepid=3D"View the chart"/>
=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
Regards,
- Nimesh
-----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 an 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');"
=09
ONCLICK=3D"loadPage('/edgedynamics/portal/jsp/analytics/explorer_chart.js=
p
');">
</td>
=20
=20
Thanks,
Tim
=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
MASTEK
"Making a valuable difference"
Mastek in NASSCOM's 'India Top 20' Software Service Exporters List.
In the US, we're called MAJESCO
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Opinions expressed in this e-mail are those of the individual and not
that of Mastek Limited, unless specifically indicated to that effect.
Mastek Limited does not accept any responsibility or liability for it.
This e-mail and attachments (if any) transmitted with it are
confidential and/or privileged and solely for the use of the intended
person or entity to which 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. It 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 error, kindly
delete this e-mail from all computers.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
------_=_NextPart_001_01C583E3.B7957E57
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
<html xmlns:v=3D"urn:schemas-microsoft-com:vml" =
xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:st1=3D"urn:schemas-microsoft-com:office:smarttags" =
xmlns=3D"http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><o:SmartTagType
namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags" =
name=3D"country-region"/>
<o:SmartTagType =
namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags"
name=3D"place"/>
<o:SmartTagType =
namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags"
name=3D"PersonName"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman";}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline;}
pre
{margin:0in;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";}
span.EmailStyle18
{mso-style-type:personal;
font-family:Arial;
color:windowtext;}
span.EmailStyle23
{mso-style-type:personal-reply;
font-family:Arial;
color:navy;}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
{page:Section1;}
-->
</style>
</head>
<body lang=3DEN-US link=3Dblue vlink=3Dpurple>
<div class=3DSection1>
<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>This seems close to working. =
I
changed the syntax slightly to add the missing “]” and =
quotes so I
have the following:<o:p></o:p></span></font></p>
<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=3DMsoNormal style=3D'text-autospace:none'><font size=3D2 =
face=3D"Courier New"><span
style=3D'font-size:10.0pt;font-family:"Courier =
New";background:white'><click
description=3D"Click the 'Show Chart' tab"</span></font><font =
size=3D2
face=3D"Courier New"><span =
style=3D'font-size:10.0pt;font-family:"Courier =
New"'><o:p></o:p></span></font></p>
<p class=3DMsoNormal style=3D'text-autospace:none'><font size=3D2 =
face=3D"Courier New"><span
style=3D'font-size:10.0pt;font-family:"Courier =
New";background:white'> =
xpath=3D"//img[@ONCLICK=3D&quot;loadPage('/edgedynamics/portal/j=
sp/analytics/explorer_chart.jsp');&quot;]"
/></span></font><font size=3D2 face=3D"Courier New"><span =
style=3D'font-size:10.0pt;
font-family:"Courier New"'><o:p></o:p></span></font></p>
<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>But, the button cannot be =
found.<o:p></o:p></span></font></p>
<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'>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/a=
nalytics/explorer_chart.jsp');"]",
stepType=3D"click")<o:p></o:p></span></font></p>
<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'><o:p> </o:p></span></font></p>
<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'><o:p> </o:p></span></font></p>
<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'><o:p> </o:p></span></font></p>
<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'>Regards,<o:p></o:p></span></font></p>
<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'>Tim<o:p></o:p></span></font></p>
<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<div>
<div class=3DMsoNormal align=3Dcenter style=3D'text-align:center'><font =
size=3D3
face=3D"Times New Roman"><span style=3D'font-size:12.0pt'>
<hr size=3D2 width=3D"100%" align=3Dcenter tabindex=3D-1>
</span></font></div>
<p class=3DMsoNormal><b><font size=3D2 face=3DTahoma><span =
style=3D'font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font =
size=3D2
face=3DTahoma><span style=3D'font-size:10.0pt;font-family:Tahoma'>
webtest-admin@lists.canoo.com [mailto:webtest-admin@lists.canoo.com] =
<b><span
style=3D'font-weight:bold'>On Behalf Of </span></b>Nimesh Muley<br>
<b><span style=3D'font-weight:bold'>Sent:</span></b> Thursday, July 07, =
2005 9:46
PM<br>
<b><span style=3D'font-weight:bold'>To:</span></b> <st1:PersonName =
w:st=3D"on">webtest@lists.canoo.com</st1:PersonName><br>
<b><span style=3D'font-weight:bold'>Subject:</span></b> RE: [Webtest] =
How to
click an image link?</span></font><o:p></o:p></p>
</div>
<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'><o:p> </o:p></span></font></p>
<div>
<p class=3DMsoNormal><font size=3D2 face=3D"Times New Roman"><span =
style=3D'font-size:
10.0pt'>Hi,</span></font><o:p></o:p></p>
</div>
<div>
<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'> <o:p></o:p></span></font></p>
</div>
<div>
<p class=3DMsoNormal><font size=3D2 face=3D"Times New Roman"><span =
style=3D'font-size:
10.0pt'>We had a similar requirement in one of our projects and =
following was
the solution for the same.</span></font><o:p></o:p></p>
</div>
<div>
<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'> <o:p></o:p></span></font></p>
</div>
<div>
<p class=3DMsoNormal><font size=3D2 face=3D"Times New Roman"><span =
style=3D'font-size:
10.0pt'>Use the <click> step. For the image use XPATH =
expression.</span></font><o:p></o:p></p>
</div>
<div>
<p class=3DMsoNormal><font size=3D2 face=3D"Times New Roman"><span =
style=3D'font-size:
10.0pt'>E.g. in your case it would be </span></font><o:p></o:p></p>
</div>
<div>
<p class=3DMsoNormal><font size=3D2 face=3D"Times New Roman"><span =
style=3D'font-size:
10.0pt'><click
xpath=3D"//img[@onclick=3DloadPage('/edgedynamics/portal/jsp/analyti=
cs/explorer_chart.jsp');"
stepid=3D"View the chart"/></span></font><o:p></o:p></p>
</div>
<div>
<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'> <o:p></o:p></span></font></p>
</div>
<div>
<p class=3DMsoNormal><font size=3D2 face=3D"Times New Roman"><span =
style=3D'font-size:
10.0pt'>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.</span></font><o:p></o:p></p>
</div>
<div>
<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'> <o:p></o:p></span></font></p>
</div>
<div>
<p class=3DMsoNormal><font size=3D2 face=3D"Times New Roman"><span =
style=3D'font-size:
10.0pt'>Regards,</span></font><o:p></o:p></p>
</div>
<div>
<p class=3DMsoNormal><font size=3D2 face=3D"Times New Roman"><span =
style=3D'font-size:
10.0pt'>- Nimesh</span></font><o:p></o:p></p>
</div>
<blockquote =
style=3D'margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt'>
<p class=3DMsoNormal style=3D'margin-bottom:12.0pt'><font size=3D2 =
face=3DTahoma><span
style=3D'font-size:10.0pt;font-family:Tahoma'>-----Original =
Message-----<br>
<b><span style=3D'font-weight:bold'>From:</span></b> <st1:PersonName =
w:st=3D"on">Tim
Miller</st1:PersonName> [mailto:<st1:PersonName =
w:st=3D"on">tmiller@edgedynamics.com</st1:PersonName>]<br>
<b><span style=3D'font-weight:bold'>Sent:</span></b> Friday, July 08, =
2005 12:30
AM<br>
<b><span style=3D'font-weight:bold'>To:</span></b> <st1:PersonName =
w:st=3D"on">webtest@lists.canoo.com</st1:PersonName><br>
<b><span style=3D'font-weight:bold'>Subject:</span></b> [Webtest] How to =
click an
image link?</span></font><o:p></o:p></p>
<pre><font size=3D2 face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>Is there a way to click an image so the =
onclick event is triggered with WebTest? Html =
follows.<o:p></o:p></span></font></pre><pre><font
size=3D2 face=3D"Courier New"><span =
style=3D'font-size:10.0pt'><o:p> </o:p></span></font></pre><pre><fon=
t
size=3D2 face=3D"Courier New"><span =
style=3D'font-size:10.0pt'><o:p> </o:p></span></font></pre><pre><fon=
t
size=3D2 face=3D"Courier New"><span style=3D'font-size:10.0pt'><<span
class=3Dstart-tag>td</span>><o:p></o:p></span></font></pre><pre><font =
size=3D2
face=3D"Courier New"><span style=3D'font-size:10.0pt'> <<span
class=3Dstart-tag>img</span><span class=3Dattribute-name> =
name</span>=3D<span
class=3Dattribute-value>"chart" </span><span =
class=3Dattribute-name>src</span>=3D<span
class=3Dattribute-value>"/edgedynamics/portal/images/chart_off.gif&q=
uot;<o:p></o:p></span></span></font></pre><pre><span
class=3Dattribute-value><font size=3D2 face=3D"Courier New"><span =
style=3D'font-size:
10.0pt'> </span></font></span><span =
class=3Dattribute-name>border</span>=3D<span
class=3Dattribute-value>"0"<o:p></o:p></span></pre><pre><span
class=3Dattribute-value><font size=3D2 face=3D"Courier New"><span =
style=3D'font-size:
10.0pt'> </span></font></span><span =
class=3Dattribute-name>ONMOUSEOVER</span>=3D<span
class=3Dattribute-value>"showOnButton('chart');"<o:p></o:p></sp=
an></pre><pre><span
class=3Dattribute-value><font size=3D2 face=3D"Courier New"><span =
style=3D'font-size:
10.0pt'> </span></font></span><span =
class=3Dattribute-name>ONMOUSEOUT</span>=3D<span
class=3Dattribute-value>"showOffButton('chart');"<o:p></o:p></s=
pan></pre><pre><span
class=3Dattribute-value><font size=3D2 face=3D"Courier New"><span =
style=3D'font-size:
10.0pt'> </span></font></span><span =
class=3Dattribute-name>ONCLICK</span>=3D<span
class=3Dattribute-value>"loadPage('/edgedynamics/portal/jsp/analytic=
s/explorer_chart.jsp');"</span>><o:p></o:p></pre><pre><font
size=3D2 face=3D"Courier New"><span =
style=3D'font-size:10.0pt'></<span
class=3Dend-tag>td</span>><o:p></o:p></span></font></pre>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>Thanks,<o:p></o:p></span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>Tim<o:p></o:p></span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span =
style=3D'font-size:7.5pt;
font-family:Arial'>(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.)</span></font><o:p></o:p></p>
<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'><o:p> </o:p></span></font></p>
</blockquote>
<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'><br>
<br>
MASTEK<br>
"Making a valuable difference"<br>
Mastek in NASSCOM's '<st1:country-region w:st=3D"on"><st1:place =
w:st=3D"on">India</st1:place></st1:country-region>
Top 20' Software Service Exporters List.<br>
In the <st1:country-region w:st=3D"on"><st1:place =
w:st=3D"on">US</st1:place></st1:country-region>,
we're called MAJESCO<br>
<br>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
Opinions expressed in this e-mail are those of the individual and not =
that of
Mastek Limited, unless specifically indicated to that effect. Mastek =
Limited
does not accept any responsibility or liability for it. This e-mail and
attachments (if any) transmitted with it are confidential and/or =
privileged and
solely for the use of the intended person or entity to which 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. It 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 error, kindly delete this =
e-mail from
all computers.<br>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<o:p></o:p></span></font></p>
</div>
</body>
</html>
------_=_NextPart_001_01C583E3.B7957E57--