Xpath is same across all browsers

Hi Team,
I copied Xpath using chrome dev tool.
If I want to test my application for cross Browser compatibility:

  1. Does Xpath value is same across all browsers like chrome, ie , Mozilla, Firefox etc?
  2. what is the best method to capture Xpath for web element which will work across all browsers?
  3. what is the best method to capture Xpath for dynamic web elements?

Please advice

All browsers are compliant to the XPath 1.0 specification. The XPath 1.0 specification is published here: XML Path Language (XPath)

A concrete and valid XPath expression string in a browser must be valid in other browsers as well, because all of them are compliant to the same W3C Recommendation.

This question does not make good sense, as a concrete XPath expression against a concrete HTML document must have same validity across all browsers. Chrome DevTools is super, no doubt, used by many developers.

This is a frequently asked question. Try searching this forum with key “dynamic id” first. You will find many previous discussions. If you read them through, you would certainly get at a loss what to do. The fact is, there is no single silver bullet.

If you want to manipulate dynamic elements using XPath, you need to study the XPath technology itself and train yourself to be capable of writing expressions manually. A Good tutorial is here

If you are to raise in this forum a question for a useful Xpath to select dynamic web elements in your particular web page, you should provide enough information, which includes

  1. A Screenshot of your web page, highlighting which part you want to select
  2. full HTML source code of your web page, highlighting which element you want to select