I have below code:
public class BasePage {
public static WebDriver driver;
public static Properties prop;
FileInputStream objfile;
@Test
public void BasePages() throws IOException {
try {
prop = new Properties();
objfile = new FileInputStream(System.getProperty("app.properties"));
prop.load(objfile);
System.out.println("file loaded");
} catch (Exception e) {
System.out.println("catch exception" + e);
}
}
}
The FileInputStream
shows NullPointerException
. I tried debugging the above code only after reading this line it moves to the catch block.
Can anyone explain why i'm getting Exception and how to solve this?
app.properties
file contains below lines:
baseUrl = "https://www.google.com/";
browser="chrome";