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