Parallel execution on two appium servers with different ports using TestNG

Parallel execution on two appium servers with different ports using TestNG parametrization.

sample testNG.xml code:

<suite name="Parallel test suite"parallel="tests" thread-count="2"> <test name="Regression 1"> <parameter name="udid" value="1215sdf4"/> <parameter name="port" value="4723"/> <classes> <class name="myPackage.TestParallel" /> </classes> </test> <test name="Regression 2"> <parameter name="udid" value="eer4758e"/> <parameter name="port" value="4733"/> <classes> <class name="myPackage.TestParallel" /> </classes> </test> </suite>

Here successfully i am able to start two appium session id’s for (127.0.0.1+“ports”)multiple ports but with the help of appium logs i noticed that test methods(two threads) are executing on only one session id(one device).

  1. is there any problem with appium instance synchronization to testnG Threads??
  2. how to switch appium sessions between testng threads?

please suggest what should i do??

Thanks in advance.

@naveen.auvusali: How is your appium started? Are you starting programmatically?
Kindly share your working code which would be easier for us to debug.

r u using grid? and also want to know if ur android driver is static?

1 Like

This is the code i am using to start appium servers programmatically.

`public synchronized void appiumStart(String address,String port,String id) throws IOException, InterruptedException {
// Created object of apache CommandLine class.
// It will start command prompt In background.
CommandLine command = new CommandLine(“cmd”);
// Add different arguments In command line which requires to start appium server.
command.addArgument("/c");
command.addArgument(“C://Progra~2//Appium//node.exe”);
command.addArgument(“C://Progra~2//Appium//node_modules//appium//bin//appium.js”);
//Set Server address
command.addArgument("–address");
command.addArgument(address);
//Set Port
command.addArgument("–port");
command.addArgument(port);
command.addArgument("–bootstrap-port");
command.addArgument(port+2);
command.addArgument("–udid");
command.addArgument(id);
command.addArgument("–session-override", true);

  command.addArgument("--no-reset");
  command.addArgument("--log");
  //Set path to store appium server log file.
  command.addArgument("D://appiumLogs.txt");
  // Execute command line arguments to start appium server.
  DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler();
  DefaultExecutor executor = new DefaultExecutor();
  executor.setExitValue(1);
  executor.execute(command, resultHandler);
  // Wait for 15 minutes so that appium server can start properly before going for test execution.
  // Increase this time If face any error.
  Thread.sleep(15000);
 }`

This is the code i am using to create appium instancess:

`public AndroidDriver AppiumRemoteDriverConfig1(String address,String port,String id,String device,String version) throws Exception {

	server.appiumStart(address,port,id);
	
	Thread.sleep(10000);
	
	  System.out.println("waiting to configure desired capabilities of appium driver");
	  System.out.println("device "+id+ " port number at class level: "+port);
	    
	 DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability("browserName", "");
	 capabilities.setCapability("platformVersion",version); 
	capabilities.setCapability("deviceName",device);
	capabilities.setCapability("platformName","Android");
	capabilities.setCapability("udid",id);
	capabilities.setCapability("appPackage", "org.amazon.inforMain");
	capabilities.setCapability("appActivity","org.amazon.inforMain.DiagMain");
	capabilities.setCapability("newCommandTimeout", 60 * 8);
	appiumdriver = new AndroidDriver(new URL("http://"+address+":"+port+"/wd/hub"), capabilities);
		appiumdriver.manage().timeouts().implicitlyWait(6, TimeUnit.SECONDS); 
		System.out.println("Appium successfully launched");
			   
		Thread.sleep(3000);
	
		return appiumdriver;
	  }	`

XML File:
`

	<test name="RunAllTests">
		<parameter name="address" value="127.0.0.1"/>
		<parameter name="port" value="4723"/>
		<parameter name="id" value="0812a4a9"/>
		<parameter name="device" value="GT-I9192"/>
		<parameter name="version" value="4.4.2"/>
		
		<classes>
			<class name="ManualTests.AndroidAppiumTSMasterRunAllTest"/>
		</classes>
	
	</test>
			
	<test name="RunAllTests1">
		<parameter name="address" value="127.0.0.2"/>
		<parameter name="port" value="5733"/>
		<parameter name="id" value="3a78c21e"/>
		<parameter name="device" value="Vodafone Smart Tab 4G"/>
		<parameter name="version" value="4.4.4"/>
	
		<classes>
			<class name="ManualTests.AndroidAppiumTSMasterRunAllTest"/>	
		</classes>
			
	</test>
</suite>`

Log File

2016-06-14 11:00:04:000 - info: Welcome to Appium v1.4.16 (REV ae6877eff263066b26328d457bd285c0cc62430d) 2016-06-14 11:00:04:001 - info: Appium REST http interface listener started on 127.0.0.1:4723 2016-06-14 11:00:04:004 - info: [debug] Non-default server args: {"udid":"0812a4a9","address":"127.0.0.1","bootstrapPort":47232,"sessionOverride":true,"noReset":true,"log":"D://appiumLogs.txt"} 2016-06-14 11:00:04:004 - info: Console LogLevel: debug 2016-06-14 11:00:04:004 - info: File LogLevel: debug 2016-06-14 11:00:04:059 - info: Welcome to Appium v1.4.16 (REV ae6877eff263066b26328d457bd285c0cc62430d) 2016-06-14 11:00:04:061 - info: Appium REST http interface listener started on 127.0.0.2:5733 2016-06-14 11:00:04:064 - info: [debug] Non-default server args: {"udid":"3a78c21e","address":"127.0.0.2","port":5733,"bootstrapPort":57332,"sessionOverride":true,"noReset":true,"log":"D://appiumLogs.txt"} 2016-06-14 11:00:04:065 - info: Console LogLevel: debug 2016-06-14 11:00:04:065 - info: File LogLevel: debug 2016-06-14 11:00:25:736 - info: --> POST /wd/hub/session {"desiredCapabilities":{"appPackage":"org.amazon.inforMain","appActivity":"org.amazon.inforMain.DiagMain","newCommandTimeout":480,"platformVersion":"4.4.4","appWaitPackage":"org.amazon.inforMain","appWaitActivity":"org.amazon.inforMain.DiagMain","browserName":"","platformName":"Android","udid":"3a78c21e","deviceName":"Vodafone Smart Tab 4G"}} 2016-06-14 11:00:25:736 - info: --> POST /wd/hub/session {"desiredCapabilities":{"appPackage":"org.amazon.inforMain","appActivity":"org.amazon.inforMain.DiagMain","newCommandTimeout":480,"platformVersion":"4.4.2","appWaitPackage":"org.amazon.inforMain","appWaitActivity":"org.amazon.inforMain.DiagMain","browserName":"","platformName":"Android","udid":"0812a4a9","deviceName":"GT-I9192"}} 2016-06-14 11:00:25:739 - info: Client User-Agent string: Apache-HttpClient/4.5.1 (Java/1.8.0_91) 2016-06-14 11:00:25:742 - info: [debug] Didn't get app but did get Android package, will attempt to launch it on the device 2016-06-14 11:00:25:739 - info: Client User-Agent string: Apache-HttpClient/4.5.1 (Java/1.8.0_91) 2016-06-14 11:00:25:742 - info: [debug] Didn't get app but did get Android package, will attempt to launch it on the device 2016-06-14 11:00:25:743 - info: [debug] Creating new appium session c07629ba-bfc4-43ae-9111-f022602f1526 2016-06-14 11:00:25:744 - info: Starting android appium 2016-06-14 11:00:25:746 - info: [debug] Getting Java version 2016-06-14 11:00:25:743 - info: [debug] Creating new appium session af5cd08c-0d0a-4e7a-95a7-4871a7683e70 2016-06-14 11:00:25:744 - info: Starting android appium 2016-06-14 11:00:25:746 - info: [debug] Getting Java version 2016-06-14 11:00:25:866 - info: Java version is: 1.8.0_91 2016-06-14 11:00:25:876 - info: Java version is: 1.8.0_91 2016-06-14 11:00:25:867 - info: [debug] Checking whether adb is present 2016-06-14 11:00:25:869 - info: [debug] Using adb from C:\DMServer\Tools\platform-tools\adb.exe 2016-06-14 11:00:25:870 - warn: No app capability, can't parse package/activity 2016-06-14 11:00:25:870 - info: [debug] Using fast reset? false 2016-06-14 11:00:25:871 - info: [debug] Preparing device for session 2016-06-14 11:00:25:871 - info: [debug] Not checking whether app is present since we are assuming it's already on the device 2016-06-14 11:00:25:872 - info: Retrieving device 2016-06-14 11:00:25:872 - info: [debug] Trying to find a connected android device 2016-06-14 11:00:25:873 - info: [debug] Getting connected devices... 2016-06-14 11:00:25:875 - info: [debug] executing cmd: C:\DMServer\Tools\platform-tools\adb.exe devices 2016-06-14 11:00:25:878 - info: [debug] Checking whether adb is present 2016-06-14 11:00:25:880 - info: [debug] Using adb from C:\DMServer\Tools\platform-tools\adb.exe 2016-06-14 11:00:25:880 - warn: No app capability, can't parse package/activity 2016-06-14 11:00:25:881 - info: [debug] Using fast reset? false 2016-06-14 11:00:25:881 - info: [debug] Preparing device for session 2016-06-14 11:00:25:881 - info: [debug] Not checking whether app is present since we are assuming it's already on the device 2016-06-14 11:00:25:882 - info: Retrieving device 2016-06-14 11:00:25:882 - info: [debug] Trying to find a connected android device 2016-06-14 11:00:25:882 - info: [debug] Getting connected devices... 2016-06-14 11:00:25:884 - info: [debug] executing cmd: C:\DMServer\Tools\platform-tools\adb.exe devices 2016-06-14 11:00:25:915 - info: [debug] 2 device(s) connected 2016-06-14 11:00:25:923 - info: [debug] 2 device(s) connected 2016-06-14 11:00:25:916 - info: Found device 3a78c21e 2016-06-14 11:00:25:917 - info: [debug] Setting device id to 3a78c21e 2016-06-14 11:00:25:918 - info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5) 2016-06-14 11:00:25:919 - info: [debug] executing cmd: C:\DMServer\Tools\platform-tools\adb.exe -s 3a78c21e wait-for-device 2016-06-14 11:00:25:924 - info: Found device 0812a4a9 2016-06-14 11:00:25:924 - info: [debug] Setting device id to 0812a4a9 2016-06-14 11:00:25:925 - info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5) 2016-06-14 11:00:25:926 - info: [debug] executing cmd: C:\DMServer\Tools\platform-tools\adb.exe -s 0812a4a9 wait-for-device 2016-06-14 11:00:25:951 - info: [debug] executing cmd: C:\DMServer\Tools\platform-tools\adb.exe -s 3a78c21e shell "echo 'ready'" 2016-06-14 11:00:25:959 - info: [debug] executing cmd: C:\DMServer\Tools\platform-tools\adb.exe -s 0812a4a9 shell "echo 'ready'" 2016-06-14 11:00:25:999 - info: [debug] Starting logcat capture 2016-06-14 11:00:26:009 - info: [debug] Starting logcat capture 2016-06-14 11:00:26:031 - info: [debug] Getting device API level 2016-06-14 11:00:26:037 - info: [debug] Getting device API level 2016-06-14 11:00:26:031 - info: [debug] executing cmd: C:\DMServer\Tools\platform-tools\adb.exe -s 3a78c21e shell "getprop ro.build.version.sdk" 2016-06-14 11:00:26:038 - info: [debug] executing cmd: C:\DMServer\Tools\platform-tools\adb.exe -s 0812a4a9 shell "getprop ro.build.version.sdk" 2016-06-14 11:00:26:104 - info: [debug] Device is at API Level 19 2016-06-14 11:00:26:114 - info: [debug] Device is at API Level 19 2016-06-14 11:00:26:105 - info: Device API level is: 19 2016-06-14 11:00:26:105 - info: [debug] Extracting strings for language: default 2016-06-14 11:00:26:106 - info: [debug] Apk doesn't exist locally 2016-06-14 11:00:26:106 - info: [debug] Could not get strings, but it looks like we had an old strings file anyway, so ignoring 2016-06-14 11:00:26:106 - info: [debug] executing cmd: C:\DMServer\Tools\platform-tools\adb.exe -s 0812a4a9 shell "rm -rf /data/local/tmp/strings.json" 2016-06-14 11:00:26:115 - info: Device API level is: 19 2016-06-14 11:00:26:115 - info: [debug] Extracting strings for language: default 2016-06-14 11:00:26:116 - info: [debug] Apk doesn't exist locally 2016-06-14 11:00:26:116 - info: [debug] Could not get strings, but it looks like we had an old strings file anyway, so ignoring 2016-06-14 11:00:26:117 - info: [debug] executing cmd: C:\DMServer\Tools\platform-tools\adb.exe -s 3a78c21e shell "rm -rf /data/local/tmp/strings.json" 2016-06-14 11:00:26:168 - info: [debug] Not uninstalling app since server not started with --full-reset 2016-06-14 11:00:26:168 - info: [debug] Skipping install since we launched with a package instead of an app path 2016-06-14 11:00:26:168 - info: [debug] Forwarding system:47232 to device:4724 2016-06-14 11:00:26:169 - info: [debug] executing cmd: C:\DMServer\Tools\platform-tools\adb.exe -s 0812a4a9 forward tcp:47232 tcp:4724 2016-06-14 11:00:26:201 - info: [debug] Not uninstalling app since server not started with --full-reset 2016-06-14 11:00:26:206 - info: [debug] Pushing appium bootstrap to device... 2016-06-14 11:00:26:207 - info: [debug] executing cmd: C:\DMServer\Tools\platform-tools\adb.exe -s 0812a4a9 push "C:\\Progra~2\\Appium\\node_modules\\appium\\build\\android_bootstrap\\AppiumBootstrap.jar" /data/local/tmp/ 2016-06-14 11:00:26:201 - info: [debug] Skipping install since we launched with a package instead of an app path 2016-06-14 11:00:26:201 - info: [debug] Forwarding system:57332 to device:4724 2016-06-14 11:00:26:202 - info: [debug] executing cmd: C:\DMServer\Tools\platform-tools\adb.exe -s 3a78c21e forward tcp:57332 tcp:4724 2016-06-14 11:00:26:246 - info: [debug] Pushing appium bootstrap to device... 2016-06-14 11:00:26:247 - info: [debug] executing cmd: C:\DMServer\Tools\platform-tools\adb.exe -s 3a78c21e push "C:\\Progra~2\\Appium\\node_modules\\appium\\build\\android_bootstrap\\AppiumBootstrap.jar" /data/local/tmp/ 2016-06-14 11:00:26:276 - info: [debug] Pushing settings apk to device... 2016-06-14 11:00:26:280 - info: [debug] executing cmd: C:\DMServer\Tools\platform-tools\adb.exe -s 0812a4a9 install "C:\Progra~2\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk" 2016-06-14 11:00:26:300 - info: [debug] Pushing settings apk to device... 2016-06-14 11:00:26:301 - info: [debug] executing cmd: C:\DMServer\Tools\platform-tools\adb.exe -s 3a78c21e install "C:\Progra~2\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk" 2016-06-14 11:00:27:247 - info: [debug] Pushing unlock helper app to device... 2016-06-14 11:00:27:248 - info: [debug] executing cmd: C:\DMServer\Tools\platform-tools\adb.exe -s 3a78c21e install "C:\Progra~2\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk" 2016-06-14 11:00:27:959 - info: [debug] Pushing unlock helper app to device... 2016-06-14 11:00:27:960 - info: [debug] executing cmd: C:\DMServer\Tools\platform-tools\adb.exe -s 0812a4a9 install "C:\Progra~2\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk" 2016-06-14 11:00:28:230 - info: Starting App 2016-06-14 11:00:28:231 - info: [debug] Attempting to kill all 'uiautomator' processes 2016-06-14 11:00:28:232 - info: [debug] Getting all processes with 'uiautomator' 2016-06-14 11:00:28:232 - info: [debug] executing cmd: C:\DMServer\Tools\platform-tools\adb.exe -s 3a78c21e shell "ps 'uiautomator'" 2016-06-14 11:00:28:345 - info: [debug] No matching processes found 2016-06-14 11:00:28:346 - info: [debug] Running bootstrap 2016-06-14 11:00:28:347 - info: [debug] spawning: C:\DMServer\Tools\platform-tools\adb.exe -s 3a78c21e shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap -e pkg org.amazon.inforMain -e disableAndroidWatchers false 2016-06-14 11:00:28:974 - info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1 2016-06-14 11:00:28:975 - info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream= 2016-06-14 11:00:28:975 - info: [debug] [UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap: 2016-06-14 11:00:28:976 - info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner 2016-06-14 11:00:28:976 - info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer 2016-06-14 11:00:28:976 - info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap 2016-06-14 11:00:28:977 - info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1 2016-06-14 11:00:28:977 - info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 1 2016-06-14 11:00:28:993 - info: [debug] [BOOTSTRAP] [debug] Socket opened on port 4724 2016-06-14 11:00:28:998 - info: [debug] [BOOTSTRAP] [debug] Appium Socket Server Ready 2016-06-14 11:00:28:999 - info: [debug] [BOOTSTRAP] [debug] Loading json... 2016-06-14 11:00:29:000 - info: [debug] [BOOTSTRAP] [debug] Registered crash watchers. 2016-06-14 11:00:29:010 - info: [debug] Waking up device if it's not alive 2016-06-14 11:00:29:010 - info: [debug] Pushing command to appium work queue: ["wake",{}] 2016-06-14 11:00:29:013 - info: [debug] [BOOTSTRAP] [debug] Client connected 2016-06-14 11:00:29:015 - info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"wake","params":{}} 2016-06-14 11:00:29:016 - info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION 2016-06-14 11:00:29:016 - info: [debug] [BOOTSTRAP] [debug] Got command action: wake 2016-06-14 11:00:29:017 - info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":true,"status":0} 2016-06-14 11:00:29:018 - info: [debug] executing cmd: C:\DMServer\Tools\platform-tools\adb.exe -s 3a78c21e shell "dumpsys window" 2016-06-14 11:00:29:112 - info: [debug] Screen already unlocked, continuing. 2016-06-14 11:00:29:112 - info: [debug] Pushing command to appium work queue: ["getDataDir",{}] 2016-06-14 11:00:29:117 - info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"getDataDir","params":{}} 2016-06-14 11:00:29:117 - info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION 2016-06-14 11:00:29:117 - info: [debug] [BOOTSTRAP] [debug] Got command action: getDataDir 2016-06-14 11:00:29:118 - info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"\/data\/local\/tmp","status":0} 2016-06-14 11:00:29:118 - info: [debug] dataDir set to: /data/local/tmp 2016-06-14 11:00:29:118 - info: [debug] Pushing command to appium work queue: ["compressedLayoutHierarchy",{"compressLayout":false}] 2016-06-14 11:00:29:123 - info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"compressedLayoutHierarchy","params":{"compressLayout":false}} 2016-06-14 11:00:29:123 - info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION 2016-06-14 11:00:29:123 - info: [debug] [BOOTSTRAP] [debug] Got command action: compressedLayoutHierarchy 2016-06-14 11:00:29:124 - info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":false,"status":0} 2016-06-14 11:00:29:124 - info: [debug] Getting device API level 2016-06-14 11:00:29:125 - info: [debug] executing cmd: C:\DMServer\Tools\platform-tools\adb.exe -s 3a78c21e shell "getprop ro.build.version.sdk" 2016-06-14 11:00:29:159 - info: [debug] Device is at API Level 19 2016-06-14 11:00:29:160 - info: [debug] executing cmd: C:\DMServer\Tools\platform-tools\adb.exe -s 3a78c21e shell "am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n org.amazon.inforMain/org.amazon.inforMain.DiagMain" 2016-06-14 11:00:29:379 - info: Starting App 2016-06-14 11:00:29:380 - info: [debug] Attempting to kill all 'uiautomator' processes 2016-06-14 11:00:29:380 - info: [debug] Getting all processes with 'uiautomator' 2016-06-14 11:00:29:381 - info: [debug] executing cmd: C:\DMServer\Tools\platform-tools\adb.exe -s 0812a4a9 shell "ps 'uiautomator'" 2016-06-14 11:00:29:497 - info: [debug] No matching processes found 2016-06-14 11:00:29:497 - info: [debug] Running bootstrap 2016-06-14 11:00:29:498 - info: [debug] spawning: C:\DMServer\Tools\platform-tools\adb.exe -s 0812a4a9 shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap -e pkg org.amazon.inforMain -e disableAndroidWatchers false 2016-06-14 11:00:30:222 - info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1 2016-06-14 11:00:30:223 - info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream= 2016-06-14 11:00:30:223 - info: [debug] [UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap: 2016-06-14 11:00:30:224 - info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner 2016-06-14 11:00:30:225 - info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer 2016-06-14 11:00:30:225 - info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap 2016-06-14 11:00:30:225 - info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1 2016-06-14 11:00:30:226 - info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 1 2016-06-14 11:00:30:247 - info: [debug] [BOOTSTRAP] [debug] Socket opened on port 4724 2016-06-14 11:00:30:251 - info: [debug] [BOOTSTRAP] [debug] Appium Socket Server Ready 2016-06-14 11:00:30:251 - info: [debug] [BOOTSTRAP] [debug] Loading json... 2016-06-14 11:00:30:253 - info: [debug] [BOOTSTRAP] [debug] Registered crash watchers. 2016-06-14 11:00:30:266 - info: [debug] Waking up device if it's not alive 2016-06-14 11:00:30:267 - info: [debug] Pushing command to appium work queue: ["wake",{}] 2016-06-14 11:00:30:267 - info: [debug] Waiting for pkg "org.amazon.inforMain" and activity "org.amazon.inforMain.DiagMain" to be focused 2016-06-14 11:00:30:277 - info: [debug] [BOOTSTRAP] [debug] Client connected 2016-06-14 11:00:30:278 - info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"wake","params":{}} 2016-06-14 11:00:30:280 - info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION 2016-06-14 11:00:30:280 - info: [debug] [BOOTSTRAP] [debug] Got command action: wake 2016-06-14 11:00:30:268 - info: [debug] Getting focused package and activity 2016-06-14 11:00:30:269 - info: [debug] executing cmd: C:\DMServer\Tools\platform-tools\adb.exe -s 3a78c21e shell "dumpsys window windows" 2016-06-14 11:00:30:285 - info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":true,"status":0} 2016-06-14 11:00:30:287 - info: [debug] executing cmd: C:\DMServer\Tools\platform-tools\adb.exe -s 0812a4a9 shell "dumpsys window" 2016-06-14 11:00:30:385 - info: [debug] Screen already unlocked, continuing. 2016-06-14 11:00:30:385 - info: [debug] Pushing command to appium work queue: ["getDataDir",{}] 2016-06-14 11:00:30:391 - info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"getDataDir","params":{}} 2016-06-14 11:00:30:391 - info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION 2016-06-14 11:00:30:391 - info: [debug] [BOOTSTRAP] [debug] Got command action: getDataDir 2016-06-14 11:00:30:391 - info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"\/data\/local\/tmp","status":0} 2016-06-14 11:00:30:392 - info: [debug] dataDir set to: /data/local/tmp 2016-06-14 11:00:30:392 - info: [debug] Pushing command to appium work queue: ["compressedLayoutHierarchy",{"compressLayout":false}] 2016-06-14 11:00:30:396 - info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"compressedLayoutHierarchy","params":{"compressLayout":false}} 2016-06-14 11:00:30:399 - info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION 2016-06-14 11:00:30:399 - info: [debug] [BOOTSTRAP] [debug] Got command action: compressedLayoutHierarchy 2016-06-14 11:00:30:402 - info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":false,"status":0} 2016-06-14 11:00:30:404 - info: [debug] Getting device API level 2016-06-14 11:00:30:404 - info: [debug] executing cmd: C:\DMServer\Tools\platform-tools\adb.exe -s 0812a4a9 shell "getprop ro.build.version.sdk" 2016-06-14 11:00:30:454 - info: [debug] Device is at API Level 19 2016-06-14 11:00:30:455 - info: [debug] executing cmd: C:\DMServer\Tools\platform-tools\adb.exe -s 0812a4a9 shell "am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n org.amazon.inforMain/org.amazon.inforMain.DiagMain" 2016-06-14 11:00:30:825 - info: [debug] executing cmd: C:\DMServer\Tools\platform-tools\adb.exe -s 3a78c21e shell "getprop ro.build.version.release" 2016-06-14 11:00:30:875 - info: [debug] Device is at release version 4.4.4 2016-06-14 11:00:30:875 - info: [debug] Device launched! Ready for commands 2016-06-14 11:00:30:876 - info: [debug] Setting command timeout to 480 secs 2016-06-14 11:00:30:876 - info: [debug] Appium session started with sessionId af5cd08c-0d0a-4e7a-95a7-4871a7683e70 2016-06-14 11:00:30:880 - info: <-- POST /wd/hub/session 303 5144.535 ms - 74 2016-06-14 11:00:30:894 - info: --> GET /wd/hub/session/af5cd08c-0d0a-4e7a-95a7-4871a7683e70 {} 2016-06-14 11:00:30:896 - info: [debug] Responding to client with success: {"status":0,"value":{"platform":"LINUX","browserName":"","platformVersion":"4.4.4","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"appPackage":"org.amazon.inforMain","appActivity":"org.amazon.inforMain.DiagMain","newCommandTimeout":480,"platformVersion":"4.4.4","appWaitPackage":"org.amazon.inforMain","appWaitActivity":"org.amazon.inforMain.DiagMain","browserName":"","platformName":"Android","udid":"3a78c21e","deviceName":"Vodafone Smart Tab 4G"},"appPackage":"org.amazon.inforMain","appActivity":"org.amazon.inforMain.DiagMain","newCommandTimeout":480,"appWaitPackage":"org.amazon.inforMain","appWaitActivity":"org.amazon.inforMain.DiagMain","platformName":"Android","udid":"3a78c21e","deviceName":"3a78c21e"},"sessionId":"af5cd08c-0d0a-4e7a-95a7-4871a7683e70"} 2016-06-14 11:00:30:899 - info: <-- GET /wd/hub/session/af5cd08c-0d0a-4e7a-95a7-4871a7683e70 200 4.376 ms - 904 {"status":0,"value":{"platform":"LINUX","browserName":"","platformVersion":"4.4.4","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"appPackage":"org.amazon.inforMain","appActivity":"org.amazon.inforMain.DiagMain","newCommandTimeout":480,"platformVersion":"4.4.4","appWaitPackage":"org.amazon.inforMain","appWaitActivity":"org.amazon.inforMain.DiagMain","browserName":"","platformName":"Android","udid":"3a78c21e","deviceName":"Vodafone Smart Tab 4G"},"appPackage":"org.amazon.inforMain","appActivity":"org.amazon.inforMain.DiagMain","newCommandTimeout":480,"appWaitPackage":"org.amazon.inforMain","appWaitActivity":"org.amazon.inforMain.DiagMain","platformName":"Android","udid":"3a78c21e","deviceName":"3a78c21e"},"sessionId":"af5cd08c-0d0a-4e7a-95a7-4871a7683e70"} 2016-06-14 11:00:30:928 - info: --> POST /wd/hub/session/af5cd08c-0d0a-4e7a-95a7-4871a7683e70/timeouts {"type":"implicit","ms":6000} 2016-06-14 11:00:30:930 - info: [debug] Set Android implicit wait to 6000ms 2016-06-14 11:00:30:931 - info: [debug] Responding to client with success: {"status":0,"value":null,"sessionId":"af5cd08c-0d0a-4e7a-95a7-4871a7683e70"} 2016-06-14 11:00:30:931 - info: <-- POST /wd/hub/session/af5cd08c-0d0a-4e7a-95a7-4871a7683e70/timeouts 200 3.223 ms - 76 {"status":0,"value":null,"sessionId":"af5cd08c-0d0a-4e7a-95a7-4871a7683e70"} 2016-06-14 11:00:31:850 - info: [debug] Waiting for pkg "org.amazon.inforMain" and activity "org.amazon.inforMain.DiagMain" to be focused 2016-06-14 11:00:31:851 - info: [debug] Getting focused package and activity 2016-06-14 11:00:31:852 - info: [debug] executing cmd: C:\DMServer\Tools\platform-tools\adb.exe -s 0812a4a9 shell "dumpsys window windows" 2016-06-14 11:00:31:968 - info: [debug] executing cmd: C:\DMServer\Tools\platform-tools\adb.exe -s 0812a4a9 shell "getprop ro.build.version.release" 2016-06-14 11:00:32:005 - info: [debug] Device is at release version 4.4.2 2016-06-14 11:00:32:005 - info: [debug] Device launched! Ready for commands 2016-06-14 11:00:32:006 - info: [debug] Setting command timeout to 480 secs 2016-06-14 11:00:32:006 - info: [debug] Appium session started with sessionId c07629ba-bfc4-43ae-9111-f022602f1526 2016-06-14 11:00:32:011 - info: <-- POST /wd/hub/session 303 6275.571 ms - 74 2016-06-14 11:00:32:014 - info: --> GET /wd/hub/session/c07629ba-bfc4-43ae-9111-f022602f1526 {} 2016-06-14 11:00:32:016 - info: [debug] Responding to client with success: {"status":0,"value":{"platform":"LINUX","browserName":"","platformVersion":"4.4.2","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"appPackage":"org.amazon.inforMain","appActivity":"org.amazon.inforMain.DiagMain","newCommandTimeout":480,"platformVersion":"4.4.2","appWaitPackage":"org.amazon.inforMain","appWaitActivity":"org.amazon.inforMain.DiagMain","browserName":"","platformName":"Android","udid":"0812a4a9","deviceName":"GT-I9192"},"appPackage":"org.amazon.inforMain","appActivity":"org.amazon.inforMain.DiagMain","newCommandTimeout":480,"appWaitPackage":"org.amazon.inforMain","appWaitActivity":"org.amazon.inforMain.DiagMain","platformName":"Android","udid":"0812a4a9","deviceName":"0812a4a9"},"sessionId":"c07629ba-bfc4-43ae-9111-f022602f1526"} 2016-06-14 11:00:32:019 - info: <-- GET /wd/hub/session/c07629ba-bfc4-43ae-9111-f022602f1526 200 4.181 ms - 891 {"status":0,"value":{"platform":"LINUX","browserName":"","platformVersion":"4.4.2","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"appPackage":"org.amazon.inforMain","appActivity":"org.amazon.inforMain.DiagMain","newCommandTimeout":480,"platformVersion":"4.4.2","appWaitPackage":"org.amazon.inforMain","appWaitActivity":"org.amazon.inforMain.DiagMain","browserName":"","platformName":"Android","udid":"0812a4a9","deviceName":"GT-I9192"},"appPackage":"org.amazon.inforMain","appActivity":"org.amazon.inforMain.DiagMain","newCommandTimeout":480,"appWaitPackage":"org.amazon.inforMain","appWaitActivity":"org.amazon.inforMain.DiagMain","platformName":"Android","udid":"0812a4a9","deviceName":"0812a4a9"},"sessionId":"c07629ba-bfc4-43ae-9111-f022602f1526"} 2016-06-14 11:00:32:023 - info: --> POST /wd/hub/session/c07629ba-bfc4-43ae-9111-f022602f1526/timeouts {"type":"implicit","ms":6000} 2016-06-14 11:00:32:025 - info: [debug] Set Android implicit wait to 6000ms 2016-06-14 11:00:32:026 - info: [debug] Responding to client with success: {"status":0,"value":null,"sessionId":"c07629ba-bfc4-43ae-9111-f022602f1526"} 2016-06-14 11:00:32:026 - info: <-- POST /wd/hub/session/c07629ba-bfc4-43ae-9111-f022602f1526/timeouts 200 3.148 ms - 76 {"status":0,"value":null,"sessionId":"c07629ba-bfc4-43ae-9111-f022602f1526"} 2016-06-14 11:01:06:967 - info: --> POST /wd/hub/session/c07629ba-bfc4-43ae-9111-f022602f1526/element {"using":"id","value":"org.amazon.inforMain:id/button_capture"} 2016-06-14 11:01:06:968 - info: [debug] Waiting up to 6000ms for condition 2016-06-14 11:01:06:968 - info: [debug] Pushing command to appium work queue: ["find",{"strategy":"id","selector":"org.amazon.inforMain:id/button_capture","context":"","multiple":false}] 2016-06-14 11:01:06:970 - info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"org.amazon.inforMain:id/button_capture","context":"","multiple":false}} 2016-06-14 11:01:06:972 - info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION 2016-06-14 11:01:06:973 - info: [debug] [BOOTSTRAP] [debug] Got command action: find 2016-06-14 11:01:06:973 - info: [debug] [BOOTSTRAP] [debug] Finding org.amazon.inforMain:id/button_capture using ID with the contextId: multiple: false 2016-06-14 11:01:06:973 - info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=org.amazon.inforMain:id/button_capture] 2016-06-14 11:01:07:764 - info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":{"ELEMENT":"1"},"status":0} 2016-06-14 11:01:07:766 - info: [debug] Responding to client with success: {"status":0,"value":{"ELEMENT":"1"},"sessionId":"c07629ba-bfc4-43ae-9111-f022602f1526"} 2016-06-14 11:01:07:768 - info: <-- POST /wd/hub/session/c07629ba-bfc4-43ae-9111-f022602f1526/element 200 801.200 ms - 87 {"status":0,"value":{"ELEMENT":"1"},"sessionId":"c07629ba-bfc4-43ae-9111-f022602f1526"} 2016-06-14 11:01:07:776 - info: --> POST /wd/hub/session/c07629ba-bfc4-43ae-9111-f022602f1526/element/1/click {"id":"1"} 2016-06-14 11:01:07:776 - info: [debug] Pushing command to appium work queue: ["element:click",{"elementId":"1"}] 2016-06-14 11:01:07:779 - info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"element:click","params":{"elementId":"1"}} 2016-06-14 11:01:07:779 - info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION 2016-06-14 11:01:07:779 - info: [debug] [BOOTSTRAP] [debug] Got command action: click 2016-06-14 11:01:08:038 - info: --> POST /wd/hub/session/c07629ba-bfc4-43ae-9111-f022602f1526/element {"using":"id","value":"org.amazon.inforMain:id/button_capture"} 2016-06-14 11:01:08:045 - info: [debug] Waiting up to 6000ms for condition 2016-06-14 11:01:08:045 - info: [debug] Pushing command to appium work queue: ["find",{"strategy":"id","selector":"org.amazon.inforMain:id/button_capture","context":"","multiple":false}] 2016-06-14 11:01:10:266 - info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":true,"status":0} 2016-06-14 11:01:10:267 - info: [debug] Responding to client with success: {"status":0,"value":true,"sessionId":"c07629ba-bfc4-43ae-9111-f022602f1526"} 2016-06-14 11:01:10:269 - info: <-- POST /wd/hub/session/c07629ba-bfc4-43ae-9111-f022602f1526/element/1/click 200 2492.069 ms - 76 {"status":0,"value":true,"sessionId":"c07629ba-bfc4-43ae-9111-f022602f1526"} 2016-06-14 11:01:10:277 - info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"org.amazon.inforMain:id/button_capture","context":"","multiple":false}} 2016-06-14 11:01:10:278 - info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION 2016-06-14 11:01:10:278 - info: [debug] [BOOTSTRAP] [debug] Got command action: find 2016-06-14 11:01:10:280 - info: [debug] [BOOTSTRAP] [debug] Finding org.amazon.inforMain:id/button_capture using ID with the contextId: multiple: false 2016-06-14 11:01:10:281 - info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=org.amazon.inforMain:id/button_capture] 2016-06-14 11:01:10:295 - info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":{"ELEMENT":"2"},"status":0} 2016-06-14 11:01:10:297 - info: [debug] Responding to client with success: {"status":0,"value":{"ELEMENT":"2"},"sessionId":"c07629ba-bfc4-43ae-9111-f022602f1526"} 2016-06-14 11:01:10:298 - info: <-- POST /wd/hub/session/c07629ba-bfc4-43ae-9111-f022602f1526/element 200 2259.140 ms - 87 {"status":0,"value":{"ELEMENT":"2"},"sessionId":"c07629ba-bfc4-43ae-9111-f022602f1526"} 2016-06-14 11:01:10:302 - info: --> POST /wd/hub/session/c07629ba-bfc4-43ae-9111-f022602f1526/element/2/click {"id":"2"} 2016-06-14 11:01:10:302 - info: [debug] Pushing command to appium work queue: ["element:click",{"elementId":"2"}] 2016-06-14 11:01:10:307 - info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"element:click","params":{"elementId":"2"}} 2016-06-14 11:01:10:308 - info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION 2016-06-14 11:01:10:308 - info: [debug] [BOOTSTRAP] [debug] Got command action: click 2016-06-14 11:01:11:931 - info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":true,"status":0} 2016-06-14 11:01:11:932 - info: [debug] Responding to client with success: {"status":0,"value":true,"sessionId":"c07629ba-bfc4-43ae-9111-f022602f1526"} 2016-06-14 11:01:11:932 - info: <-- POST /wd/hub/session/c07629ba-bfc4-43ae-9111-f022602f1526/element/2/click 200 1630.823 ms - 76 {"status":0,"value":true,"sessionId":"c07629ba-bfc4-43ae-9111-f022602f1526"} 2016-06-14 11:01:23:276 - info: --> POST /wd/hub/session/c07629ba-bfc4-43ae-9111-f022602f1526/timeouts {"type":"implicit","ms":0} 2016-06-14 11:01:23:277 - info: [debug] Set Android implicit wait to 0ms 2016-06-14 11:01:23:277 - info: [debug] Responding to client with success: {"status":0,"value":null,"sessionId":"c07629ba-bfc4-43ae-9111-f022602f1526"} 2016-06-14 11:01:23:277 - info: <-- POST /wd/hub/session/c07629ba-bfc4-43ae-9111-f022602f1526/timeouts 200 1.359 ms - 76 {"status":0,"value":null,"sessionId":"c07629ba-bfc4-43ae-9111-f022602f1526"} 2016-06-14 11:01:23:284 - info: --> POST /wd/hub/session/c07629ba-bfc4-43ae-9111-f022602f1526/element {"using":"xpath","value":"//android.widget.ImageView[contains(@resource-id,'imgPreview')]"} 2016-06-14 11:01:23:285 - info: [debug] Waiting up to 0ms for condition 2016-06-14 11:01:23:285 - info: [debug] Pushing command to appium work queue: ["find",{"strategy":"xpath","selector":"//android.widget.ImageView[contains(@resource-id,'imgPreview')]","context":"","multiple":false}] 2016-06-14 11:01:23:293 - info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"xpath","selector":"//android.widget.ImageView[contains(@resource-id,'imgPreview')]","context":"","multiple":false}} 2016-06-14 11:01:23:293 - info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION 2016-06-14 11:01:23:293 - info: [debug] [BOOTSTRAP] [debug] Got command action: find 2016-06-14 11:01:23:293 - info: [debug] [BOOTSTRAP] [debug] Finding //android.widget.ImageView[contains(@resource-id,'imgPreview')] using XPATH with the contextId: multiple: false 2016-06-14 11:01:23:462 - info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[CLASS=android.widget.ImageView, INSTANCE=0] 2016-06-14 11:01:23:468 - info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":{"ELEMENT":"3"},"status":0} 2016-06-14 11:01:23:472 - info: [debug] Responding to client with success: {"status":0,"value":{"ELEMENT":"3"},"sessionId":"c07629ba-bfc4-43ae-9111-f022602f1526"} 2016-06-14 11:01:23:473 - info: <-- POST /wd/hub/session/c07629ba-bfc4-43ae-9111-f022602f1526/element 200 188.665 ms - 87 {"status":0,"value":{"ELEMENT":"3"},"sessionId":"c07629ba-bfc4-43ae-9111-f022602f1526"} 2016-06-14 11:01:23:488 - info: --> POST /wd/hub/session/c07629ba-bfc4-43ae-9111-f022602f1526/timeouts {"type":"implicit","ms":60000} 2016-06-14 11:01:23:489 - info: [debug] Set Android implicit wait to 60000ms 2016-06-14 11:01:23:489 - info: [debug] Responding to client with success: {"status":0,"value":null,"sessionId":"c07629ba-bfc4-43ae-9111-f022602f1526"} 2016-06-14 11:01:23:490 - info: <-- POST /wd/hub/session/c07629ba-bfc4-43ae-9111-f022602f1526/timeouts 200 2.621 ms - 76 {"status":0,"value":null,"sessionId":"c07629ba-bfc4-43ae-9111-f022602f1526"} 2016-06-14 11:01:23:496 - info: --> POST /wd/hub/session/c07629ba-bfc4-43ae-9111-f022602f1526/element/3/click {"id":"3"} 2016-06-14 11:01:23:496 - info: [debug] Pushing command to appium work queue: ["element:click",{"elementId":"3"}] 2016-06-14 11:01:23:499 - info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"element:click","params":{"elementId":"3"}} 2016-06-14 11:01:23:500 - info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION 2016-06-14 11:01:23:501 - info: [debug] [BOOTSTRAP] [debug] Got command action: click 2016-06-14 11:01:23:836 - info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":true,"status":0} 2016-06-14 11:01:23:836 - info: [debug] Responding to client with success: {"status":0,"value":true,"sessionId":"c07629ba-bfc4-43ae-9111-f022602f1526"} 2016-06-14 11:01:23:837 - info: <-- POST /wd/hub/session/c07629ba-bfc4-43ae-9111-f022602f1526/element/3/click 200 341.582 ms - 76 {"status":0,"value":true,"sessionId":"c07629ba-bfc4-43ae-9111-f022602f1526"} 2016-06-14 11:01:24:937 - info: --> POST /wd/hub/session/c07629ba-bfc4-43ae-9111-f022602f1526/timeouts {"type":"implicit","ms":0} 2016-06-14 11:01:24:937 - info: [debug] Set Android implicit wait to 0ms 2016-06-14 11:01:24:937 - info: [debug] Responding to client with success: {"status":0,"value":null,"sessionId":"c07629ba-bfc4-43ae-9111-f022602f1526"} 2016-06-14 11:01:24:940 - info: <-- POST /wd/hub/session/c07629ba-bfc4-43ae-9111-f022602f1526/timeouts 200 3.377 ms - 76 {"status":0,"value":null,"sessionId":"c07629ba-bfc4-43ae-9111-f022602f1526"} 2016-06-14 11:01:24:941 - info: --> POST /wd/hub/session/c07629ba-bfc4-43ae-9111-f022602f1526/element {"using":"xpath","value":"//android.widget.ImageView[contains(@resource-id,'imgPreview')]"} 2016-06-14 11:01:24:941 - info: [debug] Waiting up to 0ms for condition 2016-06-14 11:01:24:941 - info: [debug] Pushing command to appium work queue: ["find",{"strategy":"xpath","selector":"//android.widget.ImageView[contains(@resource-id,'imgPreview')]","context":"","multiple":false}] 2016-06-14 11:01:24:948 - info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"xpath","selector":"//android.widget.ImageView[contains(@resource-id,'imgPreview')]","context":"","multiple":false}} 2016-06-14 11:01:24:948 - info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION 2016-06-14 11:01:24:950 - info: [debug] [BOOTSTRAP] [debug] Got command action: find 2016-06-14 11:01:24:951 - info: [debug] [BOOTSTRAP] [debug] Finding //android.widget.ImageView[contains(@resource-id,'imgPreview')] using XPATH with the contextId: multiple: false 2016-06-14 11:01:25:085 - info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"Could not find an element using supplied strategy. ","status":7} 2016-06-14 11:01:25:086 - info: [debug] Condition unmet after 145ms. Timing out. 2016-06-14 11:01:25:086 - info: [debug] Responding to client with error: {"status":7,"value":{"message":"An element could not be located on the page using the given search parameters.","origValue":"Could not find an element using supplied strategy. "},"sessionId":"c07629ba-bfc4-43ae-9111-f022602f1526"} 2016-06-14 11:01:25:088 - info: <-- POST /wd/hub/session/c07629ba-bfc4-43ae-9111-f022602f1526/element 500 146.806 ms - 230 2016-06-14 11:01:25:092 - info: --> POST /wd/hub/session/c07629ba-bfc4-43ae-9111-f022602f1526/timeouts {"type":"implicit","ms":60000} 2016-06-14 11:01:25:092 - info: [debug] Set Android implicit wait to 60000ms 2016-06-14 11:01:25:092 - info: [debug] Responding to client with success: {"status":0,"value":null,"sessionId":"c07629ba-bfc4-43ae-9111-f022602f1526"} 2016-06-14 11:01:25:093 - info: <-- POST /wd/hub/session/c07629ba-bfc4-43ae-9111-f022602f1526/timeouts 200 1.053 ms - 76 {"status":0,"value":null,"sessionId":"c07629ba-bfc4-43ae-9111-f022602f1526"} 2016-06-14 11:01:25:106 - info: --> DELETE /wd/hub/session/c07629ba-bfc4-43ae-9111-f022602f1526 {} 2016-06-14 11:01:25:106 - info: Shutting down appium session 2016-06-14 11:01:25:108 - info: [debug] Pressing the HOME button 2016-06-14 11:01:25:108 - info: [debug] executing cmd: C:\DMServer\Tools\platform-tools\adb.exe -s 0812a4a9 shell "input keyevent 3" 2016-06-14 11:01:25:942 - info: [debug] Stopping logcat capture 2016-06-14 11:01:25:949 - info: [debug] Logcat terminated with code null, signal SIGTERM 2016-06-14 11:01:25:957 - info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"shutdown"} 2016-06-14 11:01:25:958 - info: [debug] [BOOTSTRAP] [debug] Got command of type SHUTDOWN 2016-06-14 11:01:25:958 - info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"OK, shutting down","status":0} 2016-06-14 11:01:25:958 - info: [debug] [BOOTSTRAP] [debug] Closed client connection 2016-06-14 11:01:25:958 - info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1 2016-06-14 11:01:25:958 - info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=. 2016-06-14 11:01:25:959 - info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner 2016-06-14 11:01:25:959 - info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer 2016-06-14 11:01:25:959 - info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap 2016-06-14 11:01:25:959 - info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1 2016-06-14 11:01:25:959 - info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 0 2016-06-14 11:01:25:959 - info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream= 2016-06-14 11:01:25:959 - info: [debug] [UIAUTOMATOR STDOUT] Test results for WatcherResultPrinter=. 2016-06-14 11:01:25:960 - info: [debug] [UIAUTOMATOR STDOUT] Time: 55.833 2016-06-14 11:01:25:960 - info: [debug] [UIAUTOMATOR STDOUT] OK (1 test) 2016-06-14 11:01:25:960 - info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: -1 2016-06-14 11:01:25:962 - info: [debug] Sent shutdown command, waiting for UiAutomator to stop... 2016-06-14 11:01:25:969 - info: [debug] UiAutomator shut down normally 2016-06-14 11:01:25:970 - info: [debug] Cleaning up android objects 2016-06-14 11:01:25:970 - info: [debug] Cleaning up appium session 2016-06-14 11:01:25:970 - info: [debug] Responding to client with success: {"status":0,"value":null,"sessionId":"c07629ba-bfc4-43ae-9111-f022602f1526"} 2016-06-14 11:01:25:973 - info: <-- DELETE /wd/hub/session/c07629ba-bfc4-43ae-9111-f022602f1526 200 867.709 ms - 76 {"status":0,"value":null,"sessionId":"c07629ba-bfc4-43ae-9111-f022602f1526"}

Here what i obsered is all tests(testng threads) are executed under session id : c07629ba-bfc4-43ae-9111-f022602f1526

not spinning to another session id : af5cd08c-0d0a-4e7a-95a7-4871a7683e70

plz let me know what is wrong with me.

@naveen.auvusali: Okay I got the problem. You are trying to spin off one appium server on 127.0.0.2 which is invalid. You can’t do that. Because 127.0.0.1 is a loopback address for your localhost, 127.0.0.2 is nothing. That is why you see the session is created successfully on 127.0.0.1 and nothing happens on 127.0.0.2. This is my assumption and I may be wrong.

So what you should do is, use the same address for both, that is 127.0.0.1 and use different ports as you did already. Hopefully this will work.

But why don’t you use the AppiumLocalService to start the appium server locally for you? Refer this:

yes already i tried with same address 127.0.0.1 + different ports …same thing happening…is there any problem with testng.xml or capabilities??

Could you please try this and let me know what happens?

  1. Start two different appium servers manually with ports 4723 and 5733.
  2. Comment out server.appiumStart from your AppiumRemoteDriverConfig1 and execute your test.

Let me know what happens?

Hi vimalraj

i tried as per ur seggesion (manually started appium servers with different ports) eventhough the same problem am facing…please give me any suggesion if possible…Thank you.

Appium server 1 : 127.0.0.1:4723 ,created session id : 13c2fc50-6679-4685-b921-59d0c95effbd

in this session test method executing two times (button_capture.click)…
element
below the log of server 1

info: [debug] Responding to client with success: {“status”:0,“value”:null,“sessionId”:“13c2fc50-6679-4685-b921-59d0c95effbd”}

info: ← POST /wd/hub/session/13c2fc50-6679-4685-b921-59d0c95effbd/timeouts 200 0.737 ms - 76 {“status”:0,“value”:null,“sessionId”:“13c2fc50-6679-4685-b921-59d0c95effbd”}
info: → POST /wd/hub/session/13c2fc50-6679-4685-b921-59d0c95effbd/element {“using":“id”,“value”:"org.amazon.inforMain:id/button_capture”}
info: [debug] Waiting up to 6000ms for condition
info: [debug] Pushing command to appium work queue: [“find”,{“strategy”:“id”,“selector”:“org.amazon.inforMain:id/button_capture”,“context”:“”,“multiple”:false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“find”,“params”:{“strategy”:“id”,“selector”:“org.amazon.inforMain:id/button_capture”,“context”:“”,“multiple”:false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: find
info: [debug] [BOOTSTRAP] [debug] Finding org.amazon.inforMain:id/button_capture using ID with the contextId: multiple: false
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=org.amazon.inforMain:id/button_capture]
info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:{“ELEMENT”:“1”},“status”:0}
info: [debug] Responding to client with success: {“status”:0,“value”:{“ELEMENT”:“1”},“sessionId”:“13c2fc50-6679-4685-b921-59d0c95effbd”}
info: ← POST /wd/hub/session/13c2fc50-6679-4685-b921-59d0c95effbd/element 200 23.475 ms - 87 {“status”:0,“value”:{“ELEMENT”:“1”},“sessionId”:“13c2fc50-6679-4685-b921-59d0c95effbd”}
info: → POST /wd/hub/session/13c2fc50-6679-4685-b921-59d0c95effbd/element/1/click {“id”:“1”}
info: [debug] Pushing command to appium work queue: [“element:click”,{“elementId”:“1”}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“element:click”,“params”:{“elementId”:“1”}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: click
info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:true,“status”:0}
info: [debug] Responding to client with success: {“status”:0,“value”:true,“sessionId”:“13c2fc50-6679-4685-b921-59d0c95effbd”}
info: ← POST /wd/hub/session/13c2fc50-6679-4685-b921-59d0c95effbd/element/1/click 200 236.215 ms - 76 {“status”:0,“value”:true,“sessionId”:“13c2fc50-6679-4685-b921-59d0c95effbd”}
info: → POST /wd/hub/session/13c2fc50-6679-4685-b921-59d0c95effbd/element {“using":“id”,“value”:"org.amazon.inforMain:id/button_capture”}
info: [debug] Waiting up to 6000ms for condition
info: [debug] Pushing command to appium work queue: [“find”,{“strategy”:“id”,“selector”:“org.amazon.inforMain:id/button_capture”,“context”:“”,“multiple”:false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“find”,“params”:{“strategy”:“id”,“selector”:“org.amazon.inforMain:id/button_capture”,“context”:“”,“multiple”:false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: find
info: [debug] [BOOTSTRAP] [debug] Finding org.amazon.inforMain:id/button_capture using ID with the contextId: multiple: false
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=org.amazon.inforMain:id/button_capture]
info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:{“ELEMENT”:“2”},“status”:0}
info: [debug] Responding to client with success: {“status”:0,“value”:{“ELEMENT”:“2”},“sessionId”:“13c2fc50-6679-4685-b921-59d0c95effbd”}
info: ← POST /wd/hub/session/13c2fc50-6679-4685-b921-59d0c95effbd/element 200 560.087 ms - 87 {“status”:0,“value”:{“ELEMENT”:“2”},“sessionId”:“13c2fc50-6679-4685-b921-59d0c95effbd”}
info: → POST /wd/hub/session/13c2fc50-6679-4685-b921-59d0c95effbd/element/2/click {“id”:“2”}
info: [debug] Pushing command to appium work queue: [“element:click”,{“elementId”:“2”}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“element:click”,“params”:{“elementId”:“2”}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: click
info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:true,“status”:0}
info: [debug] Responding to client with success: {“status”:0,“value”:true,“sessionId”:“13c2fc50-6679-4685-b921-59d0c95effbd”}
info: ← POST /wd/hub/session/13c2fc50-6679-4685-b921-59d0c95effbd/element/2/click 200 810.775 ms - 76 {“status”:0,“value”:true,“sessionId”:“13c2fc50-6679-4685-b921-59d0c95effbd”}}bd"}-b921-59d0c95effbd"}`

Appium server 2 : 127.0.0.1:5733 ,created session id : d30d106a-bbb3-4fea-8853-3fa4bdb5d516

below the log of server 2:

info: [debug] Setting command timeout to 480 secs
info: [debug] Appium session started with sessionId ddf71ef5-ad55-47e1-a77f-9615b7c1dc19
info: ← POST /wd/hub/session 303 6216.381 ms - 74
info: → GET /wd/hub/session/ddf71ef5-ad55-47e1-a77f-9615b7c1dc19 {}
info: [debug] Responding to client with success: {“status”:0,“value”:{“platform”:“LINUX”,“browserName”:“”,“platformVersion”:“4.4.4”,“webStorageEnabled”:false,“takesScreenshot”:true,“javascriptEnabled”:true,“databaseEnabled”:false,“networkConnectionEnabled”:true,“locationContextEnabled”:false,“warnings”:{},“desired”:{“appPackage”:“org.amazon.inforMain”,“appActivity”:“org.amazon.inforMain.DiagMain”,“newCommandTimeout”:480,“platformVersion”:“4.4.4”,“browserName”:“”,“platformName”:“Android”,“udid”:“3a78c21e”,“deviceName”:“Vodafone Smart Tab 4G”},“appPackage”:“org.amazon.inforMain”,“appActivity”:“org.amazon.inforMain.DiagMain”,“newCommandTimeout”:480,“platformName”:“Android”,“udid”:“3a78c21e”,“deviceName”:“3a78c21e”},“sessionId”:“ddf71ef5-ad55-47e1-a77f-9615b7c1dc19”}
info: ← GET /wd/hub/session/ddf71ef5-ad55-47e1-a77f-9615b7c1dc19 200 0.639 ms - 724 {“status”:0,“value”:{“platform”:“LINUX”,“browserName”:“”,“platformVersion”:“4.4.4”,“webStorageEnabled”:false,“takesScreenshot”:true,“javascriptEnabled”:true,“databaseEnabled”:false,“networkConnectionEnabled”:true,“locationContextEnabled”:false,“warnings”:{},“desired”:{“appPackage”:“org.amazon.inforMain”,“appActivity”:“org.amazon.inforMain.DiagMain”,“newCommandTimeout”:480,“platformVersion”:“4.4.4”,“browserName”:“”,“platformName”:“Android”,“udid”:“3a78c21e”,“deviceName”:“Vodafone Smart Tab 4G”},“appPackage”:“org.amazon.inforMain”,“appActivity”:“org.amazon.inforMain.DiagMain”,“newCommandTimeout”:480,“platformName”:“Android”,“udid”:“3a78c21e”,“deviceName”:“3a78c21e”},“sessionId”:“ddf71ef5-ad55-47e1-a77f-9615b7c1dc19”}
info: → POST /wd/hub/session/ddf71ef5-ad55-47e1-a77f-9615b7c1dc19/timeouts {“type”:“implicit”,“ms”:6000}
info: [debug] Set Android implicit wait to 6000ms
info: [debug] Responding to client with success: {“status”:0,“value”:null,“sessionId”:“ddf71ef5-ad55-47e1-a77f-9615b7c1dc19”}
info: ← POST /wd/hub/session/ddf71ef5-ad55-47e1-a77f-9615b7c1dc19/timeouts 200 0.974 ms - 76 {“status”:0,“value”:null,“sessionId”:“ddf71ef5-ad55-47e1-a77f-9615b7c1dc19”}
info: [debug] Didn’t get a new command in 480 secs, shutting down…
info: Shutting down appium session
info: [debug] Pressing the HOME button
info: [debug] executing cmd: C:\DMServer\Tools\platform-tools\adb.exe -s 3a78c21e 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=UiAutomatorTestRunner
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 0
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [debug] [UIAUTOMATOR STDOUT] Test results for WatcherResultPrinter=.
info: [debug] [UIAUTOMATOR STDOUT] Time: 483.635
info: [debug] [UIAUTOMATOR STDOUT] OK (1 test)
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: -1
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] We shut down because no new commands came in

  1. why commands are unable to execute in server 2 eventhough sufficient time has given ?

Note : as i understood two test threads are executing under one session id…

Can u try this piece of code… I am able to run two appium server instance using this one & have automated parallel running of two device for chat application.

public static void startServer() {
CommandLine command = new CommandLine(“cmd”);
System.out.println("-----Starting Appium Server-----");
command.addArgument("/c");
command.addArgument(“E:/Automation_Setup/Appium/node.exe”);
command.addArgument(“E:/Automation_Setup/Appium/node_modules/appium/bin/Appium.js”);
command.addArgument("–address");
command.addArgument(“127.0.0.1”);
command.addArgument("–port");
command.addArgument(“4723”);
command.addArgument("–no-reset");
command.addArgument("–log");
command.addArgument(“E:/appiumLogs.txt”);
DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler();
DefaultExecutor executor = new DefaultExecutor();
executor.setExitValue(1);
try {
executor.execute(command, resultHandler);
Thread.sleep(5000);
System.out.println("-----Appium Server started Successfully-----");
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}

1 Like

Thank you Priyank_Shah…i got the answer in your question.

Thank you all for ur time and patience…solved the issue its working now…

@naveen.auvusali How did you resolved the issue. I am also getting the same issue as script is running on one mobile only

All you need to do is adding boostrap port when you are setting Appium server(instance).