1

I am working on a project in which automation is done using Appium Tool. I felt it difficult to track the XPath of an Image or Textbox in Eclipse while scripting. Sometimes the XPath will be given as a Trial and Error method.

So is there any way to track the XPath easily or wisely from Eclipse?

3
  • Just an additional note if you are going to be using xpath a lot, XPath abbreviated syntax will help you keep your code cleaner: w3.org/TR/xpath-30/#abbrev Commented Dec 11, 2013 at 19:33
  • You seem to be only getting answers about Firefox. I don't use Eclipse. I turned up a few things like gibert.jp.free.fr/projects/eclipse/plugins/xpathfinder on searching, but as I haven't used them can't evaluate them.
    – testerab
    Commented Dec 22, 2013 at 10:20
  • All above way are representing the way to find out Xpath of webpage elements. How to find the xpath of element on real mobile device connected?
    – user6942
    Commented Feb 8, 2014 at 11:50

6 Answers 6

3

You can press F12 key in chrome and right click on the element you want to get and click on inspect element. Now you shall see the console with corresponding attributes,Now right click at the console will give you required xpath.

Also Firebug an adddon of mozilla is helpful

2

Try to use Firebug + Firepath plugins for Mozilla Firefox. It makes getting locators easier.

1
  • 5
    I think the OP is specifically looking for something in Eclipse.
    – corsiKa
    Commented Oct 23, 2013 at 15:51
1

You can use xpath finder - Firefox plugin!!! Just right click on the element and select "View xpath".

3
  • 1
    Senthil you mentioned that is a Firefox plugin but the question specifically asked for an Eclipse solution. Is Xpath Finder available in Eclipse?
    – Francis
    Commented Dec 12, 2013 at 18:36
  • Senthil - can you expand on this answer a little bit. Perhaps include a screen shot or and example of what you get out of it?
    – Dan Snell
    Commented Dec 21, 2013 at 20:12
  • 1
    Hi @Senthil, welcome to SQA. I agree with Francis, the question is quite specific about Eclipse (and there are plugins for Eclipse specifically).
    – testerab
    Commented Dec 22, 2013 at 10:24
1

Generally speaking, you won't use Eclipse directly for a task like this. If you are writing automated tests using a tool like Appium or Selenium, you will likely want to open the app under test in a mainstream browser such as Chrome or Firefox. Firefox seems to be the more popular choice for development/testing, so I'd recommend that.

If you are testing a mobile web app, I'd still recommend opening it up in a desktop browser using Firefox since the tools are pretty good already. You can run tests in whatever environment makes sense, but you should consider developing tests using a mainstream browser like Firefox or Chrome.

To identify elements you would like to locate using xpath queries or otherwise, use the Firebug extension as noted in other answers.

0

I recommend firefinder with firebug. Because firepath in some cases follows universal selector, That is not time efficient.

1
  • I am using appium tool for automating a mobile application.So is it possible to get the x-path of an element from Firebug for a Mobile Application?
    – Baburaj V
    Commented Oct 24, 2013 at 4:37
0

enter image description here

Landed here when looking for the answer but figured out myself and thought someone would benefit.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.