GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Pcloudy-Sample/PC-selenium-java: Selenium Java sample project: run your browser tests on the Pcloudy remote Selenium grid instead of maintaining your own browsers and machines. A Maven project with TestNG that shows how to point your existing Selenium WebDriver tests at Pcloudy. Clone it, add your Pcloudy credentials, and run. Docs and setup steps at pcloudy.com/docs

BranchesTags
Open more actions menu

Latest commit

 

History

7 Commits
7 Commits

Folders and files

NameName
Last commit message
Last commit date
src/main/java/com/pcloudy/selenium
src/main/java/com/pcloudy/selenium
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 
pom.xml
pom.xml
 
 

Repository files navigation

Run Selenium Tests with Java on Pcloudy

Pcloudy Selenium Java

Getting Started

Pcloudy is a cloud testing platform that gives you access to real browsers and devices directly from your automation scripts. This project is a simple Java Selenium example showing how to run browser automation on Pcloudy's remote Selenium grid.

Prerequisites

  • Java 11 or later
  • Maven 3.8+ recommended
  • A valid Pcloudy account
  • Access to the Pcloudy Selenium endpoint

Overview

This repository contains a simple Selenium Java sample that runs a browser session on the Pcloudy cloud Selenium grid.

The sample:

  • Connects to the Pcloudy remote Selenium hub
  • Launches a Chrome browser session
  • Opens Wikipedia
  • Searches for Selenium
  • Saves a screenshot under target/screenshots

Features

  • Remote WebDriver execution on Pcloudy
  • Selenium 4 with Java 11
  • TestNG annotations for test lifecycle management
  • Automatic screenshot capture
  • Maven-based project setup

Project Details

  • Language: Java
  • Build tool: Maven
  • Selenium version: 4.25.0
  • Test framework: TestNG
  • Java version: 11

Project Structure

pc-selenium-java/
|-- pom.xml
|-- README.md
`-- src
    `-- main
        `-- java
            `-- com
                `-- pcloudy
                    `-- selenium
                        `-- PcloudySeleniumRunner.java

Setup

Clone the repository and install dependencies:

git clone https://github.com/Pcloudy-Sample/PC-selenium-java
cd PC-selenium-java
mvn clean install

Configuration

Open src/main/java/com/pcloudy/selenium/PcloudySeleniumRunner.java and update the following values:

  • HUB_URL for the Pcloudy Selenium hub
  • USER_NAME with your Pcloudy email
  • ACCESS_KEY with your Pcloudy access key
  • The buildOptions() values for your desired OS, browser version, project name, and build name

Example capability block:

static Map<String, Object> buildOptions() {
    Map<String, Object> options = new LinkedHashMap<>();
    options.put("userName", USER_NAME);
    options.put("accessKey", ACCESS_KEY);
    options.put("os", "Mac");
    options.put("osVersion", "Ventura");
    options.put("browserVersion", "134");
    options.put("seleniumVersion", "4.18.1");
    options.put("project", "Project_1");
    options.put("build", "staging_browser_run");
    options.put("name", "Wikipedia search");
    options.put("tag", "launch");
    options.put("local", false);
    options.put("pCloudy_EnableVideo", true);
    options.put("idleTimeout", 5);
    return options;
}

Run The Sample

Run the sample through Maven exec:

mvn exec:java -Dexec.mainClass=com.pcloudy.selenium.PcloudySeleniumRunner

What The Sample Does

The PcloudySeleniumRunner class:

  • Creates a RemoteWebDriver session using pcloudy:options
  • Navigates to https://www.wikipedia.org/
  • Waits for the search box to become clickable
  • Searches for Selenium
  • Captures a screenshot in target/screenshots
  • Closes the browser session

Important Notes

  • The project currently hardcodes the Pcloudy username and access key in the runner. For real usage, move these values to environment variables or a secure secret store.
  • browserName is set to chrome in the runner.
  • Screenshots are written to target/screenshots/ and are not committed to source control.
  • The sample uses TestNG annotations, but the main method also allows it to run as a simple Java entry point.

Troubleshooting

  • If the session does not start, verify the hub URL, username, and access key.
  • If the browser fails to launch, confirm the selected os, osVersion, and browserVersion are supported by your Pcloudy plan.
  • If Maven cannot resolve dependencies, make sure you have internet access and a working Maven installation.
  • If screenshots are not created, check that the test reached the captureScreenshot step and that the process has write access to target/screenshots.

Dependencies

The project uses these Maven dependencies:

  • org.seleniumhq.selenium:selenium-java
  • org.testng:testng

Learn More

  • Pcloudy Website
  • Selenium Documentation

Contributions

Contributions are welcome. Please open an issue to discuss your idea before submitting a pull request.

About

Selenium Java sample project: run your browser tests on the Pcloudy remote Selenium grid instead of maintaining your own browsers and machines. A Maven project with TestNG that shows how to point your existing Selenium WebDriver tests at Pcloudy. Clone it, add your Pcloudy credentials, and run. Docs and setup steps at pcloudy.com/docs

www.pcloudy.com/docs/selenium/

Topics

browser-testingcross-browser-testingdevice-cloudjavamavenpcloudyseleniumselenium-gridselenium-javaselenium-webdrivertest-automationtestngweb-testing

Resources

Readme
Activity
Custom properties

Stars

1 star

Watchers

0 watching

Forks

0 forks
Report repository

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.