I have created a function to get Chrome browser path for both windows and OS.
private static String getChromeBinaryPath() {
String os = System.getProperty("os.name").toLowerCase();
if (os.contains("win")) {
return "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe";
} else if (os.contains("mac")) {
return "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome";
}
throw new IllegalStateException("Unsupported operating system: " + os);
}
Is there a way, that instead of defining a statically, it will be more dynamic