<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          Android、iOS如何實現(xiàn)自動化錄屏,超實用!

          共 1923字,需瀏覽 4分鐘

           ·

          2021-07-31 22:38

          閱讀本文大約需要1分鐘。


          背景

          在做移動端自動化測試的過程中,有很多場景需要錄制設(shè)備的屏幕視頻,比如Crash現(xiàn)場記錄,啟動/頁面加載耗時類的評測等,那么如何實現(xiàn)Android和iOS設(shè)備的屏幕錄制呢?


          Android

          其實Android系統(tǒng)本身提供了一個簡單的adb命令實現(xiàn),雖然在有些設(shè)備上存在兼容性問題,比如華為手機出廠就刪除了 screenrecord 錄屏工具,不過在大部分機型上還是可以適用的(針對這個適配問題,后面會專門寫一篇文章介紹一種兼容所有機型的方案),今天先來分享一下這個系統(tǒng)的原生實現(xiàn)。


          這里推薦一個開源的框架adbutils,他是一個用純Python實現(xiàn)的adb服務(wù),里面對原生的screenrecord做了比較好的封裝,先裝依賴:

          pip3 install adbutils

          連接ADB Server:

          import adbutils
          adb = adbutils.AdbClient(host="127.0.0.1", port=5037)print(adb.devices())

          錄屏方法

          # run screenrecord to record screenr = d.screenrecord()# sleep for a while, can not large then 3 minutesr.stop() # stop recordingr.stop_and_pull("video.mp4") # stop recording and pull video to local, then remove video from device
          # control start time manuallyr = d.screenrecord(no_autostart=True)r.start() # start recordr.stop_and_pull("video.mp4") # stop recording and pull video to local, then remove video from device


          iOS

          系統(tǒng)要求

          • iOS系統(tǒng)8.0以上

          • MacOS系統(tǒng)10.10以上


          安裝

          下載倉庫源碼,目前這個自動化錄屏工具是一個二進制的文件,在代碼倉庫的bin目錄下:

          git clone https://github.com/WPO-Foundation/xrecord.git


          介紹

          xrecord --help-l, --list: List available capture devices.-n, --name: Device Name.-i, --id: Device ID.-o, --out: Output File.-f, --force: Overwrite existing files.-q, --quicktime: Start QuickTime in the background (necessary for iOS recording).-t, --time: Recording time in seconds (records until stopped if not specified).-u, --quality: Recoding quality (low, medium, high, photo - defaults to high).-d, --debug: Display debugging info to stderr.-h, --help: Prints a help message.

          使用

          列出可捕獲的設(shè)備:

          $ xrecord --quicktime --listAvailable capture devices:AppleHDAEngineInput:1B,0,1,0:1: Built-in Microphone5f355a5b183b2d2d7ba91dcfadd4c14b98504642: iPhoneCC2437519T1F6VVDH: FaceTime HD Camera

          開始錄屏:

          $ xrecord --quicktime --name="iPhone" --out="out.mp4" --force -q -t 10

          end



          瀏覽 52
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          分享
          舉報
          評論
          圖片
          表情
          推薦
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          分享
          舉報
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  约操极品| 国产伦精品一区二区三区妓女原神 | 国产一级无码Av片在线观看 | 日本三级中国三级99 | 国内稀有盗摄偷窥盗摄Av |