Did relaxing the XPath to ignore the incorrect parts of
the HTML work?

Cheers, Paul.

[EMAIL PROTECTED] 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: [EMAIL PROTECTED]
To: [email protected]
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(//[EMAIL PROTECTED]'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:* [EMAIL PROTECTED]
    [mailto:[EMAIL PROTECTED] Behalf Of [EMAIL PROTECTED]
    *Sent:* Donnerstag, 13. Juli 2006 19:12
    *To:* [email protected]
    *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(//[EMAIL 
PROTECTED]'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
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest

Reply via email to