為了方便獲取手機的截圖,把這個過程寫成bat指令碼,先上**:
@echo off
set tsp="%time:~0,1%"
if %tsp%==" " (set date_time=%date:~0,4%%date:~5,2%%date:~8,2%0%time:~1,1%%time:~3,2%%time:~6,2%) else (
set date_time=%date:~0,4%%date:~5,2%%date:~8,2%%time:~0,2%%time:~3,2%%time:~6,2%
)set filename=%date_time%.png
echo %filename%
adb wait-for-device
::截圖,並將檔案放置在/sdcard/這個目錄下面
adb shell screencap /sdcard/%filename%
::匯出截圖到指令碼所在的資料夾
adb pull /sdcard/%filename%
::判斷是否成功獲取到了截圖檔案
if %errorlevel% equ 0 (
echo "get %filename% success!!!"
) else (
echo "get %filename% fail!!!"
)pause
截圖的命令
adb shell screencap [filename]
filename為截圖在手機中的全路徑名
下面這段指令碼是獲取當前時間,用來設定截圖檔案的名稱,具體解釋見這篇文章windows指令碼語法
set tsp="%time:~0,1%"
if %tsp%==" " (set date_time=%date:~0,4%%date:~5,2%%date:~8,2%0%time:~1,1%%time:~3,2%%time:~6,2%) else (
set date_time=%date:~0,4%%date:~5,2%%date:~8,2%%time:~0,2%%time:~3,2%%time:~6,2%
)
使用selenium截圖獲取驗證碼
self.driver chrome chrome driver 初始化物件 self.driver.set window size 1280,1024 設定視窗大小self.driver.get screenshot as file os.path.join base dir,yanzheng.p...
使用minicap對安卓手機快速截圖
使用uiautomator2,從截圖開始到存入電腦,大概需要1 2s.而minicap可以把時間減少到到ms級別.pip3 install uiautomator2 uiautomator2 init此時手機上已經安裝好了 minicap 和 atx agent,並且其實 atx agent 應該已...
android 截圖內容的獲取
那麼來講一下如何獲取。當然截圖的快捷鍵自己網路查詢。主要用到的類為contentobserver,下面來看看詳細的 private static final string external content uri matcher mediastore.images.media.external co...