What is following-sibling in selenium?

0 votes
Jun 1, 2018 in Selenium by walter 123
• 240 points
2,177 views

1 answer 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?

Related Questions In Selenium

0 votes
1 answer

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

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

answered Apr 18, 2018 in Selenium by king_kenny
• 3,650 points
259 views
0 votes
1 answer

What is Page Object Model in Selenium WebDriver?

If you want to learn about Selenium ...READ MORE

answered Jun 14, 2018 in Selenium by Meci Matt
• 9,420 points
128 views
+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
38 views
0 votes
1 answer

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,090 points
554 views
0 votes
1 answer
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,130 points
888 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
550 views
0 votes
1 answer

what is the need of xpath when you have attributes like id ,class,name in selenium?

It is not necessary that every element ...READ MORE

answered Jun 1, 2018 in Selenium by Vinita
• 220 points
160 views
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
1,688 views