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

Build the pipeline around three jobs or stages: prepare the application under test, run Selenium WebDriver checks, and retain reports and failure evidence as GitLab artifacts. For a small suite, run tests where a browser is available to the job; use Selenium Grid when remote sessions, parallel execution, or broader browser and operating-system coverage justify the extra infrastructure. The YAML below is an adaptable example, not a universal drop-in configuration: it assumes a GitLab Docker executor, a Python test project, and an application already reachable at a configured URL.

How the pipeline fits together

GitLab reads pipeline configuration from .gitlab-ci.yml. Runners execute jobs, while stages establish the broad order of work: stages run sequentially by default, and jobs in the same stage may run in parallel. Use a prepare or deployment stage when the test target needs to be created, a test stage for browser checks, and optionally a report or cleanup stage. GitLab’s pipeline documentation explains stages, jobs, and dependencies.

Push and merge-request events are common triggers, but choose events and branches to match your review policy. Use needs when a job has a real dependency and can safely start before its entire previous stage finishes; keep the resulting dependency graph understandable.

Decide where the application runs

The test job must be able to reach the application under test. It might target a deployed test environment, a preview deployment created by an earlier job, or an application started as part of the pipeline. The correct URL and lifecycle depend on your deployment design; do not assume localhost inside the job container means the GitLab runner host or another service container.

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.

Choose a browser execution shape

  • Browser available to the job: a reasonable starting point for a small, single-browser suite. The job image or an attached service must provide a browser and any required dependencies.
  • Remote browser through Grid: appropriate when you need remote execution, multiple browser types or versions, parallel sessions, or a browser/OS matrix. The test client connects to a Grid endpoint visible from the job.

GitLab supports job image and services containers, but its general service documentation is not a Selenium-specific recipe. The exact browser image, alias, port, startup readiness, and network reachability must be verified for your image and runner. See GitLab Docker jobs and GitLab services.

Prepare Selenium and the runner

Selenium WebDriver bindings send browser automation commands through browser-specific drivers. Selenium Manager, available through Selenium bindings, can manage drivers automatically; it does not make a browser appear if the execution environment lacks one. Check the Selenium installation guidance and Selenium overview against the language and browser you choose.

  • Confirm your runner executor supports the selected job image and service networking.
  • Ensure the test job can reach both the application and the browser endpoint.
  • Pin compatible Selenium client, browser, driver, and server/container versions rather than relying on shifting defaults.
  • For Docker jobs, scripts run in the project’s build directory; use paths relative to that directory deliberately.
  • Keep credentials in protected CI variables or an approved secret manager. Avoid printing secrets or collecting sensitive user data in artifacts.

The Selenium downloads page lists Selenium 4.49.0 as Stable, dated September 9, 2026. This is a release snapshot, not a guarantee of compatibility with every browser image; verify the current downloads page and pin versions that work together.

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.

Example: a small browser test job

This illustrative pipeline runs a Python/pytest suite with a browser installed in the job image. Replace the image with one you maintain that includes a compatible browser and its system dependencies, and replace APP_BASE_URL with a reachable test target. The example intentionally does not prescribe a universal browser image or deployment job.

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

selenium_tests:
  stage: test
  image: python:3.12-slim
  variables:
    APP_BASE_URL: "https://test.example.com"
  before_script:
    - python -m pip install --no-cache-dir selenium pytest
    - python -m pip install --no-cache-dir -r requirements-test.txt
  script:
    - pytest --junitxml=reports/junit.xml
  artifacts:
    when: always
    expire_in: 7 days
    paths:
      - reports/
      - screenshots/
    reports:
      junit: reports/junit.xml

This example’s image does not itself provide a browser, so it is not runnable as written until you replace or extend the image to supply one. For example, maintain a project image based on your chosen browser distribution and install Python test dependencies in it. Alternatively, attach a browser/Selenium service and configure the test client for its reachable endpoint. Validate the selected service’s alias, listening port, readiness behavior, and runner network before treating that variant as operational.

Make the test report useful

Configure the test framework to emit JUnit XML at the exact path declared under artifacts:reports:junit; otherwise GitLab cannot ingest the report at that path. Preserve screenshots and relevant logs on failure where the framework supports them. when: always helps retain artifacts after a failing test command, but confirm which files are actually produced. Set retention to suit project policy, artifact size, and sensitivity. GitLab describes artifact access and retention in its job artifacts documentation and supported test-report features in testing documentation.

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.

Example: run tests against Selenium Grid

Grid routes WebDriver commands to remote browser instances. Selenium Grid Standalone accepts RemoteWebDriver requests at http://localhost:4444 by default when the client runs in the same network namespace. In CI, a test container normally needs the service hostname or alias instead of localhost. For a GitLab service alias such as selenium, the endpoint commonly takes the form http://selenium:4444, but use this only after verifying the image’s alias and runner networking.

stages:
  - test

selenium_grid_tests:
  stage: test
  image: your-python-test-image:1.0
  services:
    - name: selenium/standalone-chrome:4.49.0
      alias: selenium
  variables:
    APP_BASE_URL: "https://test.example.com"
    SELENIUM_REMOTE_URL: "http://selenium:4444"
  script:
    - pytest --junitxml=reports/junit.xml
  artifacts:
    when: always
    expire_in: 7 days
    paths:
      - reports/
      - screenshots/
    reports:
      junit: reports/junit.xml

Treat this as a configuration pattern, not a verified compatibility recipe: confirm that the selected container tag exists, serves the expected port, accepts the alias, and becomes ready before tests start. Your test code must create a remote WebDriver using SELENIUM_REMOTE_URL; tests configured for a local browser will not switch to Grid merely because a service is declared. A readiness check or bounded retry in test setup may be needed, depending on the image and runner.

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

For a real Python test, the driver setup can follow this pattern, with capabilities appropriate to the browser image:

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
import os
from selenium import webdriver
from selenium.webdriver.chrome.options import Options

options = Options()
driver = webdriver.Remote(
    command_executor=os.environ["SELENIUM_REMOTE_URL"],
    options=options,
)
try:
    driver.get(os.environ["APP_BASE_URL"])
    print(driver.title)
finally:
    driver.quit()

To build or launch containers from a job using Docker-in-Docker, first confirm runner support and security policy. GitLab’s documented Docker/Kubernetes executor setup requires privileged mode for Docker-in-Docker; this is not the only container-build approach, and privileged execution may be inappropriate for a project. GitLab recommends pinning the Docker image version and using TLS where possible; see Docker-in-Docker guidance.

When Selenium Grid is worth the extra setup

Selenium describes Grid as a way to execute WebDriver scripts on remote machines by routing client commands to remote browser instances. A Standalone server is a straightforward entry point; Hub/Node or distributed components can support larger arrangements. Grid can distribute sessions across Nodes and serve multiple browser types and versions. See Selenium Grid, Grid getting started, and When to Use Grid.

Consideration Browser in or beside the job Selenium Grid
Setup and runner needs Fewer moving parts for a single browser, if the job environment includes it. Requires a reachable remote endpoint and service capacity.
Browser coverage Best suited to a focused browser configuration. Can support multiple browser types and versions through Grid Nodes.
Parallel sessions Limited by the job’s available browser resources. Can distribute sessions, subject to configured capacity and resource limits.
Networking Browser and test process may share an environment, depending on setup. Test process must reach Grid and the browser must reach the application target.
Security and operations Fewer remote services to secure. Requires private access controls, version management, monitoring, and capacity planning.

Selenium’s current Grid getting-started documentation offers 1 CPU and 1 GB RAM per browser as a reference recommendation, not a universal sizing guarantee; actual needs depend on workload and environment. Measure performance continuously as concurrency and browser mix change.

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.

Keep Grid private. Selenium warns that an exposed Grid may let outsiders access infrastructure, internal applications or files, and run binaries. Its guidance says, “Grid must be protected from external access using appropriate firewall permissions.” Put access controls and firewall restrictions between Grid and the public internet, and avoid exposing a CI Grid endpoint beyond the network that needs it.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Variables, evidence, and reliability

Pass configuration without leaking secrets

Use CI variables for non-secret settings such as an application URL and Grid endpoint, and protected variables or approved secret-management policies for credentials. Do not echo authorization values or include them in screenshots, logs, or artifacts. GitLab recommends pipeline inputs over passing pipeline variables in GitLab 17.7 and later; pipeline variables have high precedence and can override variables defined elsewhere. See GitLab pipeline documentation for current variable guidance.

Make failures diagnosable

  • Retain JUnit XML when your framework emits a supported format so results can appear in GitLab’s test-report views.
  • Capture screenshots on failure and store them as job artifacts alongside concise logs.
  • Choose artifact expiration deliberately; longer retention increases storage use and may preserve sensitive information longer than intended.
  • Use bounded waits for page conditions rather than assuming a fixed delay fits every runner load.

Control version drift and cost

Pin the job image, browser/Selenium service image, and client dependencies so a moving tag does not silently change the test environment. When updating versions, check client/server/browser compatibility and review failures that could be caused by environment changes rather than application code. Parallel sessions can reduce wall-clock time only if the runner and Grid have capacity; otherwise contention can make tests slower or less reliable. Avoid adding Grid for a one-browser suite unless remote execution solves a concrete need.

Troubleshooting common failures

Symptom Likely cause What to check or change
Browser or driver not found The job image lacks a browser or required system libraries, or the driver setup is incompatible. Use a browser-enabled image, verify its installed browser, and align Selenium client and browser versions. Selenium Manager can manage drivers but cannot supply a missing browser.
Connection refused at the WebDriver URL Wrong hostname/port, service not ready, or job/service networking mismatch. Check the declared service alias and port, verify runner networking, and add an appropriate bounded readiness/retry strategy.
Tests open the wrong application host The URL is not reachable from the browser container or uses a mistaken localhost. Set an application URL reachable from the browser’s network context; distinguish the job, service, runner host, and deployed application addresses.
Tests fail before the page is ready Timing assumptions, slow CI resources, or asynchronous content. Wait for a meaningful selector or state with explicit timeouts; avoid treating a single fixed sleep as a readiness guarantee.
GitLab shows no test report JUnit XML was not generated, its path differs from the artifact declaration, or the format is unsupported. Check the test command’s output and make the report path match artifacts:reports:junit.
Artifacts disappear after failed tests Artifact policy or paths do not include the generated files. Use when: always, confirm paths relative to the project build directory, and inspect the job’s artifact retention settings.
Docker-in-Docker cannot start The runner executor is not configured for the required mode, or project policy disallows privileged execution. Confirm the documented executor prerequisites and consider another build strategy approved by your infrastructure team.

Or skip the browser setup

For a screenshot of a page rather than interactive Selenium assertions, ScreenshotNeo provides a one-request screenshot API; it does not replace WebDriver tests. One GET request can return a PNG, JPEG, WebP, or PDF. See the ScreenshotNeo API documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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/consent banners and removes more than 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 responses include page-verdict and billing headers. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots. Sign up for ScreenshotNeo’s free plan.

Frequently Asked Questions

Can Selenium tests run on GitLab’s shared runners?

They can if the runner environment supports the chosen job image, browser execution model, and required service networking; confirm those constraints for the runner you use.

Do I need Selenium Grid for a GitLab Selenium pipeline?

No. A browser available to the job can be sufficient for a small single-browser suite; Grid is optional infrastructure for remote execution and broader or parallel browser coverage.

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.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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