Reputation: 976
I am getting this issue after upgrading my appium version to 1.6.3 . Whenever I use driver.launchApp();
command, it clears the app data, due to this I am not able to execute the next tese cases.
I tried setting the below Desired capability as well but still it is clearing the app data every time when I try to launch the app.
capabilities.setCapability("noReset", "true");
So the scenario is, I login to the application then relaunch the app and appium clears the app data and again the login screen appears which should not appear.
Below are the logs in which we can clearly see that appium is clearing the app data.
[debug] [ADB] Running 'C:\Users\Vinod\AndroidSDK\platform-tools\adb.exe' with args: ["-P",5037,"-s","079a1ea4d037eeb7","shell","am","force-stop","PACKAGENAME"]
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\Users\Vinod\AndroidSDK\platform-tools\adb.exe' with args: ["-P",5037,"-s","079a1ea4d037eeb7","shell","pm","clear","PACKAGENAME"]
[debug] [ADB] Device API level: 23
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\Users\Vinod\AndroidSDK\platform-tools\adb.exe' with args: ["-P",5037,"-s","079a1ea4d037eeb7","shell","am","start","-W","-n","PACKAGENAME/.ui.SplashActivity","-S","-a","android.intent.action.MAIN","-c","android.intent.category.LAUNCHER","-f","0x10200000"]
Upvotes: 4
Views: 10587
Reputation: 21
As desired capabilities are deprecated, thought this would be helpful.
using .noReset() and .doesNoReset() helped in my case, find full snippet below.
var ltOptions = new HashMap<String, Object> ();
ltOptions.put("deviceName", "Redmi K20 Pro");
ltOptions.put("platformName", "Android");
ltOptions.put("platformVersion", "11");
ltOptions.put("udid", "aaa88c0");
var options1 = new UiAutomator2Options();
options1.setUdid("aaa88c0");
options1.noReset();
options1.doesNoReset();
options1.setClearSystemFiles(false);
URL url = new URL("http://localhost:4723/wd/hub");
AndroidDriver driver1 = new AndroidDriver(url, options1);
Upvotes: 0
Reputation: 151
hope you got the solution. If not you can try this. Appium version 1.14.2
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(MobileCapabilityType.FULL_RESET, "False");
cap.setCapability(MobileCapabilityType.NO_RESET, "True");
Upvotes: 0
Reputation: 319
You need to add below code in capablity
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability("noReset", "true");
cap.setCapability("fullReset", "false");
It worked for me.
Upvotes: 5
Reputation: 11
If you remove the driver.launchApp(); statement then it should be working perfectly.
You do not need to call this method because appium does it for you when starting your server with capabilities.
Upvotes: 0
Reputation: 270
make sure that this capability is set: Although the default value for this capability is false, still its worth a try.
capabilities.setCapability("fullReset", "false");
if it doesn't work please provide a code sample from your project.
Upvotes: 2