Installation and uninstallation of 1.app
Driver.install_app (apk path): Install App
Driver.remove_app (App package name): Uninstall app
Driver.is_app_installed (App package name): Determine if the app is installed, returned true
2. Close and start the app
Driver.close_app ()
Driver.launch_app ()
3. Place the app in the background n seconds, and the page will automatically return to the foreground after n seconds.
Driver.background_app (N)
4. Get the current page and start the specified page
Driver.current_activity ()
Driver.start_activity (package name, activity name)
Can be used in such a scenario, if the current page is the login page to log in, otherwise open the login page before logging in:
If driver.current_activity () = = Login page:
//... Sign-in operation
Else
Driver.start_activity (package name, login page)
5. Wait for a page to appear
Driver.wait_activity ('. Customlocaleactivity ', 3, 1): Waits 3 seconds, checks every 1 seconds, and returns True when the page appears
6. Get the tree structure of the current page source code
Driver.page_source
7.
Driver.get_screenshot_as_file ("My. png")
Appium Common API One