Ruby wrapper for take screenshot and screenrecord on ios/android emulators.
Using adb screencap
and adb screenrecord
see: https://developer.android.com/studio/command-line/adb.html
adb screenrcord
is only supported: Android >= 4.4(API Level 19)
Not supported yet
Using xcrun simctl io screenshot
and xcrun simctl io recordVideo
see: xcrun simctl io --help
xcrun simctl io screenshot
is only supported: Xcode >= 8.2
gem 'mobile-emulator-screencapture'
require 'mobile/emulator/screencapture'
android = Mobile::Emulator::Screencapture.create(
platform: "android",
screenshot_dir: "./screenshot",
screenrecord_dir: "./screenrecord",
# options for adb screenrecord
width: 720,
height: 360
bit_rate: 6_000_000,
time_limit: 180
)
android.screenshot("test")
# > ./screenshot/test.png
android.start_screenrecord("test")
sleep 30
android.stop_screenrecord
# > ./screenrecord/test.mp4
Bug reports and pull requests are welcome on GitHub at https://github.com/Kesin11/mobile-emulator-screencapture.
The gem is available as open source under the terms of the MIT License.