Farid S
0
Q:

windows screenshot

Press the Windows key + Shift + S. The screen will dim and the mouse pointer will change. You can drag to select a portion of the screen to capture. The screenshot will be copied to the clipboard, which you can paste into another program. (This shortcut only works if you have the latest version of Windows 10 installed, called the Windows 10 Creators Update.)
0
I have a tearDown method in my Hooks Class. I keep my screenshot codes in it. 
It takes screenshot as soon as any scenario fails.

	@After
	public void tearDown(Scenario scenario) { 
        if(scenario.isFailed()) {
    	TakesScreenshot screen=(TakesScreenshot)Driver.getDriver();
        final byte[] screenshot = screen.getScreenshotAs(OutputType.BYTES); ==>
        taking screenshot
        scenario.embed(screenshot, "image/png");  ==> adding screenshot to
        the report 
    	}
	}
    
    
    HOW TO TAKE SCREENSHOT IN ANY TEST CASE WITHOUT FAILURE

        TakesScreenshot screen=(TakesScreenshot)Driver.getDriver();
        File screenshot=screen.getScreenshotAs(OutputType.FILE);
        FileUtils.copyFile(screenshot, new File("<your folder path here>"));

0

---------- Screenshot on WINDOW ----------------

>> Windows + Shift + S

---------- Screenshot on MAC ----------------

>> Shift + Command + 4 
 
0
To Take a Screenshot of Only One Window
Click on the title bar of the window that you want to capture. 
Press “Alt + PrtScn”. A screenshot of your currently active window will be copied to the clipboard
just as in the last section. 
Paste it into your favorite image editor or document editor.
-2

New to Communities?

Join the community