I hope you all are doing fine.

Could you please help me in fixing this null pointer issue? I'm building a new Selenium framework in my company.
As mentioned below, I'm calling a method "StartBrowser()" in base class from browser class. My code is executing properly until "StartBrowser()" but after that, it's throwing null pointer exception.

Thank you so much in advance.

```
{
public WebDriver driver;

public WebDriver StartBrowser() throws IOException
{
    Properties prop=new Properties();
    FileInputStream fis=new FileInputStream(System.getProperty("user.dir")+"\\src\\main\\java\\config\\config.properties");
    prop.load(fis);
    String browserName=prop.getProperty("browser");
    String LADSurl=prop.getProperty("LADSurl");
    String GADSurl=prop.getProperty("GADSurl");
    String chromeDriverPath=prop.getProperty("ChromeDriverPath");
    System.out.println(browserName);

    if (browserName.equalsIgnoreCase("chrome"))
    {
        System.setProperty("webdriver.chrome.driver", chromeDriverPath);
        driver=new ChromeDriver();
    }
    else if(browserName.equalsIgnoreCase("firefox"))
    {   
    }
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
    driver.manage().window().maximize();
    return driver;
}

```

}

```
public class Base {
public static WebDriver driver;
BrowserFactory browser;
public static Properties prop;
public static String LADSurl;
public static String GADSurl;

enter code here

public static void setupPropertiesFile() throws IOException {
    Properties prop = new Properties();
    FileInputStream fis = new FileInputStream(
            System.getProperty("user.dir") + "\\src\\main\\java\\config\\config.properties");
    prop.load(fis);
    String browserName = prop.getProperty("browser");
    String LADSurl = prop.getProperty("LADSurl");
    String GADSurl = prop.getProperty("GADSurl");
    String chromeDriverPath = prop.getProperty("ChromeDriverPath");
}
public static void OpenApplication(String environment) throws IOException {
    BrowserFactory browser=new BrowserFactory();
    browser.StartBrowser();
    if (environment.equalsIgnoreCase("LADS")) {
        driver.get("www.google.com"); // Local ADS URL
    } else if (environment.equalsIgnoreCase("GADS")) {
        driver.get(GADSurl); // Global ADS URL
    } 

```

}

Console error:
Jul 26, 2020 1:49:05 PM cucumber.api.cli.Main run
WARNING: You are using deprecated Main class. Please use io.cucumber.core.cli.Main

Scenario: Create Student # src/test/resources/Features/CreateUsers.feature:3
chrome
Starting ChromeDriver 84.0.4147.30 (48b3e868b4cc0aa7e8149519690b6f6949e110a8-refs/branch-heads/4147@{#310}) on port 47410
Only local connections are allowed.
Please see <https://chromedriver.chromium.org/security-considerations> for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
Jul 26, 2020 1:49:09 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
Given User is on New User page # stepDefinitions.CreateUserSteps.user\_is\_on\_new\_user\_page()
java.lang.NullPointerException
at utils.Base.OpenApplication(Base.java:39)
at stepDefinitions.CreateUserSteps.user\_is\_on\_new\_user\_page(CreateUserSteps.java:38)
at âœ½.User is on New User page(file:///C:/Users/rgorilla/eclipse-workspace/ESA/src/test/resources/Features/CreateUsers.feature:4)

When User provide student information click Save User # stepDefinitions.CreateUserSteps.user\_provide\_student\_information\_click\_save\_user()
Then Validate user is created successfully # stepDefinitions.CreateUserSteps.validate\_user\_is\_created\_successfully()