Look at some online, together with the next, or some not enough, but are more commonly used, first put it out:
#锁定屏幕时间秒driver. Lock (5) #将APP放置后台 parameter Time Driver.background_app (5) #收起键盘driver. Hide_keyboard () #启动Activity Driver.start _activity (' Package name ', ' Activity name ') #打开通知栏driver. Open_notifications () #检查应用是否已经安装 parameter package name driver.is_app_installed (' xxxxxx ') # Install the application parameter path Driver.install_app (' path/my.apk ') #删除应用driver. Remove_app (' xxxxxx ') #摇晃 (Shake) Driver.shake () # Close the App Driver.close_app () #重置 (equals uninstall post reload) Driver.reset () #获取应用的字符串driver. app_strings# Key Event driver.keyevent (specific key) # Get current activitydriver.current_activity# Touch Action (touchaction)/multi-Touch Action (multitouchaction) action = touchaction (Driver) Action.press (Element=el, x=10, y=10). Release (). Perform () #滑动 (Swipe) parameter starts the x, y coordinates of the x, Y coordinate to slide to, duration msdriver.swipe (start=75 , starty=500, endx=75, endy=0, duration=800) #双指向内移动缩小屏幕driver. Pinch (element=el) zoom in Driver.zoom (ele) coordinates click DRIVER.TAP ([( x, y)],time) scroll driver.scroll (ele1,ele2) hold element and drag onto another element Driver.drag_and_drop (ele1,ele2) slide driver.swipe (x1 , Y1,x2,y2,time) Driver.flick (x1,y1,x2,y2) #滑动到某个元素. todo:xxxx# pull file pulls the file out of the device driver.pull_file (' Library/xxx/xxx.plisT ') #推送文件 (push file) to put the file in the device data = "test is good" path = "/data/local/tmp/test.txt" driver.push_file (Path, Data.encode (' Base64 ')) '
Python appium operation of mobile phones and apps