NextDigital Docs
Guides 3 min read

Selenium Java Testing Environment

Enterprise browser automation with Selenium WebDriver, Chrome, Firefox, Selenium Grid, and noVNC.

What's Inside

Tool Version Purpose
Java OpenJDK 17 Runtime
Maven 3.9.9 Build and dependency management
Selenium WebDriver 4.25.0 Browser automation framework
Selenium Grid 4.25.0 Remote browser execution
Chrome Latest stable Google Chrome browser
ChromeDriver Auto-matched Chrome automation driver
Firefox ESR Latest Mozilla Firefox browser
GeckoDriver Latest Firefox automation driver
TestNG 7.10.2 Test framework
JUnit 5 5.11.3 Alternative test framework
WebDriverManager 5.9.2 Automatic driver management
Allure CLI Latest Test reporting
noVNC Latest Watch tests in a real browser GUI

Quick Start

# Run all tests
sel-run

# Run a specific test class
sel-test LoginTest

# Run on Chrome then Firefox
sel-cross

# Watch tests live via noVNC
sel-liveview

# Start Selenium Grid
sel-grid

Helper Commands

Command What it does
sel-run Run all tests (mvn test)
sel-test <Class> Run a specific test class
sel-cross Run on Chrome, then Firefox
sel-browser <name> Run on a specific browser (chrome/firefox)
sel-allure Run tests + generate Allure report
sel-grid Start Selenium Grid on port 4444
sel-grid-stop Stop Selenium Grid
sel-debug Run with remote debug on port 5005
sel-liveview Watch tests via noVNC on port 10000
sel-help Show all available commands

Exercises

  1. TestNG Basics — Write your first Selenium test with TestNG
  2. JUnit 5 Basics — Same tests with JUnit 5 framework
  3. Page Object Model — Maintainable test architecture
  4. Explicit Waits — WebDriverWait for dynamic content
  5. Screenshot Capture — Capture screenshots on failure
  6. Cross-Browser Testing — Run on Chrome and Firefox
  7. Selenium Grid — Distributed test execution
  8. CI/CD Integration — GitHub Actions pipeline

Project Structure

workspace/
├── pom.xml                          # Selenium, TestNG, JUnit 5, WebDriverManager
├── testng.xml                       # TestNG suite config
├── src/test/java/
│   ├── testng-sample/               # TestNG test examples
│   ├── junit5-sample/               # JUnit 5 test examples
│   ├── page-object-sample/          # POM pattern
│   │   ├── BasePage.java
│   │   └── LoginPage.java
│   ├── webdriverwait-sample/        # Explicit wait examples
│   └── screenshot-sample/           # Screenshot on failure
└── exercises/                       # 8 guided exercises

Watching Tests Run (noVNC)

  1. Run sel-liveview — starts Xvfb + noVNC
  2. Open the noVNC URL (port 10000)
  3. Run your tests in another terminal: sel-run
  4. Watch Chrome/Firefox execute tests in real-time

Selenium Grid

# Start Grid
sel-grid

# Open Grid console
# Visit http://localhost:4444

# Run tests against Grid
mvn test -Dselenium.grid.url=http://localhost:4444

# Stop Grid
sel-grid-stop

Tips

  • WebDriverManager auto-downloads the correct driver — no manual setup needed
  • Use @BeforeMethod / @AfterMethod for setup/teardown in TestNG
  • Chrome runs headless by default (--headless --no-sandbox --disable-gpu)
  • Use sel-liveview to debug visual issues
  • Ctrl+Shift+B runs the default test suite

Security

  • Root access is restricted. Use sudo apt install <package> for system packages.
  • Java, Maven, and npm are whitelisted for sudo access.
  • JVM memory is auto-tuned to 75% of pod limits.