[Webtest] XPath Incorrectly Reporting Success
Soula, William
Soula, William" <wsoula@pointserve.com
Tue, 13 Nov 2007 15:15:14 -0600
This is a multi-part message in MIME format.
------_=_NextPart_001_01C8263A.47C7CCFD
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Below is the html from a webpage I am trying to test. I know it is
malformed, as I have already had to deal with that issue. My problem is
that if I try to click the Submit button using this code <clickButton
name=3D"Submit" label=3D"OK"/> I get an error. That is fine, I have =
assumed
it has to do with the malformed html. The problem lies in that if I use
this code <clickButton xpath=3D"//input[@type=3D'submit']"/> Webtest =
reports
a success. If I do a <selectWindow/> for a non existent window after
this step; the report tells me I have two windows I can select from (the
Postal Codes Window and the main window). So it looks like the xpath
did not successfully click the button even though it reported that it
did. Is this a correct assumption? If so, does it hold greater
implications for my testing at large using xpath. I have been using
xpath a lot in my testing and if malformed xml cause an incorrect report
from xpath then debugging is going to be a pain and I fear false
positives in my tests.
=20
=20
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Select Postal Codes</title>
<meta http-equiv=3D"Content-Type" content=3D"text/html;
charset=3Diso-8859-1">
=20
<link href=3D"/css/SNMstylesheet.css" rel=3D"stylesheet" =
type=3D"text/css">
<link href=3D"/css/SNMPrintstylesheet.css" rel=3D"stylesheet"
type=3D"text/css" media=3D"print">
<link href=3D"/js/calendar-win2k-cold-1.css" rel=3D"stylesheet"
type=3D"text/css">
<script src=3D"/js/util.js" type=3D"text/javascript"></script>
<script src=3D"/js/sort.js" type=3D"text/javascript"></script>
<script src=3D"/js/tooltip.js" type=3D"text/javascript"></script>
<script src=3D"/js/calendar.js" type=3D"text/javascript"></script>
<script src=3D"/js/calendar-en.js" type=3D"text/javascript"></script>
<script src=3D"/js/calendar-setup.js" =
type=3D"text/javascript"></script>
<script src=3D"/js/calendar-util.js" =
type=3D"text/javascript"></script>
<script src=3D"/js/validations.js" type=3D"text/javascript"></script>
<script src=3D"/js/hashtable.js" type=3D"text/javascript"></script>
<script src=3D"/js/RoboHelp_CSH.js" type=3D"text/javascript"></script>
=20
<!-- insert head -->
=20
<script type=3D"text/javascript">
function searchPostalCodes() {
var postalCodeSelectForm =3D =
document.forms["postalCodeSelectForm"];
postalCodeSelectForm.submit();
}
function add() {
var tableElement =3D document.getElementById('postalCodeTable');
var postalCodesArray =3D new Array();
=20
for (var i =3D 1; i < tableElement.rows.length; i++) {
if (document.getElementById('postalCodeSelect' + i).checked) {
var postalCodeArray =3D new
Array(document.getElementById('postalCode' + i).value,=20
=20
document.getElementById('postalCodeCity' + i).value,=20
=20
document.getElementById('postalCodeState' + i).value);
postalCodesArray.push(postalCodeArray);
}
}
=20
window.opener.addPostalCodes(postalCodesArray);
window.opener.focus();
window.close();
}
</script>
=20
<!-- end insert head -->
<script type=3D"text/javascript">
function packHeight() {
// note that adjusting the width is problematic because it can cause
things to wrap that shouldn't
var dialogFrame =3D document.getElementById("dialogFrame");
=20
}
function showSize() {
alert("dialogFrame offsetWidth: " + dialogFrame.offsetWidth + "
offsetHeight: " + dialogFrame.offsetHeight + "\n" +
"dialogFrame scrollWidth: " + dialogFrame.scrollWidth + "
scrollHeight: " + dialogFrame.scrollHeight + "\n" +
"dialogFrame clientWidth: " + dialogFrame.clientWidth + "
clientHeight: " + dialogFrame.clientHeight + "\n" +
"dialogFrame width: " + dialogFrame.width + " height: " +
dialogFrame.height);
}
</script>
</head>
=20
<body class=3D"dialogBody" =
onload=3D"onloadPopup(1798000);packHeight();">
<div id=3D"dialogFrame">
=20
<div id=3D"dialog_masthead">
<img class=3D"logo" src=3D"/images/masthead/ESObranding.gif" />
</div>
=20
=20
<div id=3D"contentDialogContent">
<h1>Select Postal Codes</h1>
=20
<form action=3D"/data/postalCodeSelect.do"
name=3D"postalCodeSelectForm"
id=3D"postalCodeSelectForm"
onsubmit=3D"add(); return false;"
method=3D"POST">
=20
<div class=3D"dialogContent">
=20
=20
=20
=20
<table class=3D"tuple">
<tr>
<th>Display Postal Codes Within:</th>
<td><select name=3D"miles"><option value=3D"5"
selected=3D"selected">5</option><option value=3D"10">10</option><option
value=3D"15">15</option><option value=3D"20">20</option><option
value=3D"25">25</option><option value=3D"50">50</option><option
value=3D"75">75</option><option value=3D"100">100</option></select>
miles of the Postal Code
<input name=3D"postalCode" type=3D"text" size=3D"10" =
value=3D"78703" >
</td>
</tr>
<tr>
=20
<td>
<input type=3D"button" class=3D"button"
onclick=3D"searchPostalCodes();" value=3D"Search" >
</td>
=20
</tr>
</table>
=20
=20
=20
=20
=20
<div id=3D"areaHeading" ><h2>Postal Codes</h2></div>
=20
<table id=3D"postalCodeTable"class=3D"data">
<tr>
<th></th>
<th>Postal Code</th>
<th>City/Region</th>
</tr>
=20
<tr>
<td><input id=3D"postalCodeSelect1" type=3D"checkbox"
value=3D"checkbox" >
</td>
<td>
78746
<input id=3D'postalCode1' type=3D"hidden" value=3D'78746' >
</td>
<td>
Austin, TX
<input id=3D'postalCodeCity1' type=3D"hidden" =
value=3D'Austin' >
<input id=3D'postalCodeState1' type=3D"hidden" value=3D'TX' =
>
</td>
</tr>
=20
=20
</table>
</div>
=20
=20
</div>
=20
<div class=3D"dialogButtonBar">
<input type=3D"submit" class=3D"button" name=3D"Submit" =
value=3D"OK"
onclick=3D"">
<input type=3D"button" class=3D"button" name=3D"Submit" =
value=3D"Cancel"
onclick=3D"window.close();">
</div>
</form>
</div>
</div>
</body>
</html>
=20
=20
=20
William Soula
QA Analyst
=20
Pointserve, Inc.
110 Wild Basin Road
Suite 300
Austin, Texas 78746
O: 512.617.5311
F: 512.617.0466
=20
------_=_NextPart_001_01C8263A.47C7CCFD
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dus-ascii">
<META content=3D"MSHTML 6.00.6000.16544" name=3DGENERATOR></HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D925060021-13112007>Below =
is the html=20
from a webpage I am trying to test. I know it is malformed, as I =
have=20
already had to deal with that issue. My problem is that if I try =
to click=20
the Submit button using this code <clickButton name=3D"Submit" =
label=3D"OK"/>=20
I get an error. That is fine, I have assumed it has to do with the =
malformed html. The problem lies in that if I use this code=20
<clickButton xpath=3D"//input[@type=3D'submit']"/> Webtest reports =
a=20
success. If I do a <selectWindow/> for a non existent window =
after=20
this step; the report tells me I have two windows I can select from =
(the=20
Postal Codes Window and the main window). So it looks like the =
xpath did=20
not successfully click the button even though it reported that it =
did. Is=20
this a correct assumption? If so, does it hold greater =
implications for my=20
testing at large using xpath. I have been using xpath a lot in my =
testing=20
and if malformed xml cause an incorrect report from xpath then debugging =
is=20
going to be a pain and I fear false positives in my =
tests.</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D925060021-13112007></SPAN></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D925060021-13112007></SPAN></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><!DOCTYPE HTML PUBLIC "-//W3C//DTD =
HTML 4.01=20
Transitional//EN" "<A=20
href=3D"http://www.w3.org/TR/html4/loose.dtd">http://www.w3.org/TR/html4/=
loose.dtd</A>"><BR><html><BR><head><BR> =20
<title>Select Postal Codes</title><BR> <meta=20
http-equiv=3D"Content-Type" content=3D"text/html; =
charset=3Diso-8859-1"><BR> =20
<BR> <link href=3D"/css/SNMstylesheet.css" rel=3D"stylesheet"=20
type=3D"text/css"><BR> <link =
href=3D"/css/SNMPrintstylesheet.css"=20
rel=3D"stylesheet" type=3D"text/css" media=3D"print"><BR> =
<link=20
href=3D"/js/calendar-win2k-cold-1.css" rel=3D"stylesheet"=20
type=3D"text/css"><BR> <script src=3D"/js/util.js"=20
type=3D"text/javascript"></script><BR> <script =
src=3D"/js/sort.js"=20
type=3D"text/javascript"></script><BR> <script=20
src=3D"/js/tooltip.js" =
type=3D"text/javascript"></script><BR> =20
<script src=3D"/js/calendar.js"=20
type=3D"text/javascript"></script><BR> <script=20
src=3D"/js/calendar-en.js" =
type=3D"text/javascript"></script><BR> =20
<script src=3D"/js/calendar-setup.js"=20
type=3D"text/javascript"></script><BR> <script=20
src=3D"/js/calendar-util.js" =
type=3D"text/javascript"></script><BR> =20
<script src=3D"/js/validations.js"=20
type=3D"text/javascript"></script><BR> <script=20
src=3D"/js/hashtable.js" =
type=3D"text/javascript"></script><BR> =20
<script src=3D"/js/RoboHelp_CSH.js"=20
type=3D"text/javascript"></script></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> <!-- insert head =
--><BR> =20
<BR> <script=20
type=3D"text/javascript"><BR> function =
searchPostalCodes()=20
{<BR> var postalCodeSelectForm =3D=20
document.forms["postalCodeSelectForm"];<BR> =
=20
postalCodeSelectForm.submit();<BR> =
}<BR> =20
function add() {<BR> var tableElement =3D=20
document.getElementById('postalCodeTable');<BR> &n=
bsp;=20
var postalCodesArray =3D new Array();<BR> =20
<BR> for (var i =3D 1; i <=20
tableElement.rows.length; i++) =
{<BR> =20
if (document.getElementById('postalCodeSelect' + i).checked)=20
{<BR> var =
postalCodeArray=20
=3D new Array(document.getElementById('postalCode' + i).value,=20
<BR> &nb=
sp; &nbs=
p;  =
; =20
document.getElementById('postalCodeCity' + i).value,=20
<BR> &nb=
sp; &nbs=
p;  =
; =20
document.getElementById('postalCodeState' +=20
i).value);<BR> =20
postalCodesArray.push(postalCodeArray);<BR> =
=20
}<BR> }<BR> =20
<BR> =20
window.opener.addPostalCodes(postalCodesArray);<BR> &nbs=
p; =20
window.opener.focus();<BR> =20
window.close();<BR> }<BR> =20
</script><BR> <BR> <!-- end insert head =
--><BR> =20
<script type=3D"text/javascript"><BR> function packHeight()=20
{<BR> // note that adjusting the width is problematic =
because=20
it can cause things to wrap that shouldn't<BR> var =
dialogFrame=20
=3D document.getElementById("dialogFrame");<BR> =
<BR> =20
}<BR> function showSize() {<BR> =
alert("dialogFrame=20
offsetWidth: " + dialogFrame.offsetWidth + " offsetHeight: " +=20
dialogFrame.offsetHeight + "\n"=20
+<BR> "dialogFrame =
scrollWidth: " + dialogFrame.scrollWidth + " scrollHeight: " +=20
dialogFrame.scrollHeight + "\n"=20
+<BR> "dialogFrame =
clientWidth: " + dialogFrame.clientWidth + " clientHeight: " +=20
dialogFrame.clientHeight + "\n"=20
+<BR> "dialogFrame =
width:=20
" + dialogFrame.width + " height: " + dialogFrame.height);<BR> =
}<BR> =20
</script><BR></head></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2><body class=3D"dialogBody"=20
onload=3D"onloadPopup(1798000);packHeight();"><BR> <div=20
id=3D"dialogFrame"><BR> <BR> <div=20
id=3D"dialog_masthead"><BR> <img =
class=3D"logo"=20
src=3D"/images/masthead/ESObranding.gif"=20
/><BR> </div><BR> </FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> <div=20
id=3D"contentDialogContent"><BR> <h1>Select =
Postal=20
Codes</h1><BR> =20
<BR> <form=20
action=3D"/data/postalCodeSelect.do"<BR> &nb=
sp; =20
name=3D"postalCodeSelectForm"<BR> &nbs=
p; =20
id=3D"postalCodeSelectForm"<BR> =
=20
onsubmit=3D"add(); return=20
false;"<BR> &n=
bsp; =20
method=3D"POST"><BR> &n=
bsp;=20
<BR> <div =
class=3D"dialogContent"><BR> =
<BR> &nb=
sp; <BR> =
&=
nbsp; =20
</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> <table=20
class=3D"tuple"><BR> =20
<tr><BR> =
<th>Display=20
Postal Codes =
Within:</th><BR> =20
<td><select name=3D"miles"><option value=3D"5"=20
selected=3D"selected">5</option><option=20
value=3D"10">10</option><option=20
value=3D"15">15</option><option=20
value=3D"20">20</option><option=20
value=3D"25">25</option><option=20
value=3D"50">50</option><option=20
value=3D"75">75</option><option=20
value=3D"100">100</option></select><BR> &=
nbsp; =20
miles of the Postal=20
Code<BR> <input =
name=3D"postalCode" type=3D"text" size=3D"10" value=3D"78703"=20
><BR> =20
</td><BR> =20
</tr><BR> =20
<tr><BR> =20
<BR> =20
<td><BR> =
<input=20
type=3D"button" class=3D"button" onclick=3D"searchPostalCodes();" =
value=3D"Search"=20
><BR> =20
</td><BR> =20
<BR> </tr><BR> =20
</table><BR> <BR> =20
<BR> &nb=
sp; =20
<BR> &nb=
sp; =20
<BR> <BR> <div id=3D"areaHeading" =
><h2>Postal=20
Codes</h2></div><BR> =20
<BR> <table=20
id=3D"postalCodeTable"class=3D"data"><BR>  =
; =20
<tr><BR> =20
<th></th><BR> =
=20
<th>Postal=20
Code</th><BR> =
=20
<th>City/Region</th><BR> &=
nbsp;=20
</tr><BR> =20
<BR> =20
<tr><BR> =20
<td><input id=3D"postalCodeSelect1" type=3D"checkbox" =
value=3D"checkbox"=20
><BR> =20
</td><BR> =20
<td><BR>  =
; =20
78746<BR> &nbs=
p;=20
<input id=3D'postalCode1' type=3D"hidden" value=3D'78746'=20
><BR> =20
</td><BR> =20
<td><BR>  =
; =20
Austin, =
TX<BR> =
<input id=3D'postalCodeCity1' type=3D"hidden" value=3D'Austin'=20
><BR>  =
;=20
<input id=3D'postalCodeState1' type=3D"hidden" value=3D'TX'=20
><BR> =20
</td><BR> =20
</tr><BR> =20
<BR> =20
<BR> </table><BR> =20
</div><BR> <BR> <BR> =20
=20
</div><BR> =20
=20
<BR> =20
<div class=3D"dialogButtonBar"><BR> =20
<input type=3D"submit" class=3D"button" =
name=3D"Submit"=20
value=3D"OK" onclick=3D""><BR> =
<input=20
type=3D"button" class=3D"button" name=3D"Submit" value=3D"Cancel"=20
onclick=3D"window.close();"><BR> =20
=20
</div><BR> =20
</form><BR> =20
</div><BR> </div><BR></body><BR></html>=
;</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2><BR></FONT> </DIV>
<DIV> </DIV>
<DIV align=3Dleft><SPAN class=3D196385116-04122006><FONT face=3DArial =
size=3D2></FONT>
<DIV align=3Dleft><FONT color=3D#000000><FONT face=3DArial =
size=3D2><STRONG>William=20
Soula</STRONG></FONT></FONT></DIV>
<DIV align=3Dleft><FONT color=3D#000000><FONT face=3DArial size=3D1>QA=20
Analyst</FONT></FONT></DIV>
<DIV align=3Dleft><FONT face=3DArial size=3D1><FONT=20
color=3D#000000> </DIV></FONT></FONT>
<DIV align=3Dleft><FONT size=3D2><FONT face=3DArial><FONT=20
color=3D#0082c8><STRONG>Pointserve, =
Inc.</STRONG></FONT></FONT></FONT></DIV>
<DIV align=3Dleft><FONT color=3D#000000><FONT face=3DArial size=3D1>110 =
Wild Basin=20
Road</FONT></FONT></DIV>
<DIV align=3Dleft><FONT color=3D#000000><FONT face=3DArial =
size=3D1>Suite=20
300</FONT></FONT></DIV>
<DIV align=3Dleft><FONT color=3D#000000><FONT face=3DArial =
size=3D1>Austin, Texas=20
78746</FONT></FONT></DIV>
<DIV align=3Dleft><FONT color=3D#000000><FONT face=3DArial size=3D1>O:=20
512.617.5311</FONT></FONT></DIV>
<DIV align=3Dleft><FONT color=3D#000000><FONT face=3DArial size=3D1>F:=20
512.617.0466</FONT></FONT></DIV></SPAN></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV></BODY></HTML>
------_=_NextPart_001_01C8263A.47C7CCFD--