appium - 1.2.2
java-client - 1.7.0
android - 4.4.2
OS - Windows 7
below is the code
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("appPackage", "com.android.settings");
capabilities.setCapability("appActivity", ".Settings");
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "4.4.2");
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Nexus 5");
driver = new AppiumDriver(new URL("http://0.0.0.0:4723/wd/hub"), capabilities);
driver.startActivity("com.android.calculator2",".Calculator","com.android.settings",".Settings");
it shows below error
org.openqa.selenium.UnsupportedCommandException: That URL did not map to a valid JSONWP resource
Command duration or timeout: 8 milliseconds
Build info: version: â2.42.2â, revision: â6a6995dâ, time: â2014-06-03 17:42:03â
System info: host: âSYS0009â, ip: â169.254.247.45â, os.name: âWindows 7â, os.arch: âamd64â, os.version: â6.1â, java.version: â1.8.0_20â
Driver info: io.appium.java_client.AppiumDriver
Capabilities [{appPackage=com.android.settings, networkConnectionEnabled=true, warnings={}, databaseEnabled=false, deviceName=Nexus 5, platform=LINUX, appActivity=.Settings, desired={appPackage=com.android.settings, appActivity=.Settings, platformVersion=4.4.2, platformName=Android, udid=077c35ee0ade546b, deviceName=Nexus 5}, platformVersion=4.4.2, webStorageEnabled=false, locationContextEnabled=false, browserName=Android, takesScreenshot=true, javascriptEnabled=true, platformName=Android, udid=077c35ee0ade546b}]
Session ID: e09ce4e0-f3c6-4857-9dcb-c5de2ee5d6e5
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.ErrorHandler.createThrowable(ErrorHandler.java:204)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:102)
at io.appium.java_client.AppiumDriver.startActivity(AppiumDriver.java:204)
at Napp.testCal(Napp.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Following is the log
C:\Users\Raghuram>appium
info: Welcome to Appium v1.2.2 (REV cf6ff5939ddc6b4d45fcbabfbfe13c950e0058c4)
info: Appium REST http interface listener started on 0.0.0.0:4723
info: LogLevel: debug
info: --> POST /wd/hub/session {âdesiredCapabilitiesâ:{âappPackageâ:âcom.android
.settingsâ,âappActivityâ:".Settings",âplatformVersionâ:â4.4.2â,âplatformNameâ:âA
ndroidâ,âdeviceNameâ:âNexus 5â}}
info: [debug] Didnât get app but did get Android package, will attempt to launch
it on the device
info: [debug] Creating new appium session d1d46a9b-bd36-4487-bd1a-75b55cc960f7
info: Starting android appium
info: [debug] Using fast reset? true
info: [debug] Preparing device for session
info: [debug] Not checking whether app is present since we are assuming itâs alr
eady on the device
info: [debug] Checking whether adb is present
info: [debug] Using adb from E:\Automation\MobileAutomation\adt\adt-bundle\sdk\p
latform-tools\adb.exe
info: Retrieving device
info: [debug] Trying to find a connected android device
info: [debug] Getting connected devicesâŚ
info: [debug] executing: âE:\Automation\MobileAutomation\adt\adt-bundle\sdk\plat
form-tools\adb.exeâ devices
info: [debug] 1 device(s) connected
info: Found device 077c35ee0ade546b
info: [debug] Setting device id to 077c35ee0ade546b
info: [debug] Waiting for device to be ready and to respond to shell commands (t
imeout = 5)
info: [debug] executing: âE:\Automation\MobileAutomation\adt\adt-bundle\sdk\plat
form-tools\adb.exeâ -s 077c35ee0ade546b wait-for-device
info: [debug] executing: âE:\Automation\MobileAutomation\adt\adt-bundle\sdk\plat
form-tools\adb.exeâ -s 077c35ee0ade546b shell âecho âreadyââ
info: [debug] Starting logcat capture
warn: No app capability, canât parse package/activity
info: [debug] Getting device API level
info: [debug] executing: âE:\Automation\MobileAutomation\adt\adt-bundle\sdk\plat
form-tools\adb.exeâ -s 077c35ee0ade546b shell âgetprop ro.build.version.sdkâ
info: [debug] Device is at API Level 19
info: Device API level is: 19
info: [debug] Apk doesnât exist locally
info: [debug] executing: âE:\Automation\MobileAutomation\adt\adt-bundle\sdk\plat
form-tools\adb.exeâ -s 077c35ee0ade546b shell ârm -rf /data/local/tmp/strings.js
onâ
info: [debug] Not uninstalling app since server not started with --full-reset
info: [debug] Skipping install since we launched with a package instead of an ap
p path
info: [debug] Forwarding system:4724 to device:4724
info: [debug] executing: âE:\Automation\MobileAutomation\adt\adt-bundle\sdk\plat
form-tools\adb.exeâ -s 077c35ee0ade546b forward tcp:4724 tcp:4724
info: [debug] Pushing appium bootstrap to deviceâŚ
info: [debug] executing: âE:\Automation\MobileAutomation\adt\adt-bundle\sdk\plat
form-tools\adb.exeâ -s 077c35ee0ade546b push âC:\Users\Raghuram\AppData\Roam
ing\npm\node_modules\appium\build\android_bootstrap\AppiumBootstrap.jarâ /
data/local/tmp/
info: [debug] Pushing settings apk to deviceâŚ
info: [debug] executing: âE:\Automation\MobileAutomation\adt\adt-bundle\sdk\plat
form-tools\adb.exeâ -s 077c35ee0ade546b install âC:\Users\Raghuram\AppData\Roami
ng\npm\node_modules\appium\build\settings_apk\settings_apk-debug.apkâ
info: [debug] Pushing unlock helper app to deviceâŚ
info: [debug] executing: âE:\Automation\MobileAutomation\adt\adt-bundle\sdk\plat
form-tools\adb.exeâ -s 077c35ee0ade546b install âC:\Users\Raghuram\AppData\Roami
ng\npm\node_modules\appium\build\unlock_apk\unlock_apk-debug.apkâ
info: Starting App
info: [debug] Attempting to kill all âuiautomatorâ processes
info: [debug] Getting all processes with âuiautomatorâ
info: [debug] executing: âE:\Automation\MobileAutomation\adt\adt-bundle\sdk\plat
form-tools\adb.exeâ -s 077c35ee0ade546b shell âps âuiautomatorââ
info: [debug] No matching processes found
info: [debug] Running bootstrap
info: [debug] spawning: E:\Automation\MobileAutomation\adt\adt-bundle\sdk\platfo
rm-tools\adb.exe -s 077c35ee0ade546b shell uiautomator runtest AppiumBootstrap.j
ar -c io.appium.android.bootstrap.Bootstrap
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [debug] [UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap:
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRun
ner
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.andro
id.bootstrap.Bootstrap
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 1
info: [debug] [BOOTSTRAP] [debug] Socket opened on port 4724
info: [debug] [BOOTSTRAP] [debug] Appium Socket Server Ready
info: [debug] [BOOTSTRAP] [debug] Loading jsonâŚ
info: [debug] [BOOTSTRAP] [debug] Registered crash watchers.
info: [debug] Waking up device if itâs not alive
info: [debug] Pushing command to appium work queue: [âwakeâ,{}]
info: [debug] [BOOTSTRAP] [debug] Client connected
info: [debug] [BOOTSTRAP] [debug] Got data from client: {âcmdâ:âactionâ,âactionâ
:âwakeâ,âparamsâ:{}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: wake
info: [debug] executing: âE:\Automation\MobileAutomation\adt\adt-bundle\sdk\plat
form-tools\adb.exeâ -s 077c35ee0ade546b shell âdumpsys windowâ
info: [debug] [BOOTSTRAP] [debug] Returning result: {âvalueâ:true,âstatusâ:0}
info: [debug] Writing dumpsys output to C:\Users\Raghuram\AppData\Roaming\npm\no
de_modules\appium.dumpsys.log
info: [debug] Screen already unlocked, continuing.
info: [debug] Pushing command to appium work queue: [âgetDataDirâ,{}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {âcmdâ:âactionâ,âactionâ
:âgetDataDirâ,âparamsâ:{}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: getDataDir
info: [debug] dataDir set to: /data/local/tmp
info: [debug] Getting device API level
info: [debug] executing: âE:\Automation\MobileAutomation\adt\adt-bundle\sdk\plat
form-tools\adb.exeâ -s 077c35ee0ade546b shell âgetprop ro.build.version.sdkâ
info: [debug] [BOOTSTRAP] [debug] Returning result: {âvalueâ:"/data/local/tmp
â,âstatusâ:0}
info: [debug] Device is at API Level 19
info: [debug] executing: âE:\Automation\MobileAutomation\adt\adt-bundle\sdk\plat
form-tools\adb.exeâ -s 077c35ee0ade546b shell âam start -S -a android.intent.act
ion.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n com.android.settin
gs/.Settingsâ
info: [debug] Waiting for pkg âcom.android.settingsâ and activity â.Settingsâ to
be focused
info: [debug] Getting focused package and activity
info: [debug] executing: âE:\Automation\MobileAutomation\adt\adt-bundle\sdk\plat
form-tools\adb.exeâ -s 077c35ee0ade546b shell âdumpsys window windowsâ
info: [debug] Device launched! Ready for commands
info: [debug] Setting command timeout to the default of 60 secs
info: [debug] Appium session started with sessionId d1d46a9b-bd36-4487-bd1a-75b5
5cc960f7
info: <-- POST /wd/hub/session 303 16741.739 ms - 9
info: --> GET /wd/hub/session/d1d46a9b-bd36-4487-bd1a-75b55cc960f7 {}
info: [debug] Responding to client with success: {âstatusâ:0,âvalueâ:{âplatformâ
:âLINUXâ,âbrowserNameâ:âAndroidâ,âplatformVersionâ:â4.4.2â,âwebStorageEnabledâ:f
alse,âtakesScreenshotâ:true,âjavascriptEnabledâ:true,âdatabaseEnabledâ:false,âne
tworkConnectionEnabledâ:true,âlocationContextEnabledâ:false,âwarningsâ:{},âdesir
edâ:{âappPackageâ:âcom.android.settingsâ,âappActivityâ:â.Settings",âplatformVers
ionâ:â4.4.2â,âplatformNameâ:âAndroidâ,âdeviceNameâ:âNexus 5â},âappPackageâ:âcom.
android.settingsâ,âappActivityâ:".Settings",âplatformNameâ:âAndroidâ,"deviceName
":âNexus 5â},âsessionIdâ:âd1d46a9b-bd36-4487-bd1a-75b55cc960f7â}
info: <-- GET /wd/hub/session/d1d46a9b-bd36-4487-bd1a-75b55cc960f7 200 3.941 ms
- 575 {âstatusâ:0,âvalueâ:{âplatformâ:âLINUXâ,âbrowserNameâ:âAndroidâ,âplatformV
ersionâ:â4.4.2â,âwebStorageEnabledâ:false,âtakesScreenshotâ:true,âjavascriptEnab
ledâ:true,âdatabaseEnabledâ:false,ânetworkConnectionEnabledâ:true,âlocationConte
xtEnabledâ:false,âwarningsâ:{},âdesiredâ:{âappPackageâ:âcom.android.settingsâ,âa
ppActivityâ:".Settings",âplatformVersionâ:â4.4.2â,âplatformNameâ:âAndroidâ,âdevi
ceNameâ:âNexus 5â},âappPackageâ:âcom.android.settingsâ,âappActivityâ:".Settings"
,âplatformNameâ:âAndroidâ,âdeviceNameâ:âNexus 5â},âsessionIdâ:âd1d46a9b-bd36-448
7-bd1a-75b55cc960f7â}
info: --> POST /wd/hub/session/d1d46a9b-bd36-4487-bd1a-75b55cc960f7/appium/devic
e/start_activity {âappPackageâ:âcom.android.calculator2â,âappActivityâ:".Calcula
tor",âappWaitPackageâ:âcom.android.settingsâ,âappWaitActivityâ:".Settings"}
info: [debug] Responding to client that we did not find a valid resource
info: <-- POST /wd/hub/session/d1d46a9b-bd36-4487-bd1a-75b55cc960f7/appium/devic
e/start_activity 404 9.730 ms - 47
info: --> DELETE /wd/hub/session/d1d46a9b-bd36-4487-bd1a-75b55cc960f7 {}
info: Shutting down appium session
info: [debug] Pressing the HOME button
info: [debug] executing: âE:\Automation\MobileAutomation\adt\adt-bundle\sdk\plat
form-tools\adb.exeâ -s 077c35ee0ade546b shell âinput keyevent 3â
info: [debug] Stopping logcat capture
info: [debug] Logcat terminated with code null, signal SIGTERM
info: [debug] [BOOTSTRAP] [debug] Got data from client: {âcmdâ:âshutdownâ}
info: [debug] [BOOTSTRAP] [debug] Got command of type SHUTDOWN
info: [debug] [BOOTSTRAP] [debug] Returning result: {âvalueâ:âOK, shutting downâ
,âstatusâ:0}
info: [debug] [BOOTSTRAP] [debug] Closed client connection
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=.
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRun
ner
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.andro
id.bootstrap.Bootstrap
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 0
info: [debug] Sent shutdown command, waiting for UiAutomator to stopâŚ
info: [debug] UiAutomator shut down normally
info: [debug] Cleaning up android objects
info: [debug] Cleaning up appium session
info: [debug] Responding to client with success: {âstatusâ:0,âvalueâ:null,âsessi
onIdâ:âd1d46a9b-bd36-4487-bd1a-75b55cc960f7â}
info: <-- DELETE /wd/hub/session/d1d46a9b-bd36-4487-bd1a-75b55cc960f7 200 756.65
2 ms - 76 {âstatusâ:0,âvalueâ:null,âsessionIdâ:âd1d46a9b-bd36-4487-bd1a-75b55cc9
60f7â}
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [debug] [UIAUTOMATOR STDOUT] Test results for WatcherResultPrinter=.
info: [debug] [UIAUTOMATOR STDOUT] Time: 11.995
info: [debug] [UIAUTOMATOR STDOUT] OK (1 test)
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: -1