SDET Unicorns

Working with Elements | Selenide Tutorial Series

Table of Content

Hey guys! In this post, we will learn how to work with web elements using Selenide. We will look into different locator strategies such as find by ID, CSS Selector as well as XPath.

The $ command

All Selenide elements journey begins with the $ command. To work with any selector you will add $(selector) and then take any action on that selector such as .click or .setValue etc..

This is equivalent to doing driver.findElement(selector) for those of you that are familiar with Selenium Java.

Check out the video below to learn about how to work with elements in Selenide:

Find by ID

To find an element by ID in Selenide, you can do it using the


The above command will command will find an ID called “get-started” in the DOM and then perform a click action on it.

Find by CSS Selector

By default with Selenide, any string you add in the selector, it will consider that as a CSS Selector. For example –

.shouldHave(text("Think different. Make different."));

With CSS Selector, you do not need to provide By.something which makes working with css selectors quite easy.

Find by XPath

XPath works similarly to ID, you need to specify that you are trying to find element by xpath like this –


So these are the three most common strategies you will be using to find element in Selenide. Simply add in the $ command and provide the selector strategy after that and Selenide will take care of finding that element and returning that back to you.

Thanks for reading!

My Resources

Thrive Suite: The all-in-one WordPress theme I used to create my blog.
Jasper AI: My favorite AI writing tool.
Surfer SEO:  A tool to help you rank your content on the first page of Google.

Write Content Faster


Write blog posts that rank for affiliate terms!

Join our mailing list

Unlock the Secrets to Becoming a SDET Pro in the Industry!

Stay ahead of the curve! Join our mailing list for exclusive insights, tips, and the latest industry updates delivered straight to your inbox

Table of Content

Related Post

7 Principles of Software Testing

7 Principles of Software Testing with Examples

Software testing plays a crucial role in the software development life cycle as it helps ensure the quality, reliability, and performance of the final product. Software testing is not just about finding defects; it also provides valuable insights into the overall quality of the software. By conducting effective software testing, it shows how well the application behaves in different scenarios and whether it meets user expectations.

Read More »
Differences Between CI/CD and DevOps

Key Differences Between CI/CD and DevOps

Software development is far from a simple journey that involves merely executing code and launching applications. It often presents challenges, as it’s rare to get everything right from the start. Each time you implement new or frequent code changes, you inadvertently introduce potential issues that can be time-consuming to resolve. This complexity necessitates a structured approach to ensure smooth production.

Read More »