What is following-sibling in selenium?

0 votes
Jun 1, 2018 in Selenium by walter 123
• 240 points
7,708 views

2 answers to this question.

0 votes

Here, ul has 8 children(8-li) on total.

 And, each li has 7 more siblings(i.e brothers/sisters). Now, suppose you want to identify the 4th li where only first li can be identified uniquely. To identify the the 4th li we can proceed as follows:

Identifying the 1st li element, via the xpath

//li[@class='classroomlink hidden-xs hide']

if we want the identify the 4th li then if we proceed by giving slash after it i.e

//li[@class='classroomlink hidden-xs hide']/

Then it will look for the elements inside the li. And so it is not possible to navigate to the 4rd li.

Here we can make use of the following-sibling to identify our element by

//li[@class='classroomlink hidden-xs hide']/following-sibling::li[3]

answered Jun 1, 2018 by Vinita
• 220 points
Thank you so much... even basic level person can understand it.
Can you share any example to demonstrate following-sibling?
0 votes
Xpath=//*[@type='text']//following::input[2]
answered Sep 4 by Sri
• 2,970 points

Related Questions In Selenium

0 votes
2 answers

What is the role of TestNG & JUnit frameworks in Selenium?

TestNG and JUnit are test frameworks . it ...READ MORE

answered Sep 4 in Selenium by Sri
• 2,970 points
925 views
0 votes
2 answers

What is Page Object Model in Selenium WebDriver?

POM is one of design pattern. maintenance  should ...READ MORE

answered Sep 4 in Selenium by Sri
• 2,970 points
476 views
0 votes
2 answers
+1 vote
1 answer

What is locators used for in selenium?

Locator are used to find and match ...READ MORE

answered Dec 18, 2018 in Selenium by Nabarupa
132 views
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,520 points
4,012 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31 in Selenium by Sri
• 2,970 points
4,955 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,890 points
2,903 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 2 in Selenium by Sri
• 2,970 points
3,326 views
0 votes
2 answers
0 votes
1 answer

preceding-sibling in xpath, Selenium?

Here, ul has 8 children(8-li) on total.  And, ...READ MORE

answered Jun 1, 2018 in Selenium by Vinita
• 220 points
6,087 views