Skip to content

Commit 45bd6ac

Browse files
committed
Remove aggregating interface
The underlying driver should be accessible via `WrapsDriver` rather than us needing a custom interface.
1 parent 87fdef6 commit 45bd6ac

File tree

3 files changed

+20
-29
lines changed

3 files changed

+20
-29
lines changed

java/client/src/org/openqa/selenium/remote/IsRemoteWebDriver.java

Lines changed: 0 additions & 23 deletions
This file was deleted.

java/client/src/org/openqa/selenium/remote/RemoteWebDriver.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,26 @@
2525
import org.openqa.selenium.Capabilities;
2626
import org.openqa.selenium.Cookie;
2727
import org.openqa.selenium.Dimension;
28+
import org.openqa.selenium.HasCapabilities;
2829
import org.openqa.selenium.ImmutableCapabilities;
30+
import org.openqa.selenium.JavascriptExecutor;
2931
import org.openqa.selenium.MutableCapabilities;
3032
import org.openqa.selenium.NoSuchFrameException;
3133
import org.openqa.selenium.NoSuchWindowException;
3234
import org.openqa.selenium.OutputType;
3335
import org.openqa.selenium.Pdf;
3436
import org.openqa.selenium.Platform;
3537
import org.openqa.selenium.Point;
38+
import org.openqa.selenium.PrintsPage;
3639
import org.openqa.selenium.SearchContext;
3740
import org.openqa.selenium.SessionNotCreatedException;
41+
import org.openqa.selenium.TakesScreenshot;
3842
import org.openqa.selenium.WebDriver;
3943
import org.openqa.selenium.WebDriverException;
4044
import org.openqa.selenium.WebElement;
4145
import org.openqa.selenium.WindowType;
46+
import org.openqa.selenium.interactions.HasInputDevices;
47+
import org.openqa.selenium.interactions.Interactive;
4248
import org.openqa.selenium.interactions.Keyboard;
4349
import org.openqa.selenium.interactions.Mouse;
4450
import org.openqa.selenium.interactions.Sequence;
@@ -57,6 +63,7 @@
5763
import org.openqa.selenium.remote.tracing.Tracer;
5864
import org.openqa.selenium.remote.tracing.opentelemetry.OpenTelemetryTracer;
5965
import org.openqa.selenium.virtualauthenticator.Credential;
66+
import org.openqa.selenium.virtualauthenticator.HasVirtualAuthenticator;
6067
import org.openqa.selenium.virtualauthenticator.VirtualAuthenticator;
6168
import org.openqa.selenium.virtualauthenticator.VirtualAuthenticatorOptions;
6269

@@ -87,7 +94,14 @@
8794
import static org.openqa.selenium.remote.CapabilityType.SUPPORTS_JAVASCRIPT;
8895

8996
@Augmentable
90-
public class RemoteWebDriver implements IsRemoteWebDriver {
97+
public class RemoteWebDriver implements WebDriver,
98+
JavascriptExecutor,
99+
HasInputDevices,
100+
HasCapabilities,
101+
HasVirtualAuthenticator,
102+
Interactive,
103+
PrintsPage,
104+
TakesScreenshot {
91105

92106
// TODO: This static logger should be unified with the per-instance localLogs
93107
private static final Logger logger = Logger.getLogger(RemoteWebDriver.class.getName());
@@ -218,7 +232,6 @@ public void setFileDetector(FileDetector detector) {
218232
fileDetector = detector;
219233
}
220234

221-
@Override
222235
public SessionId getSessionId() {
223236
return sessionId;
224237
}

java/client/test/org/openqa/selenium/support/decorators/DecoratedRemoteWebDriverTest.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import org.openqa.selenium.WrapsElement;
2727
import org.openqa.selenium.json.Json;
2828
import org.openqa.selenium.remote.Dialect;
29-
import org.openqa.selenium.remote.IsRemoteWebDriver;
3029
import org.openqa.selenium.remote.RemoteWebDriver;
3130
import org.openqa.selenium.remote.RemoteWebElement;
3231
import org.openqa.selenium.remote.SessionId;
@@ -45,14 +44,16 @@
4544
public class DecoratedRemoteWebDriverTest {
4645

4746
@Test
48-
public void canConvertDecoratedToRemoteWebDriverInterface() {
47+
public void shouldImplementWrapsDriverToProvideAccessToUnderlyingDriver() {
4948
SessionId sessionId = new SessionId(UUID.randomUUID());
5049
RemoteWebDriver originalDriver = mock(RemoteWebDriver.class);
5150
when(originalDriver.getSessionId()).thenReturn(sessionId);
5251

53-
IsRemoteWebDriver decoratedDriver = (IsRemoteWebDriver) new WebDriverDecorator().decorate(originalDriver);
52+
WebDriver decoratedDriver = new WebDriverDecorator().decorate(originalDriver);
53+
54+
RemoteWebDriver underlying = (RemoteWebDriver) ((WrapsDriver) decoratedDriver).getWrappedDriver();
5455

55-
assertThat(decoratedDriver.getSessionId()).isEqualTo(sessionId);
56+
assertThat(underlying.getSessionId()).isEqualTo(sessionId);
5657
}
5758

5859
@Test

0 commit comments

Comments
 (0)