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.

To use Selenium with PHP, install the community php-webdriver/webdriver Composer package, install Chrome or Chromium, and run a compatible ChromeDriver endpoint. Your PHP script then connects to that endpoint using WebDriver, opens a page, interacts with its elements, checks a result, and closes the browser session.

How Selenium with PHP works

Selenium WebDriver is an interface and protocol for automating a browser. In a PHP project, the community php-webdriver/webdriver library acts as the client: it sends WebDriver commands to a browser-specific driver, which controls the actual browser. Selenium’s setup overview describes the necessary pieces as a language binding, a browser, and that browser’s driver (Selenium: Getting started; Selenium WebDriver).

The browser can run on your development machine or elsewhere. This beginner example uses Chrome locally. PHP is not listed among the Selenium project’s supported language bindings in the documentation reviewed here; php-webdriver/webdriver is a community-maintained PHP client, not an official Selenium PHP binding.

Install the PHP WebDriver client

In your project directory, install the library with Composer:

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.
composer require php-webdriver/webdriver

The package name is php-webdriver/webdriver. Older instructions may use facebook/webdriver, the previous package name. Composer creates the dependencies and autoloader your script will use.

At the Packagist snapshot dated December 28, 2025, version 1.16.0 was listed, with PHP ^7.3 || ^8.0 and the curl, json, and zip extensions as requirements (Packagist package record). Package versions and requirements can change; check the current package record when setting up a new project.

Install Chrome and start ChromeDriver

The Composer package does not install a browser or its driver. Install Chrome or Chromium, then install a ChromeDriver version compatible with the browser version you have. ChromeDriver is a separate executable that exposes a WebDriver endpoint for Chrome (Chrome for Developers: Get started with ChromeDriver). Because browser and driver releases change, use the current browser-vendor instructions rather than relying on a copied, old version pin.

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.
  1. Install Chrome or Chromium on the machine that will run the test.
  2. Install a compatible ChromeDriver using the current ChromeDriver instructions.
  3. Start the driver and leave it running while your PHP script uses it. The php-webdriver README documents the local endpoint pattern on port 4444, at http://localhost:4444 (php-webdriver project README).

This is a direct connection to a local browser driver; it is not the same setup as Selenium Server or Grid. A direct driver is a straightforward starting point for local development. Selenium Server/Grid is a separate option when you need remote browsers, multiple browser types, CI orchestration, or distributed runs.

Free tools Windows power users keep installed

One-click scans. No signup required.

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

Write and run a first PHP browser test

Save this as first-test.php in the Composer project directory. It opens Example Domain, checks that the page title is the expected value, and closes the WebDriver session whether the check succeeds or throws an exception.

<?php
require_once __DIR__ . '/vendor/autoload.php';

use FacebookWebDriverRemoteDesiredCapabilities;
use FacebookWebDriverRemoteRemoteWebDriver;

$driver = RemoteWebDriver::create(
    'http://localhost:4444',
    DesiredCapabilities::chrome()
);

try {
    $driver->get('https://example.com');
    $title = $driver->getTitle();

    if ($title !== 'Example Domain') {
        throw new RuntimeException("Unexpected page title: {$title}");
    }

    echo "Title check passed: {$title}n";
} finally {
    $driver->quit();
}

Run it from the project directory with:

php first-test.php

With ChromeDriver running and dependencies installed, the script should print Title check passed: Example Domain. The PHP client’s documented pattern is to create a remote WebDriver session with a server URL and browser capabilities, navigate with get(), find and interact with elements as needed, and call quit() to end the session (php-webdriver project README).

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.

Find elements, interact, and wait for the page

For interaction tests, identify an element with a locator, then use the element methods to act on it or inspect its state. Prefer a stable ID or CSS selector when the target page provides one. For example, after navigation, a lookup follows this pattern:

use FacebookWebDriverWebDriverBy;

$button = $driver->findElement(WebDriverBy::cssSelector('#submit'));
$button->click();

The selector above is illustrative: it works only if the page actually contains an element with that ID. Choose locators based on the target page’s DOM rather than assuming every page has the same markup.

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

Do not use an arbitrary sleep as the default synchronization strategy. Dynamic pages may not have finished rendering or loading the element when the next command runs. WebDriver documentation treats waiting strategies as a core browser-automation concern; use an explicit wait for the condition your test needs, and keep assertions in your chosen test runner when you turn the script into a test suite (Selenium WebDriver). Always close the session with quit(), including when an assertion or interaction fails.

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

When to use Selenium Server or Grid

Start with the direct local driver for learning and local browser checks. Consider Selenium Server/Grid when the test environment needs remote machines, several browser types, CI coordination, or distributed execution. The php-webdriver project documentation distinguishes direct browser-driver communication from connecting through Selenium Server and describes the latter for broader or distributed setups (php-webdriver project README).

Setup Where the browser runs Best fit Operational trade-off
Direct ChromeDriver On the local machine running ChromeDriver First scripts and local development Simple endpoint model, but you manage the browser and compatible driver on that machine.
Selenium Server/Grid On a server or Grid node, possibly remote from PHP Multiple browsers, CI, or distributed runs Adds server/Grid setup and orchestration in exchange for remote or broader execution.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting common setup problems

  • Composer succeeds, but no browser starts: Installing the PHP binding does not install Chrome/Chromium or ChromeDriver. Install both, ensure driver compatibility, and start the driver endpoint.
  • PHP cannot connect to http://localhost:4444: Confirm ChromeDriver is running on that host and port, and that your PHP script uses the same endpoint. If the driver runs on another machine, localhost refers to the PHP machine, not the remote host.
  • Session creation fails: Check that Chrome is installed and that the ChromeDriver release is compatible with it. Consult the current ChromeDriver setup instructions rather than using a stale driver download or version pin.
  • Class not found errors: Run the script from the Composer project and include vendor/autoload.php. Verify that composer require php-webdriver/webdriver completed successfully.
  • Composer reports a PHP version or extension conflict: Compare your PHP runtime and installed extensions with the current Packagist requirements. The December 28, 2025 package snapshot listed PHP ^7.3 || ^8.0 and curl, json, and zip; check for updated requirements before treating those as current.
  • The script exits but leaves a browser running: Put browser work in a try block and call $driver->quit() from finally so cleanup occurs after failures too.
  • An element lookup fails or runs too early: Confirm the locator matches the live page DOM and wait for the required element or state instead of assuming navigation means all dynamic content is ready.

Or skip the browser setup

If you need a website screenshot rather than browser interactions, ScreenshotNeo returns a screenshot or PDF from one API request. Its consent-banner, popup, and chat-widget cleanup runs before capture and can be turned off; bot checks, blank pages, timeouts, failed loads, and cache hits are not billed. It also provides an MCP server for AI agents, including Claude, Cursor, and other MCP clients. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots.

cURL example (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://example.com -o shot.webp

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

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.

Frequently Asked Questions

Is php-webdriver/webdriver an official Selenium PHP binding?

No. It is a community-maintained PHP client library; the Selenium documentation reviewed here does not list PHP among its supported language bindings.

Do I need Selenium Server to run a local PHP browser test?

No. For a first local test, PHP can connect directly to a running browser driver such as ChromeDriver.

What should I use instead of facebook/webdriver in new setup instructions?

Use the Composer package name php-webdriver/webdriver.

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

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.