Interview Questions

Selenium WebDriver - How do you take screen shot without using EventFiringWebDriver ?

Selenium WebDriver Interview question and Answers


(Continued from previous question...)

Selenium WebDriver - How do you take screen shot without using EventFiringWebDriver ?

File srcFile = ((TakeScreenshot)driver).getScreenshotAs(OutputType.FILE); //now we can do anything with this screenshot like copy this to any folder- FileUtils.copyFile(srcFile,new File(“folder name where u want to copy/file_name.png”));

File srcFile = ((TakeScreenshot)driver).getScreenshotAs(OutputType.FILE); //now we can do anything with this screenshot

like copy this to any folder-

FileUtils.copyFile(srcFile,new File(“folder name where u want to copy/file_name.png”));

(Continued on next question...)

Other Interview Questions