1.保存圖片
img=phone.screenshot() #屏幕截圖,
t=time.time()
imgName='imgName'+datetime.datetime.now ().strftime ('%Y%m%d%H%M%S')+ str ( round ( (t - int ( t )) * 1000 ) )+'.png' #截圖可以單獨保存為別的名字的文件
stringPath='D:\CYY\HSFAPP\\'+imgName
#img.save('filename.png')#圖片保存在當前項目的文件夾下邊
img.save(stringPath)#保存文件到指定的文件夾下邊
def cap_screen( self,filepath:str,filename:str ):
pic_name=filepath+filename+datetime.now().strftime("%Y%m%d%H%M%S").jpg
self.d.screenshot(pic_name)
return pic_name
2. 上下左右滑動屏幕 ,其中percentage為向指定方向滑動百分之多少,為float型數據
phone.swipe_ext('left',0.8) #direction left ,right ,up ,down ,percentage is float 0.01 to 0.999
3. 從指定的屏幕的點1 滑動到屏幕的點2
# point={'sx':0.529,'sy':0.700,'ex':0.559,'ey':0.273,'duration':0.3}
# phone.drag(point['sx'],point['sy'],point['ex'],point['ey'],point['duration'])