开发者

Tool to find out XPath [closed]

As it currently s开发者_开发技巧tands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 10 years ago.

I find XPath difficult to get my head around at times and am looking for a tools that I can point at a line in an xml config file an it will tell me the xpath to the attributes that I need.

Any help with this would be much appreciated>


I've used the "Buba XPath builder" to do this. SketchPath (now XMLQuire) may also do the trick:

http://qutoric.com/xmlquire/


Visual XPath is full of win.


If you use firefox you might want to check out XPather. Even if you find another tool, this is a handy thing to have around when you just want to check something out quickly if you are like me and almost always have a browser window already open.


Xpather is the best tool to find the xpath.

http://xpath.alephzarro.com/


The Best tool is Firepath when it is installed over Firebug. You can easily find the Xpath using it. But it only works with Mozilla The Download link is: https://addons.mozilla.org/en-US/firefox/addon/firepath/ Or simply go to addons and click get extensions and type firepath.

You need to have firebug installed.


http://xpathvisualizer.codeplex.com/ is a nice tool.


I want to echo XPather as my tool of choice, although it's not yet (as far as I'm aware) available for the latest version of FF. In order to better learn XPath, XPather gives you two good benefits:

  1. You can tinker with the XPath in the window dialogue and see how it affects which elements are matched. In this way you can make your paths more general & slowly build on them but while making sure you're getting no false positives. This is how I learnt XPath.
  2. It has an in-built 'cheat sheet' of selectors you won't use that often, but you want to have to hand when you need them — sibling, parent, does not contain etc.

Most of the time in my work I find it's not important to find an XPath that matches, but the best match for what I'm looking for (most specific for speed, most general for flexibility and matching similar nodes).

Firebug itself will give you an exact XPath for an element, but it makes me think of writing automation tests in Selenium recorder — it's OK if you're targetting that particular node that will always be in that exact location on the page. Whereas you could be targeting an ad banner that you don't know the exact location of, but know it's rough whereabouts — the RHS column on every page, for instance. This often happens with a CMS backed site, if you're testing against a system that real content-editors are using too.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜