What is following-sibling in selenium?

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

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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

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,590 points
130 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,400 points
64 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
22 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,030 points
77 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
449 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
57 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
53 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
994 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.