Page tree
Skip to end of metadata
Go to start of metadata

void capture(Line)

void capture()

Supported in iOS Supported in Android


Enables you to capture a screenshot of the device in a given time. The captured screenshot will be a full resolution and quality image of the device.


  • Optional parameter:
    • Line: Name of the step on the report


Command returns a string which represent the path to the image location during runtime. This image will be deleted once GenerateReport is executed and will move to the report folder.


  • Optional parameter:
    • Line: Name of the step on the report

    On the generated report, the step with the following capture command will be added as a separate command with screenshot as shown below


Scenario: The following code shows how to use a captured screenshot during runtime. We will copy the screenshot that gets generated into the desired folder. Afterwards, we can use it as per your business requirements.

package testCapture;
//package <set your test package>;;
import static java.nio.file.StandardCopyOption.*;
import java.nio.file.Path;
import java.nio.file.Files;
import com.experitest.client.*;
import org.junit.*;
public class testCapture {
	private String host = "localhost";
    private int port = 8889;
    private String projectBaseDirectory = "C:\\Users\\user_12\\workspace\\project3";
    protected Client client = null;
    public void setUp(){
        client = new Client(host, port, true);
        client.setReporter("xml", "reports", "Untitled");
    public void testCapture123() throws IOException{
        client.setDevice("adb:samsung SM-N7505");
        String str0 = client.capture("Capture");
        Path psource =new File(str0).toPath();
        Path pdest =new File("C:\\Temp\\"+"Device reflection at the beginning of test.png").toPath();

    public void tearDown(){
  • No labels