Playwright + Java · Lesson 11 of 38
Module 11: Java for Automation
Your task
Implement EnvironmentConfig:
Write it in the editor, then press Check answer (Ctrl + Enter).
Avoid passing error-prone raw strings like "chrome" or "prod".
public enum BrowserType {
CHROMIUM("chromium"),
FIREFOX("firefox"),
WEBKIT("webkit");
private final String value;
BrowserType(String value) { this.value = value; }
public String getValue() { return value; }
}
public enum Environment {
DEV("https://dev.targetqa.com"),
STAGING("https://staging.targetqa.com"),
PROD("https://targetqa.com");
private final String url;
Environment(String url) { this.url = url; }
public String getUrl() { return url; }
}Welcome to Phase 2! In this module, we connect Java directly to automation architecture. You will learn to build reusable helper methods, type-safe enums for browsers and environments, and structured configuration handlers. Let's design maintainable automation code!
Part of the Playwright + Java course (Playwright with Java). Practice this concept live in the Playwright Online Compiler or explore our free automation practice form.
Enums enforce compile-time type safety so developers cannot pass arbitrary invalid strings into test configuration methods.
Ready? Solve the task in the editor
Use Check answer to mark it complete. Hints are there if you need them.
___