How to Handle Bootstrap Dropdown in Selenium WebDriver

Have u ever heard about handle Bootstrap dropdown in Selenium? If no, then today you will learn 2 new things today.

First one – What is bootstrap dropdown

The second one- How to Select values from the bootstrap dropdown.

 

We already have discussed how to work with traditional dropdowns and we have also explored multiple ways to handle the same but today we will see how to work with Boot Strap dropdown.

The bootstrap dropdown is enhanced part of dropdown where you will deal with UL and LI tag of HTML.

 

An example of Bootstrap dropdown is below.

handle BootStrap dropdown in Selenium

 

To handle this kind of drop-down we have to use findElements method and then we can run a for loop to get specific elements.

           Handle BootStrap Login/Popup window in Selenium

YouTube video for Handle Bootstrap Dropdown in Selenium

 

Complete program to handle bootstrap dropdown in Selenium Webdriver

 

 

You can also select the values directly using xpath  and CSS but that approach is not recommended because direct xpath might change.

In above approach, we can pass a parameter directly so based on test data it will select the values from the list.

Hope you liked above article if yes then comment below and share with your friends.

2 Comments

  1. Shashi

Leave a Reply