android自动化测试工具【UiAutomator】——截图功能

以下为主要代码段

// Simulate a short press on the HOME button.
getUiDevice().pressHome() ;
sleep(1000) ;

//创建文件

 File f = new File("/data/local/tmp/Screenshot.png") ;
      
      System.out.println(getUiDevice().takeScreenshot(new File("/mnt/sdcard/Screenshot.png") , 0, 50)) ;
      sleep(2000) ;

猜你喜欢

转载自blog.csdn.net/baidu_28126759/article/details/84563815