I want to upload the file which can be in format of Png/Jpg/Apk/PPT/Pdf/Word to my web Service Project. Currently I am using Selenium WebDriver and Maven project with TestNG framework.
Issue Facing - I want to upload all files directly from my folder which is inside the project but outside SRS in Eclipse. I am getting an error of Null pointer exception or some time file not found error.
Below is the code which I am using to upload
AddNewAppPage lPO = new AddNewAppPage(driver);
ClassLoader classLoader = getClass().getClassLoader();
File file = new File(classLoader.getResource("./Drivers/ABC.pdf").getFile());
Thread.sleep(3000);
lPO.getPresentationFile().sendKeys(file.toString());
Actually I don't want to give XPath of image or file upload of my system, I directly want to upload from the resource folder.