# Using Selenium 4 on Pcloudy

Last updated on : 09 Jan 2026

## Overview

Selenium 4 is the latest major release of Selenium that brings improved performance, better W3C compliance, enhanced browser support, and a modern WebDriver architecture.

Pcloudy fully supports Selenium 4, allowing you to run your web automation tests on real browsers and operating systems without managing any infrastructure.

## Why Selenium 4 on Pcloudy?

- Fully W3C WebDriver compliant
- Supports latest Chrome, Firefox, Edge, and Safari
- Better browser stability and performance
- Seamless execution on real desktop browsers
- Easy integration with existing Selenium 4 scripts

## New Features in Selenium 4
Selenium 4 introduces several improvements that enhance usability, stability, and performance for modern web test automation.

### 1. Improved User Experience
Selenium 4 comes with a more refined and responsive user interface, making test execution and management smoother and more intuitive for testers.

Benefit:  
Easier navigation and better overall testing experience.

### 2. Enhanced Scripting Capabilities
New locator strategies and stronger support for modern web technologies such as Angular and React allow testers to create more reliable and maintainable automation scripts.

Benefit:  
Improved script stability for dynamic web applications.

### 3. Better Debugging and Diagnostics
Selenium 4 provides enhanced logging, screenshot capture, and error reporting, helping testers quickly identify and resolve issues during test execution.

Benefit:  
Faster troubleshooting and reduced debugging time.

4. Reliable Cross-Browser Testing

By fully adopting W3C WebDriver standards, Selenium 4 ensures consistent behavior across all major browsers, including Chrome, Firefox, Edge, and Safari.

Benefit:  
More predictable and consistent cross-browser test results.

### 5. Backward Compatibility
Existing Selenium 3 test scripts continue to work with Selenium 4 with minimal or no changes, allowing teams to upgrade smoothly.

Benefit:  
No major rework required for existing automation suites.

### 6. Improved Grid and WebDriver Performance
Selenium 4 introduces a redesigned Selenium Grid and optimized WebDriver communication, improving execution speed and stability—especially for complex test scenarios across multiple browsers and operating systems.

Benefit:  
Better performance and scalability for parallel and large-scale test executions.

## Prerequisites
Before running Selenium 4 tests on Pcloudy, ensure:

- Selenium version 4.x
- Pcloudy account
- API Access Key from PCloudy
- Supported programming language (Java, Python, JS, C#)

## Getting API Access Key
1.  Log in to Pcloudy
2.  Open Quick Actions (bottom-left corner)
3.  Copy your API Access Key
4.  To regenerate:

    1.  Go to Profile → Generate new API key

## Important Note for Selenium 4
Selenium 4 uses W3C WebDriver protocol by default.  
Pcloudy is fully compatible, so no additional configuration is required.

## How to Run Selenium 4 Tests on Pcloudy
You only need to:

1.  Set Pcloudy Selenium 4 capabilities

Example

```java title="Java"
package com.Pcloudy.testNg;

import java.io.IOException;
import java.net.URL;
import java.time.Duration;
import java.util.HashMap;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.remote.http.ClientConfig;

public class Driver {
RemoteWebDriver driver;
public RemoteWebDriver createDriver() throws IOException{

String cloudBaseUrl= "https://browser.device.pcloudy.com";
String seleniumHub= "/seleniumcloud/wd/hub";

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("browserName", "chrome");

HashMap<String, Object> pcloudyOptions = new HashMap<String, Object>();
pcloudyOptions.put("userName", "Enter - Email");
pcloudyOptions.put("accessKey", "Enter-API-Key");
pcloudyOptions.put("clientName", "Enter-Client-Name");
pcloudyOptions.put("os", "MAC");
pcloudyOptions.put("osVersion", "Ventura");
pcloudyOptions.put("browserVersion", "120");
pcloudyOptions.put("local", false);
pcloudyOptions.put("seleniumVersion", "4.18.1");

capabilities.setCapability("pcloudy:options", pcloudyOptions);
System.out.println(capabilities);
driver= new RemoteWebDriver(new URL(cloudBaseUrl+ seleniumHub), capabilities);
System.out.println("Driver created" + driver);
return driver;
}
}
```

## Summary
Selenium 4 delivers a more stable, scalable, and future-ready automation framework by improving user experience, debugging capabilities, cross-browser consistency, and performance—while maintaining backward compatibility with existing tests.
