config.properties:
base.url=https://targetqa.com
browser=chromium
headless=true
timeout=30Read dynamically in Java:
import java.io.*;
import java.util.Properties;public class ConfigReader {
private static Properties properties = new Properties();
public static void loadConfig(String filePath) throws IOException {
try (InputStream input = new FileInputStream(filePath)) {
properties.load(input);
}
}
public static String getProperty(String key) {
return properties.getProperty(key);
}
}