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

equivalence and boundary value

Understanding Equivalence Partitioning and Boundary Value Analysis in Software Testing

Software testing techniques help ensure software quality and reliability, by helping us select test cases intelligently from the collection of test cases, such that all test scenarios are covered.

Boundary Value Analysis and Equivalence Partitioning are two testing techniques that help testers select a subset of test cases that covers all important test scenarios, even under time and budget constraints. By testing all the equivalence classes and boundary values, testers can reduce the risk of releasing software with defects.

Read More »