XPath Technique for finding parent element using child element's property



Xpath element locator is used for finding unique list element(parent) with the help of its child element may be down any level from parent.
Refer to attached Screenshot .We want to find parent row element, which has a child hyperlink with text ‘sed’ down somewhere in parent row.*first create path for child hyperlink element//a[@class=’item-name-link’ and contains(text(),’sed’)]*
Now create xpath for parent list element which are multiple in nature.//div[@class=’file-list-item-wrapper’]*Now create unique xpath for parent list element by joining two attributes as mentioned below 
//div[@class=’file-list-item-wrapper’ and .//a[@class=’item-name-link’ and contains(text(),’sed’)]]
**Note:- “.//” denotes that child element is located somewhere below in the hierarchy of parent element..
***************************************************************************************
QACult Best Software Testing Courses in Chandigarh tricity.- We love to enhance your knowledge.
QACult is the premier institute catering to the requirements of experienced and fresh pass-out that gives leaders like you a new way to experience Quality engineering—while you work and giving you the flexibility to both advance your career.
Our faculty have 12+ years of industrial experience and have developed many automation testing frameworks in java using TestNG or BDD (cucumber) methodology. We expertise in developing automation testing frameworks in java, python, javascript, php, ruby(WATIR-webdriver & Capybara) and Appium.
please subscribe our channel for more such updates:  
And visit for website: www.qacult.com for various blogs and Upcoming Events.

Comments

Popular posts from this blog

Robot Framework With Python: An Open Source Framework For RPA

Robot Framework in python with RIDE

How to do copy Paste in browser using selenium using Actions class