xxxxxxxxxx
//create object of TakesScreenshot Interface with webdriver type
TakesScreenshot ts = (TakesScreenshot)webdriver;
//call a method of TakeScreenShot Interface to capture img
File SrcFile = ts.getScreenshotAs(OutputType.FILE);
//now we just have make copy of it to store
File destination = new File(pathOfFile);
//use
FileUtils.copy(SrcFile, destination);
//or this
FileHandler.copy(srcFile, destination);
xxxxxxxxxx
spark = SparkSession.builder.getOrCreate();
spark.sparkContext().setLogLevel("OFF");