Posts

Showing posts from March 4, 2020

Understanding XPath

Image
Following my latest article "CssSelectors not only for styling"  many people asked me about the difference between using CssSelector and XPath, and what are the benefits to using XPath as a locator. Sadly, I see many engineers struggling to identify an element by using other selectors, find themselves blindly copying a WebElement's XPath using the option provided by the browser. The deal is that the expression received is mostly highly flaky and ugly none the less. In this article, I'm going to cover this topic and see if we can demystify XPath and make it more accessible. What is XPath? XPath stands for XML Path Language. It is basically a Quarry language that was originally made for selecting nodes from an XML document that was defined by the W3C. XPath can be used for XML schemes and also in many programming languages (Such as Java, Python, PHP, and even C). How is it related to Test Automation? XPath is one of the 8 locating methods (9 if you count rel