我正在使用 Selendroid 来测试我的应用程序。在每个测试开始时,我使用以下函数运行 adb shell screenrecord:
public static Process startScreenRecord(String fileName) throws IOException{
ProcessBuilder builder = new ProcessBuilder(
"cmd.exe", "/c", "cd C:\\Users\\user\\Downloads\\adt-bundle-windows-x86_64-20140702\\adt-bundle-windows-x86_64-20140702\\sdk\\platform-tools\\ && adb shell screenrecord /sdcard/" + fileName);
builder.redirectErrorStream(true);
Process p = builder.start();
return p;
}
录制开始,一切正常。在每次测试结束时,我尝试通过以下代码停止记录:
public static void stopScreenRecord(Process p) throws IOException{
p.destroy();
}
在测试中我使用以下结构:
Process p = CmdHelper.startScreenRecord("e1.mp4");
//TestCode
CmdHelper.stopScreenRecord(p);
问题是视频录制不会停止。如何在每次测试结束时停止通话录音?