Professional Documents
Culture Documents
Base Class
Base Class
Base Class
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Parameters;
@Parameters({"browser","URL"})
@BeforeTest
public void InitialDriver(String browsername,String Site) throws IOException
{
/*
* Properties pro = new Properties(); FileInputStream fis = new
FileInputStream(
* "./property/data.properties"); pro.load(fis);
*/
if (browsername.equalsIgnoreCase("Chrome")) {
System.setProperty("webdriver.chrome.driver",
"./Drivers/chromedriver.exe");
else if (browsername.equalsIgnoreCase("IE")) {
System.setProperty("webdriver.ie.driver",
"./Drivers/IEDriverServer.exe");
driver = new InternetExplorerDriver();
} else if (browsername.equalsIgnoreCase("Firefox")) {
System.setProperty("webdriver.gecko.driver",
"./Drivers/geckodriver.exe");
driver = new InternetExplorerDriver();
driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
driver.manage().window().maximize();
driver.get(URL)
@AfterTest
public void closedriver() {
driver.close();
driver.quit();
}