DEV Community

Cover image for Selenide Project & Test Setup
Dilpreet Johal
Dilpreet Johal

Posted on

Selenide Project & Test Setup

In this post, we will look at how to setup Selenide project in our machine and also how to setup our first test. One of the best parts about using Selenide is that you can get start with writing your first test in under 10 mins. Let’s take a look at that –


  • Java Installed
  • Any IDE of your preference: I will be using IntelliJ for this series

Check out the video below to learn how to Setup Selenide Project and Test –

Selenide Project Setup

To get started with Selenide, we will first create a new Maven project in the IDE. Once the project is created, we will need to do the following steps –

Add Dependencies to POM.xml –

  • Selenide:
Enter fullscreen mode Exit fullscreen mode
  • TestNG: testing framework
Enter fullscreen mode Exit fullscreen mode

That’s all you need in terms of setting up project. Rest, Selenide will take care of on its own.

Test Setup

Now, let’s create our first Selenide Test. To do that, simply create a new Java test file and add in the following code –

import com.codeborne.selenide.WebDriverRunner;
import org.testng.annotations.Test;
import static com.codeborne.selenide.Selenide.*;
import static org.testng.Assert.*;
public class HomeTest {
    public void testPageUrlAndTitle() {
        // Open page url

        // Assert the url matches 
        String url = WebDriverRunner.url();
        assertEquals(url, "");

        // Assert the title matches
        String title = title();
        assertEquals(title, "Practice E-Commerce Site – Automation Bro");
Enter fullscreen mode Exit fullscreen mode

In the test above, we are doing the following steps –

  • Importing all the necessary dependencies
  • Created a test method to verify the page url and the title
  • Open the page url using the in-built open method
  • Then assert the url and the title of the page

Run Selenide Test

To execute the test, you can run it via the maven test command – mvn test. Selenide will do the following –

  • Spin-up chromedriver
  • Start the test session
  • Execute the test
  • Stop the test session
  • Close the browser

You do not have to worry about setting up your driver or handling the opening/closing of the driver. All of this gets taken care of by Selenide and you can focus on writing beautiful tests.

Test Results

📧 Subscribe to my mailing list to get access to more content like this as well as be part of amazing free giveaways.

👍 You can follow my content here as well -


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

Discussion (0)