Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java / Selenium relative paths

Tags:

java

selenium

I have a relative file for a file upload

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

that is checked into source control. Everyone will have the same file structure for their file including and after server. However, since developers might have their repositories n different directories, I can't hard code the entire file path. How can I get the fully qualified file path from the relative path?

like image 695
wootscootinboogie Avatar asked Apr 28 '26 20:04

wootscootinboogie


1 Answers

Use

String absolutePath = new File(myPath).getAbsolutePath();
like image 64
bruno Avatar answered May 01 '26 10:05

bruno