org.openqa.selenium.ie.InternetExplorerDriverService Java Examples
The following examples show how to use
org.openqa.selenium.ie.InternetExplorerDriverService.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Browser.java From coteafs-selenium with Apache License 2.0 | 6 votes |
private static WebDriver setupIeDriver() throws MalformedURLException { LOG.i("Setting up Internet Explorer driver..."); setupDriver(iedriver()); final InternetExplorerOptions ieOptions = new InternetExplorerOptions(); ieOptions.destructivelyEnsureCleanSession(); ieOptions.setCapability("requireWindowFocus", true); ieOptions.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true); final InternetExplorerDriverService ieService = InternetExplorerDriverService.createDefaultService(); if (!OS.isWindows()) { Assert.fail("IE is not supported."); } if (appSetting().isHeadlessMode()) { LOG.w("IE does not support headless mode. Hence, ignoring the same..."); } return new InternetExplorerDriver(ieService, ieOptions); }
Example #2
Source File: InternetExplorerDriverConfigTest.java From jmeter-plugins-webdriver with Apache License 2.0 | 6 votes |
@Test public void shouldCreateInternetExplorerAndStartService() throws Exception { InternetExplorerDriver mockInternetExplorerDriver = mock(InternetExplorerDriver.class); whenNew(InternetExplorerDriver.class).withParameterTypes(InternetExplorerDriverService.class, Capabilities.class).withArguments(isA(InternetExplorerDriverService.class), isA(Capabilities.class)).thenReturn(mockInternetExplorerDriver); InternetExplorerDriverService.Builder mockServiceBuilder = mock(InternetExplorerDriverService.Builder.class); whenNew(InternetExplorerDriverService.Builder.class).withNoArguments().thenReturn(mockServiceBuilder); when(mockServiceBuilder.usingDriverExecutable(isA(File.class))).thenReturn(mockServiceBuilder); InternetExplorerDriverService mockService = mock(InternetExplorerDriverService.class); when(mockServiceBuilder.build()).thenReturn(mockService); final InternetExplorerDriver browser = config.createBrowser(); assertThat(browser, is(mockInternetExplorerDriver)); verifyNew(InternetExplorerDriver.class, times(1)).withArguments(isA(InternetExplorerDriverService.class), isA(Capabilities.class)); verify(mockServiceBuilder, times(1)).build(); assertThat(config.getServices().size(), is(1)); assertThat(config.getServices().values(), hasItem(mockService)); }
Example #3
Source File: InternetExplorerDriverConfig.java From jmeter-plugins-webdriver with Apache License 2.0 | 5 votes |
@Override public void quitBrowser(final InternetExplorerDriver browser) { super.quitBrowser(browser); final InternetExplorerDriverService service = services.remove(currentThreadName()); if (service != null && service.isRunning()) { service.stop(); } }
Example #4
Source File: InternetExplorerDriverConfig.java From jmeter-plugins-webdriver with Apache License 2.0 | 5 votes |
private InternetExplorerDriverService getThreadService() { InternetExplorerDriverService service = services.get(currentThreadName()); if (service != null) { return service; } try { service = new InternetExplorerDriverService.Builder().usingDriverExecutable(new File(getInternetExplorerDriverPath())).build(); service.start(); services.put(currentThreadName(), service); } catch (IOException e) { LOGGER.error("Failed to start chrome service"); service = null; } return service; }
Example #5
Source File: InternetExplorerDriverConfigTest.java From jmeter-plugins-webdriver with Apache License 2.0 | 5 votes |
@Test public void shouldNotCreateInternetExplorerWhenStartingServiceThrowsAnException() throws Exception { InternetExplorerDriverService.Builder mockServiceBuilder = mock(InternetExplorerDriverService.Builder.class); whenNew(InternetExplorerDriverService.Builder.class).withNoArguments().thenReturn(mockServiceBuilder); when(mockServiceBuilder.usingDriverExecutable(isA(File.class))).thenReturn(mockServiceBuilder); InternetExplorerDriverService mockService = mock(InternetExplorerDriverService.class); when(mockServiceBuilder.build()).thenReturn(mockService); doThrow(new IOException("Stubbed exception")).when(mockService).start(); final InternetExplorerDriver browser = config.createBrowser(); assertThat(browser, is(nullValue())); assertThat(config.getServices(), is(Collections.<String, InternetExplorerDriverService>emptyMap())); verify(mockServiceBuilder, times(1)).build(); }
Example #6
Source File: InternetExplorerDriverConfigTest.java From jmeter-plugins-webdriver with Apache License 2.0 | 5 votes |
@Test public void shouldQuitWebDriverAndStopServiceWhenQuitBrowserIsInvoked() throws Exception { InternetExplorerDriver mockInternetExplorerDriver = mock(InternetExplorerDriver.class); InternetExplorerDriverService mockService = mock(InternetExplorerDriverService.class); when(mockService.isRunning()).thenReturn(true); config.getServices().put(config.currentThreadName(), mockService); config.quitBrowser(mockInternetExplorerDriver); verify(mockInternetExplorerDriver).quit(); assertThat(config.getServices(), is(Collections.<String, InternetExplorerDriverService>emptyMap())); verify(mockService, times(1)).stop(); }
Example #7
Source File: InternetExplorerDriverConfigTest.java From jmeter-plugins-webdriver with Apache License 2.0 | 5 votes |
@Test public void shouldNotStopServiceIfNotRunningWhenQuitBrowserIsInvoked() throws Exception { InternetExplorerDriver mockInternetExplorerDriver = mock(InternetExplorerDriver.class); InternetExplorerDriverService mockService = mock(InternetExplorerDriverService.class); when(mockService.isRunning()).thenReturn(false); config.getServices().put(config.currentThreadName(), mockService); config.quitBrowser(mockInternetExplorerDriver); verify(mockInternetExplorerDriver).quit(); assertThat(config.getServices(), is(Collections.<String, InternetExplorerDriverService>emptyMap())); verify(mockService, times(0)).stop(); }
Example #8
Source File: InternetExplorerDriverConfigTest.java From jmeter-plugins-webdriver with Apache License 2.0 | 5 votes |
@Test public void shouldBeAbleToCallQuitBrowserMultipleTimes() throws Exception { InternetExplorerDriver mockInternetExplorerDriver = mock(InternetExplorerDriver.class); InternetExplorerDriverService mockService = mock(InternetExplorerDriverService.class); when(mockService.isRunning()).thenReturn(true); config.getServices().put(config.currentThreadName(), mockService); config.quitBrowser(mockInternetExplorerDriver); config.quitBrowser(mockInternetExplorerDriver); assertThat(config.getServices(), is(Collections.<String, InternetExplorerDriverService>emptyMap())); verify(mockService, times(1)).stop(); }
Example #9
Source File: IEWebDriverProxy.java From marathonv5 with Apache License 2.0 | 5 votes |
@Override public DriverService createService(int port) { InternetExplorerDriverService.Builder builder = new InternetExplorerDriverService.Builder(); BrowserConfig config = BrowserConfig.instance(); String wdPath = config.getValue(BROWSER, "webdriver-exe-path"); if (wdPath != null) builder.usingDriverExecutable(new File(wdPath)); String environ = config.getValue(BROWSER, "browser-environment"); if (environ != null) { Map<String, String> envMap = new HashMap<>(); BufferedReader reader = new BufferedReader(new StringReader(environ)); String line = null; try { while ((line = reader.readLine()) != null) { String[] parts = line.split("="); if (parts != null && parts.length == 2) { envMap.put(parts[0], parts[1]); } } } catch (IOException e) { } builder.withEnvironment(envMap); } String logFile = config.getValue(BROWSER, "webdriver-log-file-path"); if (logFile != null) { builder.withLogFile(new File(logFile)); } String logLevel = config.getValue(BROWSER, "webdriver-ie-log-level"); if (logLevel != null) builder.withLogLevel(InternetExplorerDriverLogLevel.valueOf(logLevel)); builder.withSilent(config.getValue(BROWSER, "webdriver-silent", true)); return builder.usingPort(port).build(); }
Example #10
Source File: LocallyBuiltInternetExplorerDriver.java From selenium with Apache License 2.0 | 5 votes |
private static InternetExplorerDriverService getService() { new Build().of("//cpp/iedriverserver:win32").go(); InternetExplorerDriverService.Builder builder = new InternetExplorerDriverService.Builder() .usingDriverExecutable( InProject.locate("build/cpp/Win32/Release/IEDriverServer.exe", "cpp/prebuilt/Win32/Release/IEDriverServer.exe").toFile()) .usingAnyFreePort() .withLogFile(new File("iedriver.log")) .withLogLevel(InternetExplorerDriverLogLevel.valueOf( System.getProperty("log_level", "INFO"))); return builder.build(); }
Example #11
Source File: InternetExplorerDriverConfig.java From jmeter-plugins-webdriver with Apache License 2.0 | 4 votes |
Map<String, InternetExplorerDriverService> getServices() { return services; }
Example #12
Source File: InternetExplorerDriverConfig.java From jmeter-plugins-webdriver with Apache License 2.0 | 4 votes |
@Override protected InternetExplorerDriver createBrowser() { final InternetExplorerDriverService service = getThreadService(); return service != null ? new InternetExplorerDriver(service, createCapabilities()) : null; }
Example #13
Source File: InternetExplorerFactory.java From webtester-core with Apache License 2.0 | 4 votes |
public Browser createBrowser(int port) { InternetExplorerDriverService service = InternetExplorerDriverService.createDefaultService(); DesiredCapabilities capabilities = getDefaultCapabilities(); return createBrowser(new InternetExplorerDriver(service, capabilities, port)); }
Example #14
Source File: InternetExplorerBrowserFactory.java From darcy-webdriver with GNU General Public License v3.0 | 4 votes |
public InternetExplorerBrowserFactory usingService(InternetExplorerDriverService ieds) { service = ieds; return this; }