Skip to content

Instantly share code, notes, and snippets.

Last active March 18, 2020 17:55
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save grndvl1/62804d401766207d293e1bb3b0885150 to your computer and use it in GitHub Desktop.
Record Video Using Appium
// So I found out that its not easy to do this without the right code.
// Funny thing is that it puts a recording on the phone with some random name.mp4
// The hard thing was actually saving it locally.
// When you stop the recording its in a string 64 base you have to decode and then write that byte array to a file.
protected void screenRecordVideo() throws InterruptedException, IOException {
if (platform == OperatingSystem.ANDROID) {
new AndroidStartScreenRecordingOptions()
} else {
// not supported for iOS
String base64String = ((CanRecordScreen)driver).stopRecordingScreen();
byte[] decode = Base64.decodeBase64(base64String);
FileUtils.writeByteArrayToFile(new File("androidclip.mp4"), decode);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment