title: Taking screenshot with java
body: <p>I am testing a game inside a web page , the code i am using is</p>
  
  <pre><code> private void takeScreenShot(String screenShotName) {
          File path = new File("/Users/myUser");
          String extension = ".jpg";
          File screenShot = new File(path+"/"+screenShotName );
          File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
          try {
              FileUtils.copyFile(scrFile, screenShot);
          } catch (IOException e) {
              e.printStackTrace();
          }
      }
  </code></pre>
  
  <p>and the screenshot comes out like this(i have been using the same code for many applications with no problems), i am using this code on OS X.</p>
  
  <p><a href="https://i.stack.imgur.com/QhzIl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QhzIl.png" alt="Wrong Screenshot"></a></p>