在使用appium时,您调用的方法都不会从后台删除应用程序.这是他们所指的:
((AppiumDriver)driver).closeApp(); // Close the app which was provided in the capabilities at session creation
((AppiumDriver)driver).close(); // from *RemoteWebDriver.java*, used to close the current browser page
((AppiumDriver)driver).quit(); // quits the session created between the client and the server
Run Code Online (Sandbox Code Playgroud)
所以你可能尝试做的是:
((AppiumDriver)driver).resetApp(); // Reset the currently running app for this session
Run Code Online (Sandbox Code Playgroud)
或尝试这两者的组合:
((AppiumDriver)driver).removeApp(<package name>); // Remove the specified app from the device (uninstall)
((AppiumDriver)driver).installApp(<path to apk>); // Install an app on the mobile device
Run Code Online (Sandbox Code Playgroud)