What is following-sibling in selenium

0 votes
Jun 1, 2018 in Selenium by walter 123
• 240 points
11,737 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, 2020 by Sri
• 3,190 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, 2020 in Selenium by Sri
• 3,190 points
2,844 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, 2020 in Selenium by Sri
• 3,190 points
1,399 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
747 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,500 points
13,567 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

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

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,084 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,910 points
7,178 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 3, 2020 in Selenium by Sri
• 3,190 points
7,840 views
0 votes
2 answers

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

some of the controls not have id ...READ MORE

answered Sep 4, 2020 in Selenium by Sri
• 3,190 points
1,768 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
14,259 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP