In my maven project, i have a driver/chromedriver.exe in the src/test/resources.
I wish to find the path of my chromedriver.exe in my Hook.java class which is in the src/test/java with below code:
File file = new File(App.class.getClassLoader().getResource("/test/driver/chromedriver.exe").getFile());
or
File file = new File(AppTest.class.getClassLoader().getResource("/test/driver/chromedriver.exe").getFile());
or
File file = new File(App.class.getClassLoader().getResource("/driver/chromedriver.exe").getFile());
But, all of them complains with:
java.lang.NullPointerException
Here is an image of my project:
So, how can i get the address of my chromedriver.exe?
