DEV Community

loading...
Cover image for Find Multiple Elements | Selenium Python Tutorial

Find Multiple Elements | Selenium Python Tutorial

Dilpreet Johal
Begin your Test Automation journey today! Check out my YouTube channel @AutomationBro.
・2 min read

During browser automation, you’ll often run into scenarios where you will need to work with multiple elements such as when dealing with menu links lists, dropdown lists, etc… In this tutorial, we will cover how to find multiple elements in Selenium Python using the SeleniumBase framework.

Test Scenario

Get the text of all the menu link items below and assert the value.

test_scanario

Test Solution

Since we are working with multiple menu links, we will need to loop through all the list items. However, before that, we need to get access to all the elements first and we can do that using the find_elements method.

Code1

Once, we have access to all the elements, we can do a regular for loop and assert the value of the elements.

Code2


Check out the video below to learn how to work with multiple elements in Selenium Python –


📧 Subscribe to my mailing list to get access to more content like this

👍 Follow automationbro on Twitter for the latest updates

...

I love coffees! And, if this post helped you out and you would like to support my work, you can do that by clicking on the button below and buying me a cup of coffee -

Buy me a coffee

You can also support me by liking and sharing this content.

Thanks for reading!

Discussion (0)

Forem Open with the Forem app