Posts

Showing posts with the label parent

Learning xpath concepts

Image
The very first step in the automation comes up with locating elements in a webpage to perform some operation. If you want to learn Selenium, then you must know different ways to locate an element using XPath. There are two types of Xpaths - Absolute XPath Relative XPath Absolute Xpath is taken from the root node of the webpage. It is not recommended to use in the automation scripts because web elements keep on changing and your script will require high maintenance if you use absolute XPath. It starts with a single slash. for example - /input[@name= 'username'] Relative XPath, on the other hand, is a dynamic XPath and can be started with any reference web element or text on the screen. It is the most useful and recommended method to use to locate the web element. It is started with a double slash, for example - //input[@name=' username'] Let's understand the XPath axes which can come in very handy to deal with complex web elements on a webpa...