package zacksolutions.base;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class Initialization {
  public static WebDriver driver;
  public static Properties prop;

  public Initialization() {

    try {

      prop = new Properties();
      FileInputStream fis = new FileInputStream("/home/ilyes/SeleniumPractice/Zenful/src/main/java/zacksolutions/config/config.properties");
      prop.load(fis);

    } catch (FileNotFoundException e) {
      // TODO: handle exception
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }

  }

  public void BrowserInit() {
    String browsername = prop.getProperty("browserF");
    if (browsername.equalsIgnoreCase("firefox")) {
      System.setProperty("web-driver.gecko.driver","/home/ilyes/SeleniumPractice/Zenful/drivers/geckodriver");
      driver = new FirefoxDriver();
      driver.get(prop.getProperty("url"));
    }
  }
}
