Launching Browser With Different Ways with FIREFOX, CHROME, IE, SAFARI, OPERA
public WebDriver Launch()
{
String browser = getpropvalue("Browser");
if (browser.equalsIgnoreCase("ff"))
{
wdriver = new FirefoxDriver();
}
else if (browser.equalsIgnoreCase("chrome"))
{
ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-notifications");
System.setProperty("webdriver.chrome.driver", getpropvalue("chromepath"));
wdriver = new ChromeDriver(options);
wdriver.manage().window().maximize();
navigateToURL();
}
else if (browser.equalsIgnoreCase("ie"))
{
System.setProperty("webdriver.ie.driver", "./drivers/IEDriverServer_x32_v2.47.0.exe");
wdriver = new InternetExplorerDriver();
}
else if (browser.equalsIgnoreCase("safari"))
{
wdriver = new SafariDriver();
}
else if (browser.equalsIgnoreCase("opera"))
{
wdriver = new OperaDriver();
}
launchBrowser();
return wdriver;
}
No comments:
Post a Comment