title: RemoteWebDriver cannot be cast to org.openqa.selenium.TakesScreenshot (Java)
body: <p>I'm trying to take a screenshot with RemoteWebDriver of <a href="https://github.com/2gis/Winium.Desktop/wiki" rel="nofollow noreferrer">Winium.Desktop</a>.
  As RemoteWebDriver does not implement TakesScreenshot I declared the object as WebDriver.</p>
  
  <pre><code>WebDriver driver = new RemoteWebDriver(new URL(remoteUrl), desiredCapabilities);
  
  WebDriver augmentedDriver = new Augmenter().augment(driver);
  File screenshot = ((TakesScreenshot) augmentedDriver).getScreenshotAs(OutputType.FILE);
  </code></pre>
  
  <p>When I try to cast it to I get:
  java.lang.ClassCastException: org.openqa.selenium.remote.RemoteWebDriver cannot be cast to org.openqa.selenium.TakesScreenshot</p>
  
  <p>When I print the driver class name I get RemoteWebDriver although it was declared as WebDriver.</p>
  
  <p>What am I missing?</p>