I am doing mobile app. automation using appium and web driver. I noticed that every time takes app. from given path and install to device. So because of this before perform any function I need to call my login function always.
Is there any way that it do not install app. from path if app. is already installed? and also open app with current screen?
Hi,
Can u post your code?
@iRANG_QA
@iRANG_QA ,
You can set the appium capabilities to neither reinstall or reset
no-reset = true
full-reset = false
1 Like
Okay…I will try for sure…thanks.
My code is :
File path = new File("D:\\test.apk");
// Setting capabilities
DesiredCapabilities capabilities = new DesiredCapabilities();
//capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
capabilities.setCapability("device", "Android Emulator");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("deviceName","vds");
capabilities.setCapability("platformVersion", "21");
capabilities.setCapability("app-package", "com.ripl.jannyafree"); //Replace with your app's package
capabilities.setCapability("app-activity", "com.ripl.jannya.activities.MainActivity"); //Replace with app's Activity
capabilities.setCapability("app", path.getAbsolutePath());
// Setup driver
driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub/"), capabilities);
Where should I change? OR add new code to do that reset?
UD
April 6, 2015, 11:47am
6
iRANG_RA,
This you can do int in two ways:
In Appium UI:
Launch Appium -> Click on Android settings(clicking on Android Icon).
You see these two settings.
Make sure “No Reset” checkbox checked and “Full Reset” checkbox unchecked.
You can set below two desired capabilities in addition to your capabilities:
capabilities.setCapability(“noReset”, true);
capabilities.setCapability(“fullReset”, fullReset);
I hope the above helps.
Thanks,
Uday
1 Like
Thanks a lot…I did that…
waqar
February 23, 2016, 6:43am
8
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(“no-reset”, “true”);
cap.setCapability(“full-reset”, “False”);
cap.setCapability(MobileCapabilityType.PLATFORM_NAME, MobilePlatform.ANDROID);
cap.setCapability(MobileCapabilityType.DEVICE_NAME, “Android Emulator”);
cap.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, “20”);
cap.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
AndroidDriver driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), cap);
Still I am getting issue with same as above topic , please check this code and give your feedback on it , Thanks in Advance.
1 Like
pavant
October 14, 2016, 11:57am
9
Please remove app path or comment it currently you are providing app path instead of that you need just appPackage and appActivity
cap.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
@waqar :
Remove following line
cap.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
Add the following line
cap.setCapability(“appPackage”, “write app package name”);
cap.setCapability(“appActivity”,“write app main activity name”);
jblaze
January 18, 2017, 7:59pm
11
How can I get my Java test code to:
install the app when I instantiate the driver
allow me to close and re-open the app whenever I want WITHOUT re-installing the app?
2 Likes
My code is the below, but the problem is, it just open the existing app and close it, Can you guys tell me WHY? Thanks in advance.
File appDir = new File(“src”);
File app = new File(“whatsapp.apk”);
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(MobileCapabilityType.PLATFORM_NAME, MobilePlatform.ANDROID);
cap.setCapability(MobileCapabilityType.DEVICE_NAME, "Nexus 5");
// cap.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT,"200");
cap.setCapability("appActivity", "com.whatsapp.Settings");
cap.setCapability(MobileCapabilityType.NO_RESET, true);
cap.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
If you already have the app in your device, can you please remove/comment out the following 3 lines and add the last lines and try…:
Remove:
File appDir = new File(“src”);
File app = new File(“whatsapp.apk”);
cap.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
Add below lines:
cap.setCapability(MobileCapabilityType.FULL_RESET, false);
cap.setCapability(“appActivity”,“write app main activity name”);
cap.setCapability(“appPackage”,“write app main activity name”);