He realizes that the HTML is malformed.   His question is really why
does Xpath seem to work (reports success) when the html is malformed.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Soula, William
Sent: Wednesday, November 14, 2007 10:01 AM
To: [email protected]
Subject: RE: [Webtest] XPath Incorrectly Reporting Success

Yeah, I get a button not found message so attaching by just label won't
help.  The report says :

Message

No button found

Details

available buttons       In HtmlForm[<form
action="/data/postalCodeSelect.do" name="postalCodeSelectForm"
id="postalCodeSelectForm" onsubmit="add(); return false;"
method="POST">]: [HtmlButtonInput[<input value="Search" type="button"
class="button" onclick="searchPostalCodes();">]]

My main question though is, when I use Xpath to click the button why
does the window not close like it is supposed to?  And, is this a bug in
xpath?

 


William Soula
QA Analyst
 
Pointserve, Inc.
110 Wild Basin Road
Suite 300
Austin, Texas 78746
O: 512.617.5311
F: 512.617.0466

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Marc Guillemot
Sent: Wednesday, November 14, 2007 4:28 AM
To: [email protected]
Subject: Re: [Webtest] XPath Incorrectly Reporting Success

Hi,

you could probably just use
<clickButton label="OK"/>
instead of
<clickButton name="Submit" label="OK"/>

What for an error did you get when clicking the button this way? Button
not found? In this case this would mean that the result of parsing your
malformed html code causes the button to be seen outside of the form.
This would explain why it can be found by xpath //[EMAIL PROTECTED]'submit']
(but probably not by xpath //form//[EMAIL PROTECTED]'submit']) but that the
click doesn't produce any result.

To see what HtmlUnit "sees", you can dump the page state to the console
(at debug level) with something like <groovy> println
step.context.currentResponse.asXml()
</groovy>

Marc.
--
Blog: http://mguillem.wordpress.com


Soula, William wrote:
> 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="Submit" label="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="//[EMAIL PROTECTED]'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.
>  
>  
> <!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="Content-Type" content="text/html;
charset=iso-8859-1">
>  
>   <link href="/css/SNMstylesheet.css" rel="stylesheet"
type="text/css">
>   <link href="/css/SNMPrintstylesheet.css" rel="stylesheet"
> type="text/css" media="print">
>   <link href="/js/calendar-win2k-cold-1.css" rel="stylesheet"
> type="text/css">
>   <script src="/js/util.js" type="text/javascript"></script>
>   <script src="/js/sort.js" type="text/javascript"></script>
>   <script src="/js/tooltip.js" type="text/javascript"></script>
>   <script src="/js/calendar.js" type="text/javascript"></script>
>   <script src="/js/calendar-en.js" type="text/javascript"></script>
>   <script src="/js/calendar-setup.js" type="text/javascript"></script>
>   <script src="/js/calendar-util.js" type="text/javascript"></script>
>   <script src="/js/validations.js" type="text/javascript"></script>
>   <script src="/js/hashtable.js" type="text/javascript"></script>
>   <script src="/js/RoboHelp_CSH.js" type="text/javascript"></script>
>  
>   <!-- insert head -->
>  
>     <script type="text/javascript">
>     function searchPostalCodes() {
>       var postalCodeSelectForm =
document.forms["postalCodeSelectForm"];
>       postalCodeSelectForm.submit();
>     }
>     function add() {
>       var tableElement = document.getElementById('postalCodeTable');
>       var postalCodesArray = new Array();
>      
>       for (var i = 1; i < tableElement.rows.length; i++) {
>         if (document.getElementById('postalCodeSelect' + i).checked) {
>           var postalCodeArray = new
> Array(document.getElementById('postalCode' + i).value,
>                                          
> document.getElementById('postalCodeCity' + i).value,
>                                          
> document.getElementById('postalCodeState' + i).value);
>           postalCodesArray.push(postalCodeArray);
>         }
>       }
>      
>       window.opener.addPostalCodes(postalCodesArray);
>       window.opener.focus();
>       window.close();
>     }
>     </script>
>  
>   <!-- end insert head -->
>   <script type="text/javascript">
>   function packHeight() {
>     // note that adjusting the width is problematic because it can
cause
> things to wrap that shouldn't
>     var dialogFrame = document.getElementById("dialogFrame");
>    
>   }
>   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>
>  
> <body class="dialogBody" onload="onloadPopup(1798000);packHeight();">
>  <div id="dialogFrame">
>   
>    <div id="dialog_masthead">
>     <img class="logo" src="/images/masthead/ESObranding.gif" />
>    </div>
>   
>  
>   <div id="contentDialogContent">
>    <h1>Select Postal Codes</h1>
>        
>         <form action="/data/postalCodeSelect.do"
>              name="postalCodeSelectForm"
>                id="postalCodeSelectForm"
>                onsubmit="add(); return false;"
>                method="POST">
>         
>            <div class="dialogContent">
>             
>                  
>                 
>  
>     <table class="tuple">
>       <tr>
>         <th>Display Postal Codes Within:</th>
>         <td><select name="miles"><option value="5"
> selected="selected">5</option><option value="10">10</option><option
> value="15">15</option><option value="20">20</option><option
> value="25">25</option><option value="50">50</option><option
> value="75">75</option><option value="100">100</option></select>
>           miles of the Postal Code
>           <input name="postalCode" type="text" size="10" value="78703"
>
>         </td>
>       </tr>
>       <tr>
>       
>         <td>
>           <input type="button" class="button"
> onclick="searchPostalCodes();" value="Search" >
>         </td>
>       
>       </tr>
>     </table>
>    
>  
>                  
>                 
>  
>     <div id="areaHeading" ><h2>Postal Codes</h2></div>
>    
>       <table id="postalCodeTable"class="data">
>         <tr>
>           <th></th>
>           <th>Postal Code</th>
>           <th>City/Region</th>
>         </tr>
>        
>         <tr>
>           <td><input id="postalCodeSelect1" type="checkbox"
> value="checkbox" >
>           </td>
>           <td>
>             78746
>             <input id='postalCode1' type="hidden" value='78746' >
>           </td>
>           <td>
>             Austin, TX
>             <input id='postalCodeCity1' type="hidden" value='Austin' >
>             <input id='postalCodeState1' type="hidden" value='TX' >
>           </td>
>         </tr>
>        
>        
>       </table>
>     </div>
>    
>  
>           </div>
>             
>              <div class="dialogButtonBar">
>        <input type="submit" class="button" name="Submit" value="OK"
> onclick="">
>        <input type="button" class="button" name="Submit"
value="Cancel"
> onclick="window.close();">
>              </div>
>         </form>
>        </div>
>  </div>
> </body>
> </html>
>  
> 
>  
>  
> *William Soula*
> QA Analyst
>  
> *Pointserve, Inc.*
> 110 Wild Basin Road
> Suite 300
> Austin, Texas 78746
> O: 512.617.5311
> F: 512.617.0466
>  



_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest

Reply via email to