Reputation: 9
I am trying to execute the below code unable to goto the specific element
DesiredCapabilities c=new DesiredCapabilities(); c.setCapability(CapabilityType.BROWSER_NAME, ""); c.setCapability("deviceName", "ZZ2222HMLF"); c.setCapability("platformName", "Android"); c.setCapability("platformversion", "7.0"); c.setCapability(MobileCapabilityType.APP, "D:\Appium\edTheSIS_11_02_2019.apk"); //c.setCapability("noReset", true); //c.setCapability("autoGrantPermissions", "true"); c.setCapability("appPackage","com.sisapp.in.sisapp"); c.setCapability("appActivity","md5b1afd03e09ce5243fd0287b176ff38ea.MainActivity"); URL U=new URL("http://127.0.0.1:4723/wd/hub"); WebDriver driver=new AndroidDriver(U,c);
Displaying as below error in my console
log4j:WARN No appenders could be found for logger (org.apache.http.client.protocol.RequestAddCookies). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. Exception in thread "main" org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Cannot start the 'com.sisapp.in.sisapp' application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Original error: Error executing adbExec. Original error: 'Command 'D:\Appium\Sdk\tools\adb.exe -P 5037 -s ZZ2222HMLF shell am start -W -n com.sisapp.in.sisapp/md5b1afd03e09ce5243fd0287b176ff38ea.MainActivity -S' exited with code 1'; Stderr: 'java.lang.SecurityException: Permission Denial: starting Intent { flg=0x10000000 cmp=com.sisapp.in.sisapp/md5b1afd03e09ce5243fd0287b176ff38ea.MainActivity } from null (pid=26065, uid=2000) not exported from uid 11113 at android.os.Parcel.readException(Parcel.java:1683) at android.os.Parcel.readException(Parcel.java:1636) at android.app.ActivityManagerProxy.startActivityAndWait(ActivityManagerNative.java:3280) at com.android.commands.am.Am.runStart(Am.java:630) at com.android.commands.am.Am.onRun(Am.java:388) at com.android.internal.os.BaseCommand.run(BaseCommand.java:51) at com.android.commands.am.Am.main(Am.java:121) at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method) at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:294)'; Code: '1' Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T19:05:14.666Z' System info: host: 'GSPSDELL30', ip: '10.10.4.192', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_151' Driver info: driver.version: AndroidDriver remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: Cannot start the 'com.sisapp.in.sisapp' application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Original error: Error executing adbExec. Original error: 'Command 'D:\Appium\Sdk\tools\adb.exe -P 5037 -s ZZ2222HMLF shell am start -W -n com.sisapp.in.sisapp/md5b1afd03e09ce5243fd0287b176ff38ea.MainActivity -S' exited with code 1'; Stderr: 'java.lang.SecurityException: Permission Denial: starting Intent { flg=0x10000000 cmp=com.sisapp.in.sisapp/md5b1afd03e09ce5243fd0287b176ff38ea.MainActivity } from null (pid=26065, uid=2000) not exported from uid 11113 at android.os.Parcel.readException(Parcel.java:1683) at android.os.Parcel.readException(Parcel.java:1636) at android.app.ActivityManagerProxy.startActivityAndWait(ActivityManagerNative.java:3280) at com.android.commands.am.Am.runStart(Am.java:630) at com.android.commands.am.Am.onRun(Am.java:388) at com.android.internal.os.BaseCommand.run(BaseCommand.java:51) at com.android.commands.am.Am.main(Am.java:121) at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method) at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:294)'; Code: '1' at getResponseForW3CError (C:\Users\preethi.g\AppData\Local\appium-desktop\app-1.10.0\resources\app\node_modules\appium-base-driver\lib\protocol\errors.js:826:9) at asyncHandler (C:\Users\preethi.g\AppData\Local\appium-desktop\app-1.10.0\resources\app\node_modules\appium-base-driver\lib\protocol\protocol.js:447:37) at process._tickCallback (internal/process/next_tick.js:68:7) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$new$0(W3CHandshakeResponse.java:57) at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$getResponseFunction$2(W3CHandshakeResponse.java:104) at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:123) at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source) at java.util.Spliterators$ArraySpliterator.tryAdvance(Unknown Source) at java.util.stream.ReferencePipeline.forEachWithCancel(Unknown Source) at java.util.stream.AbstractPipeline.copyIntoWithCancel(Unknown Source) at java.util.stream.AbstractPipeline.copyInto(Unknown Source) at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) at java.util.stream.FindOps$FindOp.evaluateSequential(Unknown Source) at java.util.stream.AbstractPipeline.evaluate(Unknown Source) at java.util.stream.ReferencePipeline.findFirst(Unknown Source) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142) at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:89) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601) at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42) at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1) at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:219) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:142) at io.appium.java_client.DefaultGenericMobileDriver.(DefaultGenericMobileDriver.java:38) at io.appium.java_client.AppiumDriver.(AppiumDriver.java:83) at io.appium.java_client.AppiumDriver.(AppiumDriver.java:93) at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:72) at Mobileapp1.Apptesting.main(Apptesting.java:33)
Appium server log:
[Appium] Welcome to Appium v1.10.0 [Appium] Appium REST http interface listener started on 0.0.0.0:4723 [HTTP] --> POST /wd/hub/session [HTTP] {"desiredCapabilities":{"app":"D:\Appium\edTheSIS_11_02_2019.apk","appActivity":"md5b1afd03e09ce5243fd0287b176ff38ea.MainActivity","appPackage":"com.sisapp.in.sisapp","browserName":"","deviceName":"ZZ2222HMLF","platformName":"Android","platformversion":"7.0"},"capabilities":{"desiredCapabilities":{"app":"D:\Appium\edTheSIS_11_02_2019.apk","appActivity":"md5b1afd03e09ce5243fd0287b176ff38ea.MainActivity","appPackage":"com.sisapp.in.sisapp","browserName":"","deviceName":"ZZ2222HMLF","platformName":"Android","platformversion":"7.0"},"firstMatch":[{"browserName":"","platformName":"android"}]}} [W3C] Calling AppiumDriver.createSession() with args: [{"app":"D:\Appium\edTheSIS_11_02_2019.apk","appActivity":"md5b1afd03e09ce5243fd0287b176ff38ea.MainActivity","appPackage":"com.sisapp.in.sisapp","browserName":"","deviceName":"ZZ2222HMLF","platformName":"Android","platformversion":"7.0"},null,{"desiredCapabilities":{"app":"D:\Appium\edTheSIS_11_02_2019.apk","appActivity":"md5b1afd03e09ce5243fd0287b176ff38ea.MainActivity","appPackage":"com.sisapp.in.sisapp","browserName":"","deviceName":"ZZ2222HMLF","platformName":"Android","platformversion":"7.0"},"firstMatch":[{"browserName":"","platformName":"android"}]}] [BaseDriver] Event 'newSessionRequested' logged at 1552558812095 (15:50:12 GMT+0530 (India Standard Time)) [Appium] Could not parse W3C capabilities: 'deviceName' can't be blank [Appium] Trying to fix W3C capabilities by merging them with JSONWP caps [BaseDriver] The capabilities ["app","appActivity","appPackage","deviceName","platformversion"] are not standard capabilities and should have an extension prefix [Appium] Creating new AndroidDriver (v4.8.0) session [Appium] Capabilities: [Appium] app: D:\Appium\edTheSIS_11_02_2019.apk [Appium]
appActivity: md5b1afd03e09ce5243fd0287b176ff38ea.MainActivity [Appium] appPackage: com.sisapp.in.sisapp [Appium] deviceName: ZZ2222HMLF [Appium] platformversion: 7.0 [Appium] browserName: [Appium]
platformName: android [BaseDriver] W3C capabilities {"alwaysMatch":{"appium:app... and MJSONWP desired capabilities {"app":"D:\Appium\edTheSI... were provided [BaseDriver] Creating session with W3C capabilities: {"alwaysMatch":{"appium:app... [BaseDriver] The following capabilities were provided, but are not recognized by appium: platformversion. [BaseDriver] Session created with session id: 1b0921bc-0535-4428-a57a-356bafe42833 [AndroidDriver] Java version is: 1.8.0_151 [ADB] Checking whether adb is present [ADB] The ANDROID_HOME environment variable is not set to the Android SDK root directory path. ANDROID_HOME is required for compatibility with SDK 23+. Checking along PATH for adb. [ADB] Using adb from D:\Appium\Sdk\tools\adb.exe [ADB] [AndroidDriver] Retrieving device list [ADB] Trying to find a connected android device [ADB] Getting connected devices... [ADB] 1 device(s) connected [AndroidDriver] Using device: ZZ2222HMLF [ADB] Setting device id to ZZ2222HMLF [ADB] Running 'D:\Appium\Sdk\tools\adb.exe -P 5037 -s ZZ2222HMLF shell getprop ro.build.version.sdk' [ADB] Current device property 'ro.build.version.sdk': 24 [ADB] Device API level: 24 [AndroidDriver] Consider setting 'automationName' capability to 'uiautomator2' on Android >= 6, since UIAutomator framework is not maintained anymore by the OS vendor. [BaseDriver] Using local app 'D:\Appium\edTheSIS_11_02_2019.apk' [AndroidDriver] Checking whether app is actually present [AndroidDriver] Starting Android session [ADB] Running 'D:\Appium\Sdk\tools\adb.exe -P 5037 -s ZZ2222HMLF wait-for-device' [ADB] Running 'D:\Appium\Sdk\tools\adb.exe -P 5037 -s ZZ2222HMLF shell echo ping' [AndroidDriver] Pushing settings apk to device... [ADB] Getting install status for io.appium.settings [ADB] Running 'D:\Appium\Sdk\tools\adb.exe -P 5037 -s ZZ2222HMLF shell dumpsys package io.appium.settings' [ADB] 'io.appium.settings' is installed [ADB] Getting package info for 'io.appium.settings' [ADB] Running 'D:\Appium\Sdk\tools\adb.exe -P 5037 -s ZZ2222HMLF shell dumpsys package io.appium.settings' [ADB] Checking whether aapt is present [ADB] The ANDROID_HOME environment variable is not set to the Android SDK root directory path. ANDROID_HOME is required for compatibility with SDK 23+. Checking along PATH for aapt. [ADB] Using aapt from D:\Appium\Sdk\build-tools\26.0.1\aapt.exe [ADB] [ADB] The version name of the installed 'io.appium.settings' is greater or equal to the application version name ('2.11.0' >= '2.11.0') [ADB] There is no need to install/upgrade 'C:\Users\preethi.g\AppData\Local\appium-desktop\app-1.10.0\resources\app\node_modules\io.appium.settings\apks\settings_apk-debug.apk' [ADB] Running 'D:\Appium\Sdk\tools\adb.exe -P 5037 -s ZZ2222HMLF shell ps' [AndroidDriver] io.appium.settings is already running. There is no need to reset its permissions. [ADB] Device API level: 24 [ADB] Running 'D:\Appium\Sdk\tools\adb.exe -P 5037 -s ZZ2222HMLF shell appops set io.appium.settings android:mock_location allow' [Logcat] Starting logcat capture [ADB] Getting device platform version [ADB] Running 'D:\Appium\Sdk\tools\adb.exe -P 5037 -s ZZ2222HMLF shell getprop ro.build.version.release' [ADB] Current device property 'ro.build.version.release': 7.0 [ADB] Running 'D:\Appium\Sdk\tools\adb.exe -P 5037 -s ZZ2222HMLF shell wm size' [ADB] Running 'D:\Appium\Sdk\tools\adb.exe -P 5037 -s ZZ2222HMLF shell getprop ro.product.model' [ADB] Current device property 'ro.product.model': Moto C Plus [ADB] Running 'D:\Appium\Sdk\tools\adb.exe -P 5037 -s ZZ2222HMLF shell getprop ro.product.manufacturer' [ADB] Current device property 'ro.product.manufacturer': motorola [ADB] Getting install status for com.sisapp.in.sisapp [ADB] Running 'D:\Appium\Sdk\tools\adb.exe -P 5037 -s ZZ2222HMLF shell dumpsys package com.sisapp.in.sisapp' [ADB] 'com.sisapp.in.sisapp' is installed [ADB] Getting install status for com.sisapp.in.sisapp [ADB] Running 'D:\Appium\Sdk\tools\adb.exe -P 5037 -s ZZ2222HMLF shell dumpsys package com.sisapp.in.sisapp' [ADB] 'com.sisapp.in.sisapp' is installed [ADB] Getting package info for 'com.sisapp.in.sisapp' [ADB] Running 'D:\Appium\Sdk\tools\adb.exe -P 5037 -s ZZ2222HMLF shell dumpsys package com.sisapp.in.sisapp' [ADB] The version code of the installed 'com.sisapp.in.sisapp' is greater than the application version code (23 > 22) [ADB] There is no need to install/upgrade 'D:\Appium\edTheSIS_11_02_2019.apk' [AndroidDriver] Performing fast reset on 'com.sisapp.in.sisapp' [ADB] Getting install status for com.sisapp.in.sisapp [ADB] Running 'D:\Appium\Sdk\tools\adb.exe -P 5037 -s ZZ2222HMLF shell dumpsys package com.sisapp.in.sisapp' [ADB] 'com.sisapp.in.sisapp' is installed [ADB] Running 'D:\Appium\Sdk\tools\adb.exe -P 5037 -s ZZ2222HMLF shell am force-stop com.sisapp.in.sisapp' [ADB] Running 'D:\Appium\Sdk\tools\adb.exe -P 5037 -s ZZ2222HMLF shell pm clear com.sisapp.in.sisapp' [AndroidDriver] Performed fast reset on the installed 'com.sisapp.in.sisapp' application (stop and clear) [ADB] Running 'D:\Appium\Sdk\tools\adb.exe -P 5037 -s ZZ2222HMLF shell rm -rf /data/local/tmp/strings.json' [AndroidDriver] Extracting strings from apk [AndroidDriver] D:\Appium\edTheSIS_11_02_2019.apk [AndroidDriver] undefined [AndroidDriver] C:\Users\preethi.g\AppData\Local\Temp\com.sisapp.in.sisapp [ADB] Extracting strings from for language: default [ADB] Successfully extracted 175 strings from 'D:\Appium\edTheSIS_11_02_2019.apk' resources for '(default)' configuration [ADB] Running 'D:\Appium\Sdk\tools\adb.exe -P 5037 -s ZZ2222HMLF push C:\Users\preethi.g\AppData\Local\Temp\com.sisapp.in.sisapp\strings.json /data/local/tmp' [AndroidBootstrap] Watching for bootstrap disconnect [ADB] Forwarding system: 4724 to device: 4724 [ADB] Running 'D:\Appium\Sdk\tools\adb.exe -P 5037 -s ZZ2222HMLF forward tcp:4724 tcp:4724' [UiAutomator] Starting UiAutomator [UiAutomator] Moving to state 'starting' [UiAutomator] Parsing uiautomator jar [UiAutomator] Found jar name: 'AppiumBootstrap.jar' [ADB] Running 'D:\Appium\Sdk\tools\adb.exe -P 5037 -s ZZ2222HMLF push C:\Users\preethi.g\AppData\Local\appium-desktop\app-1.10.0\resources\app\node_modules\appium-android-driver\bootstrap\bin\AppiumBootstrap.jar /data/local/tmp/' [ADB] Attempting to kill all uiautomator processes [ADB] Getting all processes with uiautomator [ADB] Running 'D:\Appium\Sdk\tools\adb.exe -P 5037 -s ZZ2222HMLF shell ps' [ADB] No 'uiautomator' process has been found [UiAutomator] Starting UIAutomator [ADB] Creating ADB subprocess with args: ["-P",5037,"-s","ZZ2222HMLF","shell","uiautomator","runtest","AppiumBootstrap.jar","-c","io.appium.android.bootstrap.Bootstrap","-e","pkg","com.sisapp.in.sisapp","-e","disableAndroidWatchers",false,"-e","acceptSslCerts",false] [UiAutomator] Moving to state 'online' [AndroidBootstrap] [BOOTSTRAP LOG] [debug] json loading complete. [AndroidBootstrap] Android bootstrap socket is now connected [ADB] Running 'D:\Appium\Sdk\tools\adb.exe -P 5037 -s ZZ2222HMLF shell dumpsys window' [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Registered crash watchers. [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Client connected [AndroidDriver] Screen already unlocked, doing nothing [ADB] Device API level: 24 [ADB] Running 'D:\Appium\Sdk\tools\adb.exe -P 5037 -s ZZ2222HMLF shell am start -W -n com.sisapp.in.sisapp/md5b1afd03e09ce5243fd0287b176ff38ea.MainActivity -S' [ADB] Running 'D:\Appium\Sdk\tools\adb.exe -P 5037 -s ZZ2222HMLF shell am start -W -n com.sisapp.in.sisapp/md5b1afd03e09ce5243fd0287b176ff38ea.MainActivity -S' [AndroidDriver] Shutting down Android driver [ADB] Running 'D:\Appium\Sdk\tools\adb.exe -P 5037 -s ZZ2222HMLF shell am force-stop com.sisapp.in.sisapp' [ADB] Pressing the HOME button [ADB] Running 'D:\Appium\Sdk\tools\adb.exe -P 5037 -s ZZ2222HMLF shell input keyevent 3' [AndroidBootstrap] Sending command to android: {"cmd":"shutdown"} [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"shutdown"} [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type SHUTDOWN [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":"OK, shutting down"} [AndroidBootstrap] Received command result from bootstrap [UiAutomator] Shutting down UiAutomator [UiAutomator] Moving to state 'stopping' [AndroidBootstrap] [UIAUTO STDOUT] close [socket][::/:::4724] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Closed client connection [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: numtests=1 [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: stream=. [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: test=testRunServer [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: current=1 [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS_CODE: 0 [UiAutomator] UiAutomator shut down normally [UiAutomator] Moving to state 'stopped' [ADB] Attempting to kill all uiautomator processes [ADB] Getting all processes with uiautomator [ADB] Running 'D:\Appium\Sdk\tools\adb.exe -P 5037 -s ZZ2222HMLF shell ps' [ADB] No 'uiautomator' process has been found [UiAutomator] Moving to state 'stopped' [Logcat] Stopping logcat capture [ADB] Running 'D:\Appium\Sdk\tools\adb.exe -P 5037 -s ZZ2222HMLF shell am force-stop io.appium.unlock' [AndroidDriver] Not cleaning generated files. AddclearSystemFiles
capability if wanted. [BaseDriver] Event 'newSessionStarted' logged at 1552558837127 (15:50:37 GMT+0530 (India Standard Time)) [W3C] Encountered internal error running command: Error: Cannot start the 'com.sisapp.in.sisapp' application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Original error: Error executing adbExec. Original error: 'Command 'D:\Appium\Sdk\tools\adb.exe -P 5037 -s ZZ2222HMLF shell am start -W -n com.sisapp.in.sisapp/md5b1afd03e09ce5243fd0287b176ff38ea.MainActivity -S' exited with code 1'; Stderr: 'java.lang.SecurityException: Permission Denial: starting Intent { flg=0x10000000 cmp=com.sisapp.in.sisapp/md5b1afd03e09ce5243fd0287b176ff38ea.MainActivity } from null (pid=27285, uid=2000) not exported from uid 11113 [W3C] at android.os.Parcel.readException(Parcel.java:1683) [W3C] at android.os.Parcel.readException(Parcel.java:1636) [W3C] at android.app.ActivityManagerProxy.startActivityAndWait(ActivityManagerNative.java:3280) [W3C] at com.android.commands.am.Am.runStart(Am.java:630) [W3C] at com.android.commands.am.Am.onRun(Am.java:388) [W3C] at com.android.internal.os.BaseCommand.run(BaseCommand.java:51) [W3C] at com.android.commands.am.Am.main(Am.java:121) [W3C] at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method) [W3C] at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:294)'; Code: '1' [W3C] at ADB.apkUtilsMethods.startApp (C:\Users\preethi.g\AppData\Local\appium-desktop\app-1.10.0\resources\app\node_modules\appium-adb\lib\tools\apk-utils.js:144:11) [W3C] at process._tickCallback (internal/process/next_tick.js:68:7) [HTTP] <-- POST /wd/hub/session 500 25191 ms - 3184 [HTTP]
Upvotes: 0
Views: 647
Reputation: 327
The best way is to install Appium Desktop and try out the desired capabilities from the Inspector console on Appium Desktop.
protected static AppiumDriver appDriver;
protected AppiumDriver getAppiumDriver() throws MalformedURLException {
if(appDriver == null)
{
DesiredCapabilities cap = new DesiredCapabilities();
File appDir = new File("FOLDER LOCATION OF .APK");
/* ANDROID DEPENDENCIES START*/
File newApp = new File (appDir ,"APPLICATIONNAME.APK" );
cap.setCapability(CapabilityType.BROWSER_NAME, "");
cap.setCapability("deviceName", "Nexus5XAPI26");
cap.setCapability("udid", "HT4AXJT03545");
cap.setCapability("platformName", "Android");
cap.setCapability("platformVersion","7.1.1");
cap.setCapability("automationName", "UiAutomator2");
/* ANDROID DEPENDENCIES END */
cap.setCapability("app", newApp.getAbsolutePath());
appDriver = new AppiumDriver(new URL("http://0.0.0.0:4723/wd/hub"), cap);
}
return appDriver;
}
Upvotes: 0
Reputation: 9
To Know the App Package and App Activity i have installed the apk info app and found the activities in the activities and now able to open the app.
Upvotes: 0
Reputation: 131
When you install an App using Appium on the device you also need to start the activity also.
Just add the below capabilities in your code :
c.setCapability("appPackage", "<PACKAGE_NAME>");
c.setCapability("appActivity", "LOGINSCREEN_ACTIVITY_NAME");
Below is the sample capabilities to launch Amazon App:
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
capabilities.setCapability("deviceName", "<DEVICE_ID>");
capabilities.setCapability("platformVersion", "<ANDROID_VERSION>");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("app", app.getAbsolutePath());
capabilities.setCapability("appPackage", "in.amazon.mShop.android.shopping");
capabilities.setCapability("appActivity", "com.amazon.mShop.home.HomeActivity");
Upvotes: 0