思路是:在屏幕上某個位置按着不放:device.touch(x,y,md.DOWN)python
而後再作一個滑動的操做:device.drap((x1,y1),(x2,y2),0.2,10)android
而後再鬆開按鍵:device.touch(x,y,md.UP)code
#codeing:utf-8 from com.android.monkeyrunner import MonkeyRunner as mr ,MonkeyDevice as md device=mr.waitForConnection() #點擊「Home鍵」 print '------------------Back Home Screen-------------------------------------' device.press('KEYCODE_HOME',md.DOWN_AND_UP) mr.sleep(1) #打開「更多設置」 print '------------------Open More Settings-------------------------------------' device.touch(87,1516,md.DOWN) mr.sleep(1) device.drag((931,412),(560,956),0.5,5) device.touch(87,1516,md.UP)