private DesiredCapabilities getDescription(WebDriver instance, Capabilities capabilities) { DesiredCapabilities caps = new DesiredCapabilities(capabilities.asMap()); caps.setJavascriptEnabled(instance instanceof JavascriptExecutor); if (instance instanceof TakesScreenshot) { caps.setCapability(CapabilityType.TAKES_SCREENSHOT, true); } if (instance instanceof LocationContext) { caps.setCapability(CapabilityType.SUPPORTS_LOCATION_CONTEXT, true); } if (instance instanceof ApplicationCache) { caps.setCapability(CapabilityType.SUPPORTS_APPLICATION_CACHE, true); } if (instance instanceof NetworkConnection) { caps.setCapability(CapabilityType.SUPPORTS_NETWORK_CONNECTION, true); } if (instance instanceof WebStorage) { caps.setCapability(CapabilityType.SUPPORTS_WEB_STORAGE, true); } if (instance instanceof FindsByCssSelector) { caps.setCapability(CapabilityType.SUPPORTS_FINDING_BY_CSS, true); } if (instance instanceof Rotatable) { caps.setCapability(CapabilityType.ROTATABLE, true); } if (instance instanceof HasTouchScreen) { caps.setCapability(CapabilityType.HAS_TOUCHSCREEN, true); } return caps; }
@Override public ScreenOrientation getOrientation() { return ((Rotatable) super.getWrappedDriver()).getOrientation(); }
@Override public void rotate(DeviceRotation deviceRotation) { ((Rotatable) super.getWrappedDriver()).rotate(deviceRotation); }
@Override public DeviceRotation rotation() { return ((Rotatable) super.getWrappedDriver()).rotation(); }
@Override public void rotate(ScreenOrientation screenOrientation) { ((Rotatable) super.getWrappedDriver()).rotate(screenOrientation); }
@Override public Void call() throws Exception { ((Rotatable) getUnwrappedDriver()).rotate(orientation); return null; }
@Override public ScreenOrientation call() throws Exception { return ((Rotatable) getUnwrappedDriver()).getOrientation(); }