Search in sources :

Example 6 with InternetExplorerDriverService

use of org.openqa.selenium.ie.InternetExplorerDriverService in project jmeter-plugins by undera.

the class InternetExplorerDriverConfigTest method shouldNotCreateInternetExplorerWhenStartingServiceThrowsAnException.

@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();
}
Also used : InternetExplorerDriver(org.openqa.selenium.ie.InternetExplorerDriver) InternetExplorerDriverService(org.openqa.selenium.ie.InternetExplorerDriverService) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 7 with InternetExplorerDriverService

use of org.openqa.selenium.ie.InternetExplorerDriverService in project jmeter-plugins by undera.

the class InternetExplorerDriverConfigTest method shouldNotStopServiceIfNotRunningWhenQuitBrowserIsInvoked.

@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();
}
Also used : InternetExplorerDriver(org.openqa.selenium.ie.InternetExplorerDriver) InternetExplorerDriverService(org.openqa.selenium.ie.InternetExplorerDriverService) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 8 with InternetExplorerDriverService

use of org.openqa.selenium.ie.InternetExplorerDriverService in project selenium_java by sergueik.

the class IEDriverFactory method newInstance.

@Override
public WebDriver newInstance(DriverOptions driverOptions) {
    if (!OS.isFamilyWindows())
        throw new UnsupportedOperationException("Unsupported platform: " + Platform.getCurrent());
    InternetExplorerDriverService service = setupBuilder(new InternetExplorerDriverService.Builder(), driverOptions, IEDRIVER).build();
    InternetExplorerOptions options = newInternetExplorerOptions(driverOptions);
    options.merge(driverOptions.getCapabilities());
    InternetExplorerDriver driver = new InternetExplorerDriver(service, options);
    setInitialWindowSize(driver, driverOptions);
    return driver;
}
Also used : InternetExplorerDriver(org.openqa.selenium.ie.InternetExplorerDriver) InternetExplorerDriverService(org.openqa.selenium.ie.InternetExplorerDriverService) InternetExplorerOptions(org.openqa.selenium.ie.InternetExplorerOptions)

Aggregations

InternetExplorerDriverService (org.openqa.selenium.ie.InternetExplorerDriverService)8 InternetExplorerDriver (org.openqa.selenium.ie.InternetExplorerDriver)6 Test (org.junit.Test)5 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)5 File (java.io.File)1 IOException (java.io.IOException)1 Capabilities (org.openqa.selenium.Capabilities)1 InternetExplorerOptions (org.openqa.selenium.ie.InternetExplorerOptions)1