[Webtest] Am I using XPATH correctly?

webtest@lists.canoo.com webtest@lists.canoo.com
Thu, 13 Jul 2006 16:43:32 -0400


----------MailBlocks_8C874D42360F63D_15B4_66E9_FWM-R15.sysops.aol.com
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit

Sorry Mittie and Paul,
 
Relaxing the XPATH - worked!
 
Thanks for your help - never would have figured that out myself.
 
Doug
 
 
-----Original Message-----
From: paulk@asert.com.au
To: webtest@gate2.canoo.com
Sent: Thu, 13 Jul 2006 2:06 PM
Subject: Re: [Webtest] Am I using XPATH correctly?


Did relaxing the XPath to ignore the incorrect parts of 
the HTML work? 
 
Cheers, Paul. 
 
dlundin@aol.com wrote: 
> Mittie, 
> > I don't have any way of modifying the html code ... is there anything > else I can do? 
> > Thanks 
> Doug > > -----Original Message----- 
> From: dierk.koenig@canoo.com 
> To: webtest@lists.canoo.com 
> Sent: Thu, 13 Jul 2006 12:05 PM 
> Subject: RE: [Webtest] Am I using XPATH correctly? 
> > Hi, 
> > your html code isn't fully correct. It misses a tbody elements to > enclose the tr tabs. 
> The browsers don't mind but the html parser that comes with htmlunit > puts those missing elements in the dom. 
> You may profit from relaxing your your XPATH a bit like 
> string(//div[@id='etContent']/form//tr[1]/td[2]//b[1]) 
> that also makes it easier to maintain 
> > Xpath engines differ slightly between stylus, XPE, and HtmlUnit but this > is unlikely to be the source of your problem. 
> > cheers 
> Mittie 
> > -----Original Message----- 
> *From:* webtest-admin@lists.canoo.com 
> [mailto:webtest-admin@lists.canoo.com]*On Behalf Of *dlundin@aol.com 
> *Sent:* Donnerstag, 13. Juli 2006 19:12 
> *To:* webtest@lists.canoo.com 
> *Subject:* [Webtest] Am I using XPATH correctly? 
> > Hello all, 
> > I have a webpage I am trying to use WebTest/XPATH to extract a 
> value. I've cut-and-pasted the html in this post. I've confirmed the 
> XPATH is correct using XPATH Explorer and Stylus tools. 
> > Here are some things I've seen: 
> - The value I'm trying to grab is within a bold tag 
> - The value is preceeded and succeeded by embedded tab characters (I 
> can't change) 
> > Here's the XPATH (I've also removed the string function and given an 
> absolute path - no change): 
> string(//div[@id='etContent']/form[1]/table[1]/tr[2]/td[2]/div[1]/table[1]/tr[1]/td[1]/table[2]/tr[1]/td[1]/table[1]/tr[1]/td[2]/font[1]/b[1]) 
> > My WebTest script does not report an error but, instead, appears to 
> show a blank value (could this be the result of the tab?) 
> > Is this an XPATH 1.0 vs. 2.0 issue? Does WebTest use XPATH 1.0 or 2.0? 
> > I'm stumped - help, please. 
> > Thanks 
> > > ----------------- 
> <table border="0" cellpadding="3" cellspacing="1" width=100% 
> bgcolor="#999999"> 
> <tr> 
> <td bgcolor="#cccccc" height="30"><b>Last<br>Price</b></td> 
> <td nowrap bgcolor="#ffffcc"><font size="3"><b> 
> > > > > > 14.20 
> > > > > > </b></font> 
> </td> 
> > > --------------------- 
> ------------------------------------------------------------------------ 
> *Check out AOL.com today* 
> <http://pr.atwola.com/promoclk/1615326657x4311227241x4298082137/aol?redir=http%3A%2F%2Fwww%2Eaol%2Ecom>. 
> Breaking news, video search, pictures, email and IM. All on demand. 
> Always Free. 
>  
_______________________________________________ 
WebTest mailing list 
WebTest@lists.canoo.com 
http://lists.canoo.com/mailman/listinfo/webtest 
________________________________________________________________________
Check out AOL.com today. Breaking news, video search, pictures, email and IM. All on demand. Always Free.

----------MailBlocks_8C874D42360F63D_15B4_66E9_FWM-R15.sysops.aol.com
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: 7bit

<HTML><BODY>
<div>Sorry Mittie and Paul,</div>


<div>&nbsp;</div>


<div>Relaxing the XPATH - worked!</div>


<div>&nbsp;</div>


<div>Thanks for your help - never would have figured that out myself.</div>


<div>&nbsp;</div>


<div>Doug</div>


<div>&nbsp;</div>
&nbsp;<br>
-----Original Message-----<br>
From: paulk@asert.com.au<br>
To: webtest@gate2.canoo.com<br>
Sent: Thu, 13 Jul 2006 2:06 PM<br>
Subject: Re: [Webtest] Am I using XPATH correctly?<br>
<br>

<STYLE>
.AOLPlainTextBody {
    margin: 0px;
    font-family: Tahoma, Verdana, Arial, Sans-Serif;
    font-size: 12px; 
    color: #000; 
    background-color: #fff; 
}

.AOLPlainTextBody pre {
    font-size: 9pt;
}

.AOLInlineAttachment {
    margin: 10px;
}

.AOLAttachmentHeader {
    font: 11px arial;
    border: 1px solid #7DA8D4;
    background: #F9F9F9;
}

.AOLAttachmentHeader .Title {
    font: 11px arial;
    background: #B5DDFA;
    padding: 3px 3px 3px 3px;
}

.AOLAttachmentHeader .FieldLabel {
    font: 11px arial; 
    color: #000000;
    padding: 1px 10px 1px 9px;
    background: #F9F9F9;
}

.AOLAttachmentHeader .FieldValue {
    font: 11px arial; 
    color: #000000;
    background: #F9F9F9;
}

.AOLAttachmentHeader a, .AOLImage a {
    color: #2864B4;
    text-decoration: none;
}

.AOLAttachmentHeader a:hover, .AOLImage a:hover {
    color: #2864B4;
    text-decoration: underline;
}

body {
    background-color: white;
    font-family: "Verdana";
    font-size: 10pt;
    border: 0px;
}

.spell {
    padding-bottom:2px;
    background:yellow url(images/bg_spellingErr.gif) bottom left repeat-x;
    color:#000;
}

.spellHover {
    text-decoration:none;
    color:#b00;
    padding-bottom:2px;
    background:yellow url(images/bg_spellingErr.gif) bottom left repeat-x;
}

p {
    margin: 0px;
    padding: 0px;
}

img.managedImg {
    width: 0px;
    height: 0px;
}

img.placeholder {
    width: 275px;
    height: 206px;
    background: #F4F4F4 url(images/activityIndicator.gif) center center no-repeat;
    border: 1px solid #DADAD6 !important;  
}

</STYLE>


<div class=AOLPlainTextBody id=AOLMsgPart_0_3c53105e-b38e-446a-b96d-38e9dff7c4dd>Did relaxing the XPath to ignore the incorrect parts of&nbsp;<br>
the HTML work?&nbsp;<br>
&nbsp;<br>
Cheers, Paul.&nbsp;<br>
&nbsp;<br>
<A href="mailto:dlundin%40aol.com">dlundin@aol.com</A> wrote:&nbsp;<br>
&gt; Mittie,&nbsp;<br>
&gt; &gt; I don't have any way of modifying the html code ... is there anything &gt; else I can do?&nbsp;<br>
&gt; &gt; Thanks&nbsp;<br>
&gt; Doug &gt; &gt; -----Original Message-----&nbsp;<br>
&gt; From: <A href="mailto:dierk.koenig%40canoo.com">dierk.koenig@canoo.com</A>&nbsp;<br>
&gt; To: <A href="mailto:webtest%40lists.canoo.com">webtest@lists.canoo.com</A>&nbsp;<br>
&gt; Sent: Thu, 13 Jul 2006 12:05 PM&nbsp;<br>
&gt; Subject: RE: [Webtest] Am I using XPATH correctly?&nbsp;<br>
&gt; &gt; Hi,&nbsp;<br>
&gt; &gt; your html code isn't fully correct. It misses a tbody elements to &gt; enclose the tr tabs.&nbsp;<br>
&gt; The browsers don't mind but the html parser that comes with htmlunit &gt; puts those missing elements in the dom.&nbsp;<br>
&gt; You may profit from relaxing your your XPATH a bit like&nbsp;<br>
&gt; string(//div[@id='etContent']/form//tr[1]/td[2]//b[1])&nbsp;<br>
&gt; that also makes it easier to maintain&nbsp;<br>
&gt; &gt; Xpath engines differ slightly between stylus, XPE, and HtmlUnit but this &gt; is unlikely to be the source of your problem.&nbsp;<br>
&gt; &gt; cheers&nbsp;<br>
&gt; Mittie&nbsp;<br>
&gt; &gt; -----Original Message-----&nbsp;<br>
&gt; *From:* <A href="mailto:webtest-admin%40lists.canoo.com">webtest-admin@lists.canoo.com</A>&nbsp;<br>
&gt; [<A href="mailto:webtest-admin%40lists.canoo.com%5d*On">mailto:webtest-admin@lists.canoo.com]*On</A> Behalf Of *<A href="mailto:dlundin%40aol.com">dlundin@aol.com</A>&nbsp;<br>
&gt; *Sent:* Donnerstag, 13. Juli 2006 19:12&nbsp;<br>
&gt; *To:* <A href="mailto:webtest%40lists.canoo.com">webtest@lists.canoo.com</A>&nbsp;<br>
&gt; *Subject:* [Webtest] Am I using XPATH correctly?&nbsp;<br>
&gt; &gt; Hello all,&nbsp;<br>
&gt; &gt; I have a webpage I am trying to use WebTest/XPATH to extract a&nbsp;<br>
&gt; value. I've cut-and-pasted the html in this post. I've confirmed the&nbsp;<br>
&gt; XPATH is correct using XPATH Explorer and Stylus tools.&nbsp;<br>
&gt; &gt; Here are some things I've seen:&nbsp;<br>
&gt; - The value I'm trying to grab is within a bold tag&nbsp;<br>
&gt; - The value is preceeded and succeeded by embedded tab characters (I&nbsp;<br>
&gt; can't change)&nbsp;<br>
&gt; &gt; Here's the XPATH (I've also removed the string function and given an&nbsp;<br>
&gt; absolute path - no change):&nbsp;<br>
&gt; string(//div[@id='etContent']/form[1]/table[1]/tr[2]/td[2]/div[1]/table[1]/tr[1]/td[1]/table[2]/tr[1]/td[1]/table[1]/tr[1]/td[2]/font[1]/b[1])&nbsp;<br>
&gt; &gt; My WebTest script does not report an error but, instead, appears to&nbsp;<br>
&gt; show a blank value (could this be the result of the tab?)&nbsp;<br>
&gt; &gt; Is this an XPATH 1.0 vs. 2.0 issue? Does WebTest use XPATH 1.0 or 2.0?&nbsp;<br>
&gt; &gt; I'm stumped - help, please.&nbsp;<br>
&gt; &gt; Thanks&nbsp;<br>
&gt; &gt; &gt; -----------------&nbsp;<br>
&gt; &lt;table border="0" cellpadding="3" cellspacing="1" width=100%&nbsp;<br>
&gt; bgcolor="#999999"&gt;&nbsp;<br>
&gt; &lt;tr&gt;&nbsp;<br>
&gt; &lt;td bgcolor="#cccccc" height="30"&gt;&lt;b&gt;Last&lt;br&gt;Price&lt;/b&gt;&lt;/td&gt;&nbsp;<br>
&gt; &lt;td nowrap bgcolor="#ffffcc"&gt;&lt;font size="3"&gt;&lt;b&gt;&nbsp;<br>
&gt; &gt; &gt; &gt; &gt; &gt; 14.20&nbsp;<br>
&gt; &gt; &gt; &gt; &gt; &gt; &lt;/b&gt;&lt;/font&gt;&nbsp;<br>
&gt; &lt;/td&gt;&nbsp;<br>
&gt; &gt; &gt; ---------------------&nbsp;<br>
&gt; ------------------------------------------------------------------------&nbsp;<br>
&gt; *Check out AOL.com today*&nbsp;<br>
&gt; &lt;<A href="http://pr.atwola.com/promoclk/1615326657x4311227241x4298082137/aol?redir=http%3A%2F%2Fwww%2Eaol%2Ecom" target=_blank>http://pr.atwola.com/promoclk/1615326657x4311227241x4298082137/aol?redir=http%3A%2F%2Fwww%2Eaol%2Ecom</A>&gt;.&nbsp;<br>
&gt; Breaking news, video search, pictures, email and IM. All on demand.&nbsp;<br>
&gt; Always Free.&nbsp;<br>
&gt; &nbsp;<br>
_______________________________________________&nbsp;<br>
WebTest mailing list&nbsp;<br>
<A href="mailto:WebTest%40lists.canoo.com">WebTest@lists.canoo.com</A>&nbsp;<br>
<A href="http://lists.canoo.com/mailman/listinfo/webtest" target=_blank>http://lists.canoo.com/mailman/listinfo/webtest</A>&nbsp;<br>
</div>
<!-- end of AOLMsgPart_0_3c53105e-b38e-446a-b96d-38e9dff7c4dd -->
<div class="AOLPromoFooter">
<hr style="margin-top:10px;" />
<a href="http://pr.atwola.com/promoclk/1615326657x4311227241x4298082137/aol?redir=http%3A%2F%2Fwww%2Eaol%2Ecom" target="_blank"><b>Check out AOL.com today</b></a>. Breaking news, video search, pictures, email and IM. All on demand. Always Free.<br />
</div>

</BODY></HTML>

----------MailBlocks_8C874D42360F63D_15B4_66E9_FWM-R15.sysops.aol.com--