private WebDriver createLocalWebDriver ( String browserType ) { switch ( browserType ) { case BrowserType . FIREFOX : FirefoxProfile firefoxProfile = getEndpointConfiguration ( ) . getFirefoxProfile ( ) ; /* set custom download folder */ firefoxProfile . setPreference ( "browser.download.dir" , temporaryStorage . toFile ( ) . getAbsolutePath ( ) ) ; DesiredCapabilities defaults = DesiredCapabilities . firefox ( ) ; defaults . setCapability ( FirefoxDriver . PROFILE , firefoxProfile ) ; return new FirefoxDriver ( defaults ) ; case BrowserType . IE : return new InternetExplorerDriver ( ) ; case BrowserType . EDGE : return new EdgeDriver ( ) ; case BrowserType . SAFARI : return new SafariDriver ( ) ; case BrowserType . CHROME : return new ChromeDriver ( ) ; case BrowserType . GOOGLECHROME : return new ChromeDriver ( ) ; case BrowserType . HTMLUNIT : BrowserVersion browserVersion = null ; if ( getEndpointConfiguration ( ) . getVersion ( ) . equals ( "FIREFOX" ) ) { browserVersion = BrowserVersion . FIREFOX_45 ; } else if ( getEndpointConfiguration ( ) . getVersion ( ) . equals ( "INTERNET_EXPLORER" ) ) { browserVersion = BrowserVersion . INTERNET_EXPLORER ; } else if ( getEndpointConfiguration ( ) . getVersion ( ) . equals ( "EDGE" ) ) { browserVersion = BrowserVersion . EDGE ; } else if ( getEndpointConfiguration ( ) . getVersion ( ) . equals ( "CHROME" ) ) { browserVersion = BrowserVersion . CHROME ; } HtmlUnitDriver htmlUnitDriver ; if ( browserVersion != null ) { htmlUnitDriver = new HtmlUnitDriver ( browserVersion ) ; } else { htmlUnitDriver = new HtmlUnitDriver ( ) ; } htmlUnitDriver . setJavascriptEnabled ( getEndpointConfiguration ( ) . isJavaScript ( ) ) ; return htmlUnitDriver ; default : throw new CitrusRuntimeException ( "Unsupported local browser type: " + browserType ) ; } }
Creates local web driver .