I need to create directory for image storing next to project root directory.
I know that project root directory path I can get this way:
String PROJECT_ROOT_PATH = System.getProperty("user.dir");
String PATH_TO_PACKAGE = System.getProperty("user.dir") + "\\imagesForTesting\\";
For example, I have PROJECT_ROOT_PATH = "D:\Work\SeleniumProject"
Yes Java supports relative path such that you can use
.. in your path to access to the parent directory, in other words this can be done:
String PATH_TO_PACKAGE = System.getProperty("user.dir") + "\\..\\imagesForTesting\\";
NB: You can use
/ instead of
\\ to build your path, it will still work on windows OS.