diff --git a/java/client/src/org/openqa/selenium/remote/RemoteWebDriver.java b/java/client/src/org/openqa/selenium/remote/RemoteWebDriver.java index 18f4f797cad89..9558f69ce6759 100644 --- a/java/client/src/org/openqa/selenium/remote/RemoteWebDriver.java +++ b/java/client/src/org/openqa/selenium/remote/RemoteWebDriver.java @@ -126,18 +126,6 @@ public RemoteWebDriver(CommandExecutor executor, Capabilities capabilities) { ((NeedsLocalLogs)executor).setLocalLogs(localLogs); } - try { - startClient(capabilities); - } catch (RuntimeException e) { - try { - stopClient(capabilities); - } catch (Exception ignored) { - // Ignore the clean-up exception. We'll propagate the original failure. - } - - throw e; - } - try { startSession(capabilities); } catch (RuntimeException e) { @@ -259,48 +247,6 @@ protected void startSession(Capabilities capabilities) { sessionId = new SessionId(response.getSessionId()); } - /** - * Method called before {@link #startSession(Capabilities) starting a new session}. The default - * implementation is a no-op, but subtypes should override this method to define custom behavior. - * - * @deprecated No longer used, as behaviour is now in {@link CommandExecutor} instances. - */ - @Deprecated - protected void startClient() { - } - - /** - * Method called before {@link #startSession(Capabilities) starting a new session}. The default - * implementation is a no-op, but subtypes should override this method to define custom behavior. - * - * @deprecated No longer used, as behaviour is now in {@link CommandExecutor} instances. - */ - @Deprecated - protected void startClient(Capabilities capabilities) { - startClient(); - } - - /** - * Method called after executing a {@link #quit()} command. The default implementation is a no-op, - * but subtypes should override this method to define custom behavior. - * - * @deprecated No longer used, as behaviour is now in {@link CommandExecutor} instances. - */ - @Deprecated - protected void stopClient() { - } - - /** - * Method called after executing a {@link #quit()} command. The default implementation is a no-op, - * but subtypes should override this method to define custom behavior. - * - * @deprecated No longer used, as behaviour is now in {@link CommandExecutor} instances. - */ - @Deprecated - protected void stopClient(Capabilities capabilities) { - stopClient(); - } - public ErrorHandler getErrorHandler() { return errorHandler; } @@ -497,7 +443,6 @@ public void quit() { execute(DriverCommand.QUIT); } finally { sessionId = null; - stopClient(); } } diff --git a/java/client/test/org/openqa/selenium/remote/RemoteWebDriverInitializationTest.java b/java/client/test/org/openqa/selenium/remote/RemoteWebDriverInitializationTest.java index 3273637a7e2d7..dbd98c6d171d0 100644 --- a/java/client/test/org/openqa/selenium/remote/RemoteWebDriverInitializationTest.java +++ b/java/client/test/org/openqa/selenium/remote/RemoteWebDriverInitializationTest.java @@ -40,20 +40,8 @@ @RunWith(JUnit4.class) public class RemoteWebDriverInitializationTest { - private boolean stopClientCalled = false; private boolean quitCalled = false; - @Test - public void testStopsClientIfStartClientFails() { - Throwable ex = TestUtilities.catchThrowable( - () -> new BadStartClientRemoteWebDriver(mock(CommandExecutor.class), - new ImmutableCapabilities())); - - assertNotNull(ex); - assertThat(ex.getMessage(), containsString("Stub client that should fail")); - assertTrue(stopClientCalled); - } - @Test public void testQuitsIfStartSessionFails() { Throwable ex = TestUtilities.catchThrowable( @@ -75,23 +63,6 @@ public void canHandleNonStandardCapabilitiesReturnedByRemoteEnd() throws IOExcep assertThat(driver.getCapabilities().getCapability("platform"), equalTo(Platform.UNIX)); } - private class BadStartClientRemoteWebDriver extends RemoteWebDriver { - public BadStartClientRemoteWebDriver(CommandExecutor executor, - Capabilities desiredCapabilities) { - super(executor, desiredCapabilities); - } - - @Override - protected void startClient() { - throw new RuntimeException("Stub client that should fail"); - } - - @Override - protected void stopClient() { - stopClientCalled = true; - } - } - private class BadStartSessionRemoteWebDriver extends RemoteWebDriver { public BadStartSessionRemoteWebDriver(CommandExecutor executor, Capabilities desiredCapabilities) {