The problem: My app opens up and shuts off before ScrollTo()
command execution.
I got this error on Appium:
'Encountered internal error running command: Error: Error occured while starting App. Original error: com.disney.wdpro.android.mdx.activities.LoaderActivity or com.disney.mdx.wdw.google.com.disney.wdpro.android.mdx.activities.LoaderActivity never started'
Appium logs:
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vovan\AppData\Local\Android\sdk\platform-
tools\adb.exe' with args: ["-P",5037,"-
s","IRN7HITKLFOFVKK7","shell","am","force-stop","io.appium.unlock"]
[AndroidDriver] Not cleaning generated files. Add `clearSystemFiles`
capability if wanted.
[MJSONWP] Encountered internal error running command: Error: Error occured
while starting App. Original error:
com.disney.wdpro.android.mdx.activities.LoaderActivity
orcom.disney.mdx.wdw.google.com.android.mdx.activities.LoaderActiv
ity never started
at Object.wrappedLogger.errorAndThrow
(C:\Users\vovan\AppData\Local\Programs\appium-
desktop\resources\app\node_modules\appium\node_modules\appium-
support\lib\logging.js:63:13)
at ADB.callee$0$0$ (C:\Users\vovan\AppData\Local\Programs\appium-
desktop\resources\app\node_modules\appium\node_modules\appium-
adb\lib\tools\apk-utils.js:79:9)
Selenium Code Eclipse:
public void test() throws MalformedURLException, InterruptedException {
File appDir = new File("src");
File app = new File(appDir, "com.disney.mdx.wdw.google.apk");
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(MobileCapabilityType.PLATFORM_NAME,
MobilePlatform.ANDROID);
cap.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Device");
cap.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, "50");
cap.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
AndroidDriver driver = new AndroidDriver(new
URL("http://169.254.159.242:4723/wd/hub"), cap);
driver.scrollTo("Get Started");
TouchActions t = new TouchActions(driver);
WebElement abc =
driver.findElementById("com.disney.mdx.wdw.google:id/tutorial_button");
t.singleTap(abc).perform();
Along with the desired capabilities, we need to pass the "appPackage" and "appActivity". Below are the complete desired activities that i have used in my project.
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName","ANDROID");
capabilities.setCapability("platformVersion", "5.1");
capabilities.setCapability("platformName",Constant.appPlatform);
capabilities.setCapability("app", app.getAbsolutePath());
capabilities.setCapability("appPackage", Constant.appPackage);
capabilities.setCapability("appActivity",Constant.appActivity);
You can get the details of the appPackage and appActivity from developer or http://toolsqa.com/mobile-automation/appium/how-to-find-apppackage-and-appactivity-for-apk-file/
Hope this helps you. Thanks.