This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
package zacksolutions.base;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
@@ -7,23 +8,24 @@ import com.aventstack.extentreports.reporter.ExtentSparkReporter;
|
||||
import com.aventstack.extentreports.ExtentReports;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.chrome.ChromeDriver;
|
||||
import org.openqa.selenium.chrome.ChromeOptions;
|
||||
import org.openqa.selenium.firefox.FirefoxDriver;
|
||||
|
||||
public class Initialization {
|
||||
//let's set up our variables
|
||||
// let's set up our variables
|
||||
|
||||
public static WebDriver driver;
|
||||
public static Properties prop;
|
||||
public static ExtentReports extent;
|
||||
public static ExtentTest test;
|
||||
|
||||
|
||||
public Initialization() {
|
||||
// let's use the config.properties file to set up our global variables...
|
||||
try {
|
||||
|
||||
prop = new Properties();
|
||||
FileInputStream fis = new FileInputStream(System.getProperty("user.dir") + "/src/main/java/zacksolutions/config/config.properties");
|
||||
FileInputStream fis = new FileInputStream(
|
||||
System.getProperty("user.dir") + "/src/main/java/zacksolutions/config/config.properties");
|
||||
prop.load(fis);
|
||||
|
||||
} catch (IOException e) {
|
||||
@@ -34,7 +36,7 @@ public class Initialization {
|
||||
}
|
||||
|
||||
public void BrowserInit() {
|
||||
//our EXTENTREPORTS SETUP!
|
||||
// our EXTENTREPORTS SETUP!
|
||||
|
||||
String path = System.getProperty("user.dir") + "/reports/index.html";
|
||||
ExtentSparkReporter spark = new ExtentSparkReporter(path);
|
||||
@@ -44,20 +46,25 @@ public class Initialization {
|
||||
extent.attachReporter(spark);
|
||||
extent.setSystemInfo("Tester ID: ", "Sami");
|
||||
|
||||
//conditioning our WebDriver with an if statement
|
||||
// conditioning our WebDriver with an if statement
|
||||
String browsername = prop.getProperty("browserC");
|
||||
|
||||
//launching FireFox
|
||||
// launching FireFox
|
||||
if (browsername.equalsIgnoreCase("firefox")) {
|
||||
System.setProperty("web-driver.gecko.driver","user.dir" + "/drivers/geckodriver");
|
||||
driver = new FirefoxDriver();
|
||||
// System.setProperty("web-driver.gecko.driver","user.dir" +
|
||||
// "/drivers/geckodriver");
|
||||
// driver = new FirefoxDriver();
|
||||
driver.get(prop.getProperty("url"));
|
||||
}
|
||||
|
||||
//launching Chrome
|
||||
// launching Chrome
|
||||
if (browsername.equalsIgnoreCase("chrome")) {
|
||||
System.setProperty("web-driver.gecko.driver", "user.dir" + "/drivers/chromedriver");
|
||||
driver = new ChromeDriver();
|
||||
// System.setProperty("web-driver.gecko.driver", "user.dir" +
|
||||
// "/drivers/chromedriver");
|
||||
// driver = new ChromeDriver();
|
||||
ChromeOptions options = new ChromeOptions();
|
||||
options.addArguments("--headless");
|
||||
driver = new ChromeDriver(options);
|
||||
driver.get(prop.getProperty("url"));
|
||||
}
|
||||
driver.manage().window().maximize();
|
||||
|
||||
Reference in New Issue
Block a user