Xpath 9.00AM
Xpath 9.00AM
======
XML Path
Types:
======
1.Absolute Xpath(/) ----> it is taken from root to desireded tagName(down strom)
2.Relative Xpath(//) ----> it directly taken from desireded tagName
functionality:
==============
1.attribute xpath:
==================
//tagName[@attribute='attributeValue']
2.index xpath:
==============
(//tagName[@attribute='attributeValue'])[index]
3.Text xpath:
=============
//tagName[text()='textValue']
6.Starts-with(attribute):
========================
//tagName[starts-with(@attribute,'starting attribute value')]
Example://input[starts-with(@id,'e')]
7.Starts-with(text):
====================
//tagName[starts-with(text(),'staring text')]
8.And
=====
//input[@attributeName='att value' and @attributeName='att value']
9.Or:
=====
//input[@attributeName='att value' or @attributeName='att value']
Example://input[@id='email' or @name='email']
10.Unknown tagName:
===================
//*[@attributeName='attributeValue']
Example://*[@id='email']
11.Parent:
==========
//<knownXapth>//parent::elementName
Example://input[@id='email']//parent::div
12.Following Sibling:
=====================
//<xpathofknownElement>//following-sibling::<elementName>
Example://input[@name='login_source']//following-sibling::input
13.Preceding Sibling:
=====================
//<xpathofknownElement>//preceding-sibling::<elementName>
Example://input[@name='next']//preceding-sibling::input
14.Child:
=========
//<knownXapth>//child::elementName
Example://div[@id='passContainer']//child::input
15.ancestor:
============
//<xpathofknownElement>//ancestor::<elementName>
Example://input[@id='email']//ancestor::div