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

To run Selenium tests in Bitbucket Pipelines, add a step in the repository-root bitbucket-pipelines.yml, install the project dependencies, and configure the Selenium client to use Remote WebDriver with a Grid URL that the pipeline can reach. Selenium Grid runs the browser sessions; your test framework runs the tests and generates reports.

Choose where Selenium Grid will run

Before writing pipeline YAML, decide how the build step will reach the Grid. The right URL and startup approach depend on that topology.

  • Existing Grid: Use a Grid already hosted on a network accessible to the pipeline. Restrict access to the runner and other trusted clients.
  • Grid provisioned for a pipeline: Start or arrange the Grid as part of the job, then verify service discovery, readiness, and teardown for your runner and runtime. The official documentation reviewed does not provide a complete Bitbucket-specific Grid service-container recipe, so do not assume a generic service definition will work unchanged.
  • Managed browser-testing service: Use the provider’s supported endpoint and access method. Atlassian’s third-party integration guide describes BrowserStack as supporting Selenium testing, but provider setup and terms are outside the scope of this configuration.

For the Grid itself, a Standalone server is a simpler starting point. A Hub-and-Node setup or distributed Grid can suit other deployment needs. Selenium describes the Router as the client-facing endpoint in a fully distributed Grid. Compare options against the required browser, browser version, platform coverage, network isolation, parallel session capacity, and observed stability; there is no universally correct topology or Grid size. See Selenium Grid documentation.

Configure the pipeline step

Bitbucket Pipelines reads bitbucket-pipelines.yml from the repository root. Choose a build image containing the language runtime your tests need, and pin image and dependency versions when repeatability matters. Bitbucket supports public images and internet-accessible private images. If the step needs Docker commands, enable Docker as a step service and confirm that the relevant runtime and runner support the Docker behavior you rely on.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Minimal Maven example

This is a starting shape, not a complete Grid deployment. It assumes the Grid is already reachable at the URL supplied as SELENIUM_REMOTE_URL. Replace the image, test command, report path, and environment configuration to match the project.

image: maven:3.9-eclipse-temurin-17

pipelines:
  default:
    - step:
        name: Selenium integration tests
        script:
          - mvn test
        artifacts:
          - target/surefire-reports/**

Set SELENIUM_REMOTE_URL in the pipeline environment or workspace/repository deployment variables to the reachable Grid endpoint. Keep credentials out of committed YAML. The variable name is a convention used by your test setup; Bitbucket and Selenium do not automatically connect it to the client.

Point Selenium tests at the remote Grid

Remote WebDriver needs the Grid URL and browser options or capabilities. The Java client pattern is to create the browser options and pass both to RemoteWebDriver. Ensure that every session is closed, including when a test fails.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
import java.net.URL;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.RemoteWebDriver;

URL gridUrl = new URL(System.getenv("SELENIUM_REMOTE_URL"));
ChromeOptions options = new ChromeOptions();
WebDriver driver = new RemoteWebDriver(gridUrl, options);
try {
    // Invoke the project's test flow.
} finally {
    driver.quit();
}

The URL must be reachable from the process running the tests, not merely from your laptop or from another network location. Selenium documents http://localhost:4444 as the default Grid address, but localhost always means the machine or container where the client process runs. If Grid is in another container, on another host, or managed externally, use the hostname and port accessible from the pipeline step instead. See Selenium’s Grid getting-started guide and Remote WebDriver documentation.

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

Generate and publish test reports

Selenium automates browsers; it is not the test framework and does not create test reports. Configure JUnit, TestNG, pytest, Mocha, or your chosen framework to emit a report format Bitbucket can ingest. Set the report path to the actual output location and configure artifact retention if you need to download raw report files after the run. Bitbucket’s reporting steps vary by framework; follow its test reporting guide for the relevant format.

Security, capacity, and reliability

Protect the Grid endpoint

Do not expose an unauthenticated Grid to untrusted networks. Selenium warns that an externally reachable Grid can expose infrastructure, internal applications, and files, and can allow binary execution. Restrict inbound network access with firewall rules and keep the endpoint reachable only by trusted runners and clients. See Selenium’s Grid security guidance.

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

Validate parallel capacity in the target environment

There is no one-size-fits-all Grid size. Browser type, memory, page workload, parallel test count, and the runner’s network all affect capacity and stability. Treat any general sizing guidance as an initial reference, then measure session startup, queueing, failures, and completion time under your own workload before increasing parallelism.

Make failures diagnosable

  • Pin build images and test dependencies so a changing upstream image or package does not silently alter the environment.
  • Retain test reports and relevant logs as pipeline artifacts when you need to diagnose failures after the step ends.
  • For an ephemeral Grid, wait for readiness before starting tests and ensure teardown runs even when tests fail.
  • Keep the Grid and pipeline on a network path with predictable DNS and routing; a locally valid hostname may not resolve inside the build container.

Troubleshooting common integration failures

Connection refused or connection timeout

Cause: The Grid is not running, is not ready, listens on a different port, or is unreachable from the build step. Fix: Confirm the Grid endpoint from the pipeline’s network context, verify service startup/readiness, and check routing and firewall rules. Do not assume localhost identifies a separate service container.

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

Unknown host or DNS lookup failure

Cause: The hostname works outside the runner but is not resolvable within it, or service discovery differs for the selected runtime. Fix: Use the hostname that the runner can resolve and verify the runner’s service-network configuration.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Session creation or browser capability error

Cause: The requested browser options do not match browsers available on the Grid, or the client is addressing the wrong Grid component. Fix: Check the Grid’s available browser slots and send options supported by that browser. For Standalone use its server URL; for Hub-and-Node use the Hub; for a distributed Grid use the Router endpoint.

Pipeline passes locally but fails in CI

Cause: Local and pipeline environments differ in URL reachability, browser availability, dependencies, or timing. Fix: Pin the build image and dependencies, confirm the remote URL from the test process, and use explicit readiness checks rather than assuming the Grid is ready immediately.

Tests run but Bitbucket shows no report

Cause: The test framework did not produce a supported report, or the YAML points to the wrong output path. Fix: Enable the framework’s XML reporting, inspect the generated files, and align the reporting configuration and artifact path with their actual location.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If your task is capturing a page rather than automating interactive browser tests, ScreenshotNeo provides a screenshot API and MCP server; it is not a replacement for Selenium Grid test execution. One GET request can return an image or PDF:

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

See the ScreenshotNeo API documentation for request options. It accepts cookie or consent banners and removes 60+ known consent platforms, newsletter popups, and chat widgets before capture; these steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing result. Its MCP server provides take_screenshot, get_page_info, and capture_pdf for AI agents. The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots.

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

Frequently Asked Questions

Does Selenium Grid generate JUnit reports?

No. Configure the test framework to generate reports in a format Bitbucket supports.

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

Can I use localhost as the Grid URL in Bitbucket Pipelines?

Only when the Grid is reachable as localhost from the test process itself. For a separate container or host, use the address reachable from the pipeline step.

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.