[prev in list] [next in list] [prev in thread] [next in thread] 

List:       htmlunit-user
Subject:    Re: [Htmlunit-user] xpath doesn't work (but works with xpath
From:       Ahmed Ashour <asashour () yahoo ! com>
Date:       2009-09-16 8:03:47
Message-ID: 933557.33226.qm () web112208 ! mail ! gq1 ! yahoo ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hello Velerio,

- HtmlUnit 2.6 is availabe in the official website and in maven [1].
- You case works with latest snapshot [2].

------------------------------
<a href="http://www.google.com/project/admin/?group_id">Hello</a>
------------------------------
final List hrefs = page.getByXPath("//a[contains(@href,'/project/admin/?group_id')]");
------------------------------


[1] http://repo1.maven.org/maven2/net/sourceforge/htmlunit/htmlunit/
[2] http://build.canoo.com/htmlunit/artifacts

Yours,
Ahmed----
Blog: http://asashour.blogspot.com 




________________________________
From: Valerio Schiavoni <valerio.schiavoni@gmail.com>
To: htmlunit-user@lists.sourceforge.net
Sent: Wednesday, September 16, 2009 12:19:41 AM
Subject: [Htmlunit-user] xpath doesn't work (but works with xpath checker)

Hello,
i'm trying to use the following xpath to find all the anchor elements
in the source page (in attachment, so that you can test yourself).

final List hrefs = summaryPage
                .getByXPath("//a[contains(@href,'/project/admin/?group_id')]");

This is reporting an empty list, which should not be the case.
Any idea?

I'm using htmlunit 2.4 (the latest I could find on a maven repository).

Thanks for any suggestion
valerio


      
[Attachment #5 (text/html)]

<html><head><style type="text/css"><!-- DIV {margin:0px;} \
--></style></head><body><div style="font-family:times new roman, new york, times, \
serif;font-size:12pt"><DIV></DIV> <DIV>Hello Velerio,</DIV>
<DIV>&nbsp;</DIV>
<DIV>- HtmlUnit 2.6 is availabe in the official website and in maven&nbsp;[1].</DIV>
<DIV>- You case works with latest snapshot [2].</DIV>
<DIV>&nbsp;</DIV>
<DIV>------------------------------</DIV>
<DIV>&lt;a href="<A href='http://www.google.com/project/admin/?group_id">Hello</a'>http://www.google.com/project/admin/?group_id"&gt;Hello&lt;/a</A>&gt;</DIV>
 <DIV>------------------------------</DIV>
<DIV>final List hrefs = \
page.getByXPath("//a[contains(@href,'/project/admin/?group_id')]");</DIV> <DIV>
<DIV>------------------------------</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV></DIV>
<DIV>[1] <A href="http://repo1.maven.org/maven2/net/sourceforge/htmlunit/htmlunit/">http://repo1.maven.org/maven2/net/sourceforge/htmlunit/htmlunit/</A><BR>[2] \
<A href="http://build.canoo.com/htmlunit/artifacts">http://build.canoo.com/htmlunit/artifacts</A></DIV>
 <DIV>&nbsp;</DIV>
<DIV>Yours,</DIV>
<DIV>Ahmed</DIV>----<BR>Blog: http://asashour.blogspot.com 
<DIV><BR></DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: \
12pt"><BR> <DIV style="FONT-FAMILY: times new roman, new york, times, serif; \
FONT-SIZE: 12pt"><FONT size=2 face=Tahoma> <HR SIZE=1>
<B><SPAN style="FONT-WEIGHT: bold">From:</SPAN></B> Valerio Schiavoni \
&lt;valerio.schiavoni@gmail.com&gt;<BR><B><SPAN style="FONT-WEIGHT: \
bold">To:</SPAN></B> htmlunit-user@lists.sourceforge.net<BR><B><SPAN \
style="FONT-WEIGHT: bold">Sent:</SPAN></B> Wednesday, September 16, 2009 12:19:41 \
AM<BR><B><SPAN style="FONT-WEIGHT: bold">Subject:</SPAN></B> [Htmlunit-user] xpath \
doesn't work (but works with xpath checker)<BR></FONT><BR>Hello,<BR>i'm trying to use \
the following xpath to find all the anchor elements<BR>in the source page (in \
attachment, so that you can test yourself).<BR><BR>final List hrefs = \
summaryPage<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; \
&nbsp;&nbsp;&nbsp; .getByXPath("//a[contains(@href,'/project/admin/?group_id')]");<BR><BR>This \
is reporting an empty list, which should not be the case.<BR>Any idea?<BR><BR>I'm \
using htmlunit 2.4 (the latest I could find on a maven repository).<BR><BR>Thanks for \
any  suggestion<BR>valerio</DIV></DIV></div><br>

      </body></html>



------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf

_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/htmlunit-user


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic