Java / Selenium relative paths

I have a relative file to upload a file

private String myPath= "..server\\app\\src\\test\\resources";

      

which is verified for source control. Everyone will have the same file structure for their file, including and after server

. However, since developers can have their repositories n different directories, I cannot hardcode the entire file path. How can I get the full path to a file from a relative path?

+3


source to share


1 answer


Use



String absolutePath = new File(myPath).getAbsolutePath();

      

+1


source







All Articles