---
title: Selenide
description: Learn how to integrate Allure with Selenide tests to capture browser actions as steps, screenshots, page source, and browser logs in your HTML report.
---

# Getting started with Allure Selenide

[![Allure Selenide latest version](https://img.shields.io/maven-central/v/io.qameta.allure/allure-selenide?style=flat "allure-selenide")](https://mvnrepository.com/artifact/io.qameta.allure/allure-selenide)

Generate beautiful HTML reports using [Allure Report](https://allurereport.org/) and your [Selenide](https://selenide.org/) tests.

## Setting up

Allure Selenide works alongside your test framework — set up [JUnit 5](/docs/junit5/) or [TestNG](/docs/testng/) first, then add the steps below.

This integration targets Selenide 7.x and requires Java 17 or newer.

To integrate Allure Selenide into your project, you need to:

1. Add Allure Selenide dependencies.
2. Register the listener.
3. Specify a location for Allure results storage.

### Add Allure dependencies

**Maven:**
```xml
<!-- Define the version of Allure you want to use via the allure.version property -->
<properties>
    <allure.version>VERSION</allure.version>
</properties>

<!-- Add allure-bom to dependency management to ensure correct versions of all the dependencies are used -->
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-bom</artifactId>
            <version>${allure.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<!-- Add necessary Allure dependencies to dependencies section -->
<dependencies>
    <dependency>
        <groupId>io.qameta.allure</groupId>
        <artifactId>allure-selenide</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>
```

**Gradle (Kotlin):**
```kts
val allureVersion = "VERSION"

dependencies {
    testImplementation(platform("io.qameta.allure:allure-bom:$allureVersion"))
    testImplementation("io.qameta.allure:allure-selenide")
}
```

**Gradle (Groovy):**
```groovy
def allureVersion = "VERSION"

dependencies {
    testImplementation platform("io.qameta.allure:allure-bom:$allureVersion")
    testImplementation "io.qameta.allure:allure-selenide"
}
```

### Register the listener

Register `AllureSelenide` as a Selenide listener before any browser actions run. The listener name (`"allure"`) is an identifier used by Selenide's listener registry and can be any string, as long as it is unique among registered listeners.

```java
import com.codeborne.selenide.logevents.SelenideLogger;
import io.qameta.allure.selenide.AllureSelenide;

SelenideLogger.addListener("allure", new AllureSelenide());
```

Register it once before your tests start — for example, in a JUnit 5 `@BeforeAll`, a TestNG `@BeforeSuite`, or a shared setup class:

```java
@BeforeAll
static void setUpAllure() {
    SelenideLogger.addListener("allure", new AllureSelenide());
}
```

Steps and artifacts are only recorded when there is an active Allure test context. Selenide actions that run outside of a test — for example, in a static initializer or before the test framework starts a test — are silently ignored.

### Specify Allure results location

Allure saves test results in the project's root directory by default. It is recommended to store results in the build output directory instead.

Create an `allure.properties` file in `src/test/resources`:

**Maven:**
```properties
allure.results.directory=target/allure-results
```

**Gradle (Kotlin):**
```properties
allure.results.directory=build/allure-results
```

**Gradle (Groovy):**
```properties
allure.results.directory=build/allure-results
```

### Generate a report

After running your tests, convert the results into an HTML report using one of these commands:

- `allure generate` processes the test results and saves an HTML report into the `allure-report` directory. To view the report, use the `allure open` command.

- `allure serve` creates the same report as `allure generate`, then automatically opens the main page of the report in a web browser.

## Selenide actions as steps

Once the listener is registered, Allure Selenide records every Selenide log event as a step in the test report. No additional code is required.

Step names are generated from Selenide's log events and include the element locator, action name, and any arguments. The exact format is determined by Selenide. A failed step gets `FAILED` status when the underlying exception is an assertion error, or `BROKEN` for any other exception.

Steps are nested under any enclosing Allure steps you define:

```java
Allure.step("Log in", () -> {
    $("#email").setValue("user@example.com");  // appears as a sub-step of "Log in"
    $("#password").setValue("secret");
    $(".login-btn").click();
});
```

By default, all Selenide log events are recorded as steps. To exclude Selenide's built-in element interaction steps (those of type `SelenideLog`) from the report, set `.includeSelenideSteps(false)` when registering the listener. Screenshots, page source, and browser logs are still captured on failure even when steps are excluded, and are attached to the enclosing Allure step or test. See [configuration](/docs/selenide-configuration/) for details.

## Capturing artifacts on failure

By default, when a Selenide step fails, Allure Selenide automatically captures artifacts and attaches them to that step in the report.

By default, the following are captured:

- **Screenshot** — a PNG image of the current browser state (`image/png`), attached with the name `Screenshot`.
- **Page source** — the current HTML of the page (`text/html`), attached with the name `Page source`.

By default, these are attached to the failing step rather than to the overall test result.

If the browser is not open at the time of failure — for example, when a step fails before the browser launches — no screenshot or page source is captured, and the step is still recorded with its failure status.

To disable either artifact, configure the listener when registering it:

```java
SelenideLogger.addListener("allure", new AllureSelenide()
        .screenshots(false)
        .savePageSource(false));
```

See [configuration](/docs/selenide-configuration/) for all available options.

## Browser logs

Allure Selenide can capture Selenium WebDriver browser logs and attach them to a failing step. Log capture is disabled by default and must be enabled explicitly for each log type you want to collect.

```java
import io.qameta.allure.selenide.LogType;
import java.util.logging.Level;

SelenideLogger.addListener("allure", new AllureSelenide()
        .enableLogs(LogType.BROWSER, Level.SEVERE));
```

Multiple log types can be enabled at once:

```java
SelenideLogger.addListener("allure", new AllureSelenide()
        .enableLogs(LogType.BROWSER, Level.ALL)
        .enableLogs(LogType.PERFORMANCE, Level.ALL));
```

Each enabled log type produces a separate attachment named `Logs from: <type>` (for example, `Logs from: browser`). When steps are included (the default), the attachment is added to the failing Selenide step. When `includeSelenideSteps(false)` is set, it is attached to the enclosing Allure step or test instead.

Available `LogType` values correspond to Selenium's built-in log types: `BROWSER`, `CLIENT`, `DRIVER`, `PERFORMANCE`, `PROFILER`, and `SERVER`. Not all browsers support all log types — check your browser's WebDriver documentation for what is available.

## Environment information

To add environment details (OS, Java version, browser, Selenide version) to the main report page, see [Environment file](/docs/how-it-works-environment-file/).
