Home > Xpath

Finding elements of table in selenium

Elements in table can be accessed using xpath. Here is the sample HTML code: [crayon-673714a6a2f73837943057/] To locate first “td” in first “tr” in above HTML code. Below is the xpath:   //table//tr[1]/td[1] To locate second “td” in first “tr”. Below is the xpath. //table//tr[1]/td[2] To locate cells of Pune and Mumbai below is the xpath. //table//tr[1]/td To locate the

This Article is TAGGED in , . Read more

Different ways to create Xpath for a single Web element

Please find list of ways by using which we can create xpath to identify WebElement in the DOM. Here we have mentioned 15 different xpath for single web element (Society Name) from https://www.societyhive.com   //input[@id='txtSocietyName'] //input[@id='txtSocietyName' and @name='societyName']  //input[@id='txtSocietyName' or @name='societyName'] ---Toggle switch //span[text()='Please enter society name']//preceding-sibling::input --------Use of text() method //span[.='Please enter society name']//preceding-sibling::input -----Functionality of

This Article is TAGGED in , . Read more

Write xpath using text and text functions in selenium?

Write Xpath using element text and string functions. Information for this section  Symbols used while Xpath creation ./ (period symbol and forward slash)      → Current element /* (forward slash and asterisk symbol)   → All child element of current element .. (double period symbol)                          → Immediate parent

This Article is TAGGED in , , , . Read more

Write xpath using attribute and tag name in Selenium

Xpath Basic Information Xpath is a language and used to find targeted web element within html document. Types of Xpath Absolute Xpath: Path from root element to targeted element without missing any elements in between. Absolute xpath could be form by using '/' (single forward slash) and '[index]' (square bracket with index). Example: To locate <input>

This Article is TAGGED in , , , . Read more