Program Syntax:
Pre-requisites:
Step 1:
Import the below in required class:
using OpenQA.Selenium;
using ImageFormat = System.Drawing.Imaging.ImageFormat;
using OpenQA.Selenium.Appium;
using
OpenQA.Selenium.Appium.Android;
Step 2:
Create a
folder to save all screenshots in the system and provide the same system path in
the below test code.
Test Syntax:
public void getScreenShotMobile(AppiumDriver<AndroidElement> appdriver, long testCaseId)
{
Screenshot image = ((ITakesScreenshot)appdriver).GetScreenshot();
image.SaveAsFile(string.Format("C:\\<SystemPath>\\{0}.Png", getcurrentTime()+"_"+ testCaseId), ScreenshotImageFormat.Png);
}
The above test code will capture screenshots in the mobile devices and save it in the system where test scripts are run and executed.