
Twice now in recent weeks I’ve run into Xpaths.
XPath (XML Path Language) is an expression language for addressing portions of an XML document, or for computing values (strings, numbers, or boolean values) based on the content of an XML document.
Last night I was reading my new jQuery book and discovered how you could reference elements using the DOM as well as Xpaths.
The first time - I was using Selenium to code up some tests for an application and was trying to fill out a dynamically generated form - so I could not reliably use the form ID or the DOM as it would change each time I rebuilt the application. So I dug around and discovered XPath. But how to find the Xpath of an element? I dug around and discovered a great Firefox extension that allows you to easily find an elements Xpath:
XPather “Feature rich XPath generator, editor, inspector and simple extraction tool.”
This worked great and allowed me to build a test I could run repeatedly without having to worry about dynamic form IDs changing between tests. A great addition to the toolbox!

You May Also Enjoy Reading:
One Comment
This looks really cool. I actually just made a presentation today in the office about XPath and how powerful it is. This will be a great learning tool to help me flesh out my understanding. Thanks.