title: Take screenshot element in selenium on ubuntu wrong position
body: <p>When I change the environment from <strong>Windows 10 to Ubuntu</strong> and some function is not working good. Like that function take a screenshot</p>
  
  <p>Please help me find the solution take a screenshot on Ubuntu. When take a screenshot on Ubuntu the picture I think is the wrong position of the element. Thank you</p>
  
  <p><strong>Working for Windows 10</strong></p>
  
  <pre><code> public void captureElementScreenshot(WebElement element, String fileName) {
      //Capture entire page screenshot as buffer.
      //Used TakesScreenshot, OutputType Interface of selenium and File class of java to capture screenshot of entire page.
      File screen = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
  
      //Used selenium getSize() method to get height and width of element.
      //Retrieve width of element.
      int ImageWidth = element.getSize().getWidth();
      //Retrieve height of element.
      int ImageHeight = element.getSize().getHeight();
  
      //Used selenium Point class to get x y coordinates of Image element.
      //get location(x y coordinates) of the element.
      Point point = element.getLocation();
      int xcord = point.getX();
      int ycord = point.getY();
  
      //Reading full image screenshot.
      BufferedImage img = null;
      try {
          img = ImageIO.read(screen);
          BufferedImage dest = img.getSubimage(xcord, ycord, ImageWidth, ImageHeight);
          ImageIO.write(dest, "png", screen);
  
          //Used FileUtils class of apache.commons.io.
          //save Image screenshot In D: drive.
          FileUtils.copyFile(screen, new File(System.getProperty("user.dir") + "//src//test//screenshot//" + fileName + ".png"));
          System.out.println("Success save file " + fileName);
      } catch (IOException e) {
          e.printStackTrace();
      }
  
      //cut Image using height, width and x y coordinates parameters.
  
  }
  </code></pre>
  
  <p><strong>And this config browser</strong> </p>
  
  <pre><code> System.setProperty("webdriver.chrome.driver", System.getProperty("user.dir") + "//src//test//browser//chromedriver");
   DesiredCapabilities capabilities = DesiredCapabilities.chrome();
   ChromeOptions options = new ChromeOptions();
   options.addArguments("force-device-scale-factor=0.75");
   options.addArguments("high-dpi-support=0.75");
   capabilities.setCapability(ChromeOptions.CAPABILITY, options);
   driver = new ChromeDriver(capabilities);
   driver.manage().window().maximize();
  </code></pre>