Skip to content
CodeKruPro

Pass the browser from the command line into tests

QuizMediumJava only

CI (a server that runs tests automatically) runs mvn test -Dbrowser=firefox. How can the Java test code read the value, with chrome as the default?

  • String browser = System.getProperty("browser", "chrome");
  • String browser = System.getenv("browser");
  • String browser = args[0];
  • Maven cannot pass values to tests

This question is part of Pro+

Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.

See Pro+

Already have Pro+? Sign in