Menu

#2 HttpUnit XPath tags

2.0.1
open
6
2005-10-13
2004-06-23
No

Hi,

I'm using Jameleon quite a lot, and I find it very useful!!.
Here I'm also
sending attached a couple of classes that made my life
much easier, and
basically apply an XPath expression to the document,
and stores the
matching nodes in an ArrayList, in the Jelly context.
Then with the other
classes provided in the same .ZIP you can validate there
are results in
the ArrayList, select a value of the ArrayList and store it
in a variable,
and finally click on the link matching the variable text.
For the XPath class, you'll need the Neko parser/jar,
because the DOM of
HttpUnit didn't work alright for me.
Here I send an example of how to use the classes, if
you find it useful
and want a bigger/better explanation, I can write it.

<lm:html-unit-apply-xpath
functionId="Selecting gifts"
xpathExpression="//A[contains(text(),'more info')]/@href"
resultsVariableName="results"/>

<lm:html-unit-validate-results-size
functionId="Validating there are gifts"
variableName="results"
greaterThan="0"/>

<lm:select-value
functionId="Selecting a random result"
sourceListName="results"
destinationVariableName="singleResult"
type="random"/>

<lm:click-on-variable-link
functionId="Click on the random link selected in the last
step"
variableName="singleResult"/>

With these tags you can validate almost anything, I use
it for clicking on
search results for example.
I hope this can help you, maybe you can add them to
the basic classes
provided with Jameleon.

Cheers,
Sebastian Gavarini.

Discussion

  • Christian Hargraves

    XPath Patch - Original Files in Zip Format

     
  • Christian Hargraves

    Some nice docs on this patch.

     
  • Christian Hargraves

    • summary: XPath tags --> HttpUnit XPath tags
     
  • Prabhat

    Prabhat - 2006-11-10

    Logged In: YES
    user_id=1637577

    Hi Sebastian,

    I am still confused of how to use this. Can u plz elaborate this...

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.