List of usage examples for org.openqa.selenium.ie InternetExplorerDriver IE_SWITCHES
String IE_SWITCHES
To view the source code for org.openqa.selenium.ie InternetExplorerDriver IE_SWITCHES.
Click Source Link
From source file:com.sios.stc.coseng.util.Run.java
License:Open Source License
public synchronized WebDriver getWebDriver(final String testName) throws MalformedURLException { WebDriver driver = null;/* w ww. j a va2s . c o m*/ if (testName != null) { for (final TestParam p : param.testParam) { if (p.getTestName().equals(testName)) { // DesiredCapabilities // https://code.google.com/p/selenium/wiki/DesiredCapabilities // !! It is *not* necessary to start *any* of the browser driver // profiles to start 'private/icognito' as each new driver // instance starts with a *fresh* profile that does not persist // after the driver is quit. !! if (p.getBrowser().equals(Browser.FIREFOX)) { final FirefoxProfile profile = new FirefoxProfile(); final DesiredCapabilities dc = DesiredCapabilities.firefox(); if (p.getPlatform().equals(Platform.LINUX)) { // Explicitly enable native events(this is mandatory on Linux system, // since they are not enabled by default. profile.setEnableNativeEvents(true); dc.setPlatform(p.getPlatform()); dc.setCapability(Common.BROWSER_CAPABILITY_FIREFOX_PROFILE, profile); } if (p.getSpot().equals(Spot.LOCAL)) { driver = new FirefoxDriver(profile); } else { driver = new RemoteWebDriver(new URL(p.getSeleniumGridUrl()), dc); } } else if (p.getBrowser().equals(Browser.CHROME)) { final DesiredCapabilities dc = DesiredCapabilities.chrome(); dc.setPlatform(p.getPlatform()); if (p.getSpot().equals(Spot.LOCAL)) { driver = new ChromeDriver(); } else { driver = new RemoteWebDriver(new URL(p.getSeleniumGridUrl()), dc); } } else if (p.getBrowser().toString().toLowerCase().startsWith("ie")) { final DesiredCapabilities dc = DesiredCapabilities.internetExplorer(); dc.setBrowserName(Common.BROWSER_NAME_INTERNET_EXPLORER); dc.setPlatform(p.getPlatform()); // IE8 and newer; Make sure // HKEY_USERS\.Default\Software\Microsoft\Internet // Explorer has DWORD TabProcGrowth set 0 // Launch separate process in 'private' mode. dc.setCapability(InternetExplorerDriver.FORCE_CREATE_PROCESS, true); dc.setCapability(InternetExplorerDriver.IE_SWITCHES, "-private"); //dc.setCapability(InternetExplorerDriver.LOG_FILE, // "C:/iedriver.log"); //dc.setCapability(InternetExplorerDriver.LOG_LEVEL, // "DEBUG"); dc.setCapability(InternetExplorerDriver.NATIVE_EVENTS, true); // dc.setCapability( // InternetExplorerDriver.REQUIRE_WINDOW_FOCUS, // true); // If *is* a specific IE9, IE10, IE11 (not IE) set the version if (!p.getBrowser().equals(Browser.IE)) { dc.setVersion(p.getBrowser().getVersion()); } if (p.getSpot().equals(Spot.LOCAL)) { driver = new InternetExplorerDriver(); } else { driver = new RemoteWebDriver(new URL(p.getSeleniumGridUrl()), dc); } } } // Collect the driver for quit after tests complete if (driver != null) { collectDriver(driver); } } } return driver; }