Skip to main content

Export traces to Selenium scripts (Beta)

# Exporting Traces to Selenium (Beta)

F
Written by Flakron Bajrami

Exporting to Selenium converts each trace into a runnable JavaScript test using Selenium WebDriver.

You can export your traces from Settings → Export traces → Export to Selenium (Beta).

Selenium export is currently in Beta. Most common step types are supported, but some advanced features require manual adjustments after export.


What's included?

Selecting Export to Selenium (Beta) downloads a ZIP archive named selenium-export.zip.

The archive contains one .test.js file for each trace in your project.

Generated tests use:

Component

Technology

Language

JavaScript (Node.js)

Test runner

Mocha

WebDriver

selenium-webdriver

Supported browsers

Chrome (default), Firefox

Default step timeout

15 seconds

Test timeout

5 minutes


Running the exported tests

Extract the ZIP archive and install the required dependencies:

npm install selenium-webdriver mocha chromedriver

Run a single trace:

npx mocha "Trace_1.test.js"

Run all exported traces:

npx mocha "*.test.js"

Environment variables

You can customise the generated tests without modifying the source files.

Variable

Default

Description

BASE_URL

Recorded URL

Override the application URL

BROWSER

chrome

Browser to run (chrome or firefox)

HEADLESS

false

Run without opening a browser window

DOWNLOAD_DIR

~/Downloads

Directory used for downloaded files

MAIL_SERVER_URL

http://localhost:9000

Inbucket server used for email-related steps


Supported step types

Fully supported

The following Usetrace step types are fully exported and supported in the generated Selenium tests:

  • Navigation (Go to URL)

  • Click

  • Double-click

  • Enter text

  • Send keys

  • File upload

  • File download

  • Assertions and checks

  • Hover

  • Drag and drop

  • Dropdown selection

  • Clear selections (multi-select)

  • Wait

  • Go back

  • Go forward

  • Refresh page

  • JavaScript execution

  • Variables (store values, text, URLs, and page titles)

  • API requests

  • Window and tab management

  • Flow control (Skip Next and Loop Next)

  • Shared runtime variables (GLOBALS)

  • Comments

  • iFrame interactions (handled automatically)


Partially supported

The following features are exported but may require additional setup or manual intervention:

Feature

Notes

Email verification

Generated tests support email checks using Inbucket. To use these steps, MAIL_SERVER_URL must point to a running Inbucket instance.

Shared Steps (Record Steps)

Shared Steps are normally expanded into the generated test. If the referenced trace cannot be found during export


Not currently supported

The following interaction types are not available in the Selenium export:

  • Shadow DOM interactions

  • Right-click (context menu) actions

  • Visual or screenshot assertions


Notes

Although the generated Selenium tests are designed to work out of the box, you may still need to make small adjustments depending on your application, such as:

  • Updating selectors if your application's DOM has changed.

  • Adding authentication for protected applications.

  • Increasing wait times for highly dynamic pages.

  • Configuring ChromeDriver or GeckoDriver versions that match your installed browser.


Recommended workflow

  1. Export your traces as Selenium.

  2. Extract the downloaded ZIP archive.

  3. Install the required dependencies.

  4. Run the generated tests.

  5. Update selectors or waits if necessary.

  6. Add authentication for protected applications.

  7. Integrate the working tests into your CI pipeline.


Beta status

Selenium export is actively being improved, and support for additional step types will continue to expand.

If you encounter an issue, please contact us through the in-app chat and include:

  • The trace name

  • The step number

  • The error message or test output

Your feedback helps us improve future releases of the exporter.

Did this answer your question?