October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk6 min

How to Integrate Selenium, Maven, and Jenkins

Connect Selenium Java, Maven, and Jenkins with a Pipeline that runs your tests and publishes their reports.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Declare Selenium’s Java binding in your Maven project, run the project’s Maven lifecycle from a Jenkins Pipeline, and publish the resulting test reports. The essential path is pom.xml → Jenkins agent with the required Java and Maven → mvn clean verify → Surefire or Failsafe reports published in Jenkins.

1. Add Selenium to the Maven project

Add Selenium’s Java binding, org.seleniumhq.selenium:selenium-java, as a dependency in pom.xml. Keep its version in a project property so it is easy to manage, and check the Selenium downloads page and your Java/browser setup before selecting a version. No single compatibility matrix covers every Java, Selenium, browser, and driver combination.

As an Amazon Associate I earn from qualifying purchases.

<properties>
  <selenium.version>REPLACE_WITH_A_VERIFIED_VERSION</selenium.version>
</properties>

<dependencies>
  <dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>${selenium.version}</version>
  </dependency>
</dependencies>

Replace the version value with one checked for your project; the token shown is an instructional placeholder, not a valid version. Selenium’s official installation instructions cover Maven dependency setup: Selenium WebDriver installation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Place tests and configure their names and lifecycle so Maven’s intended test plugin discovers them. Surefire executes tests in Maven’s test phase; integration-style suites may instead be organized around Failsafe and later lifecycle phases. Selenium tests are not required to use one classification: choose based on how your suite should run and report.

2. Prepare Jenkins and its build agent

The Jenkins agent that runs the job needs the Java runtime and Maven required by the project, as well as access to the browser environment the tests expect. You can use tools installed on the agent or configure Maven and JDK installations in Jenkins. The Pipeline Maven Integration plugin’s withMaven step can select configured installations and provide Maven settings from Jenkins configuration or an explicit settings-file configuration.

Install the Pipeline Maven Integration plugin from the Jenkins Update Center only after checking that its current release supports your Jenkins core version. The release listed for July 30, 2026, was 1760.v9a_a_e6dcb_0444 and required Jenkins 2.528.3; plugin versions and requirements can change. Its documentation states that Maven build detection requires Maven 3.2 or later; this is the documented detection requirement, not a recommendation that every project use that version.

Keep repository credentials out of the POM and Jenkinsfile. Use your organization’s approved Jenkins credential and Maven settings configuration; the appropriate credential setup depends on your Jenkins environment.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

3. Run Maven from a Jenkins Pipeline

A Declarative Pipeline can check out the repository, select the Jenkins-configured JDK and Maven, and run the lifecycle goal that includes your browser suite. This example is a template: replace the tool names and agent label as needed, and ensure the project’s Maven configuration includes the tests you want to run.

pipeline {
  agent any
  stages {
    stage('Test') {
      steps {
        checkout scm
        withMaven(maven: 'configured-maven', jdk: 'configured-jdk') {
          sh 'mvn clean verify'
        }
      }
    }
  }
}

configured-maven and configured-jdk must match installations configured in Jenkins. The example uses a Unix shell step. On a Windows agent, use the appropriate batch step instead. The Pipeline Maven plugin documents Linux, Windows, and macOS agents.

mvn clean verify cleans prior build output and runs Maven through the verification phase. The Pipeline Maven plugin documents this invocation pattern; withMaven prepares the Maven environment and can discover generated Maven artifacts and supported Surefire/Failsafe reports. If your project’s suite is assigned to another lifecycle phase, choose the corresponding Maven goal rather than assuming every Selenium suite belongs in verify.

4. Publish and inspect test results

Jenkins can display results only when Maven generated reports and a compatible publisher is configured. The Pipeline Maven Integration plugin can publish Surefire and Failsafe reports through its publishers. JUnit report publication requires the Jenkins JUnit plugin. For formats or tests not automatically detected, configure the matching publisher and report path.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. After the Maven step, check whether report files exist in the expected Surefire or Failsafe output location.
  2. Confirm the reports contain test cases and were generated by the suite that Jenkins actually ran.
  3. Confirm the relevant Jenkins publisher is installed and configured; for JUnit publishing, install/configure the JUnit plugin.
  4. Inspect the Jenkins build’s test results and the Maven console output together if the report is missing or empty.

When tests fail, make sure the job still reaches report publication where possible. Configure the Pipeline so report processing runs even when Maven exits with a test failure; otherwise Jenkins may show a failed build without the test details needed to diagnose it. The exact Pipeline error-handling structure depends on the job and publisher configuration.

5. Choose a job style and browser execution setup

Pipeline or legacy Maven job

Use a Pipeline when you want the build definition alongside the project and explicit control over checkout, tools, Maven goals, and report handling. Jenkins’ Maven Integration documentation recommends moving away from the legacy Maven job type toward Pipeline or freestyle jobs. A freestyle job remains an option where it fits an existing setup.

Surefire or Failsafe

Use Surefire when the browser tests are configured as tests in Maven’s test phase. Use Failsafe when the suite is set up as integration tests in the corresponding later lifecycle phases. The plugin supports reports from both; project test naming and Maven configuration determine which executes and where reports are produced.

Agent-local browser or separate browser service

The documentation establishes how Jenkins runs Maven and publishes reports, but does not prescribe whether your browser should run locally, headlessly, or through a separately managed grid. Choose according to your infrastructure, then ensure the Jenkins agent can reach the browser and any external service and that the required browser configuration is available to the tests.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

6. Troubleshoot common failures

Jenkins shows no test results

  • Check Maven’s console output to verify that tests ran rather than being skipped or undiscovered.
  • Confirm XML reports were generated in the expected Surefire or Failsafe location.
  • Verify that the appropriate report publisher is installed and configured; JUnit publication requires the Jenkins JUnit plugin.

The build uses an unexpected Java version

Check the JDK installation selected in Jenkins and the jdk argument to withMaven. Compare the Java version visible in the build log with the version required by the project.

The build works locally but not on the Jenkins agent

Compare the agent’s Java and Maven versions with the local environment. Also verify browser availability, relevant environment variables, and any external browser-service configuration. These environment differences are common diagnostic areas; the correct fix depends on the agent and test architecture.

A legacy Maven job behaves differently

Check which test plugins and report formats the job supports. For a maintainable migration path, move the build to a Jenkins Pipeline or freestyle job and explicitly configure Maven execution and report publication.

7. A simpler option for capturing web pages

If your goal is to collect page screenshots rather than run browser interactions and assertions, ScreenshotNeo is a website screenshot API and MCP server. It is not a replacement for Selenium tests that need to exercise or verify application behavior.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Or skip the browser setup

One GET request captures a URL. See the ScreenshotNeo API documentation for options and response details.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

ScreenshotNeo accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, with response headers identifying the page verdict and billing status. An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. The Free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 screenshots.

Sign up for 1,000 free screenshots a month, with no card required.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.