Can't execute tests in Parallel with Testng


#1

When I try to execute tests in parallel for two devices, Tests run good only for one device, on another only opens an app. When tests on first device are finished, second device is crashing with

 org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. 
 Original error: Could not proxy command to remote server. Original error: Error: socket hang up

I’m starting two appium servers
appium --address 127.0.0.1 --port 8220
appium --address 127.0.0.1 --port 8250

But in logs i recognize another ports or maybe i;m wrong and two emulators starts to use it.

First Server
[debug] [ADB] The installed 'io.appium.unlock' package does not require upgrade ('2.0.0' >= '2.0.0')
[debug] [UiAutomator2] Forwarding UiAutomator2 Server port 6790 to 8200
[debug] [ADB] Forwarding system: 8200 to device: 6790
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5556 forward tcp\:8200 tcp\:6790'

Second Server
[debug] [ADB] The installed 'io.appium.unlock' package does not require upgrade ('2.0.0' >= '2.0.0')
[debug] [UiAutomator2] Forwarding UiAutomator2 Server port 6790 to 8200
[debug] [ADB] Forwarding system: 8200 to device: 6790
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 forward tcp\:8200 tcp\:6790'

To reproduce this issue I’m sharing my code.

This is my TestNg.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Default Suite" verbose="1" parallel="tests">

<test name="Nexus 5X">
    <parameter name="platformName" value="Android"/>
    <parameter name="deviceName" value="Nexus5X"/>
    <parameter name="platformVersion" value="5.1.1"/>
    <parameter name="appPackage" value="co.android"/>
    <parameter name="automationName" value="uiautomator2"/>
    <parameter name="appActivity" value="co.android.splash.GCSplashActivity"/>
    <parameter name="systemPort" value="8220"/>
    <parameter name="udid" value="emulator-5554"/>
    <parameter name="ServerURL" value="http://127.0.0.1:8220/wd/hub"/>

    <classes>
        <class name="Tests.VerifyOnboarding"/>
    </classes>
</test>

<test name="PixelApi24">
    <parameter name="deviceQuery" value="Android"/>
    <parameter name="platformName" value="Android"/>
    <parameter name="deviceName" value="PixelApi24"/>
    <parameter name="platformVersion" value="7.0"/>
    <parameter name="appPackage" value="co.android"/>
    <parameter name="automationName" value="uiautomator2"/>
    <parameter name="appActivity" value="co.android.splash.GCSplashActivity"/>
    <parameter name="udid" value="emulator-5556"/>
    <parameter name="systemPort" value="8250"/>
    <parameter name="ServerURL" value="http://127.0.0.1:8250/wd/hub"/>

    <classes>
        <class name="Tests.VerifyOnboarding"/>
    </classes>
</test>

Base Setup class where I initialize driver.

public class BaseSetup {

private AppiumDriver driver = null;

public AppiumDriver getDriver() {return this.driver;}


@Parameters({"platformName", "deviceName", "platformVersion", "appPackage", "automationName", "appActivity", "ServerURL"})

@BeforeMethod(alwaysRun = true)
public void setUp
        (
                String platformName,
                String deviceName,
                String platformVersion,
                String appPackage,
                String automationName,
                String appActivity,
                String serverUrl
        )
        throws Exception {
    String resourcesPath = new File("src/passwordCheck/resources").getAbsolutePath();

    if (platformName.equals("Android")) {
        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability("platformName", platformName);
        capabilities.setCapability("deviceName", deviceName);
        capabilities.setCapability("platformVersion", platformVersion);
        capabilities.setCapability("appPackage", appPackage);
        capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, automationName);
        capabilities.setCapability("appActivity", appActivity);

        driver = new AndroidDriver(new URL(serverUrl), capabilities);
    }
}

@AfterMethod
public void tearDown() {
    driver.quit();
}

}

Abstract Screen class. Basic class for Pages

public abstract class AbstractScreen{

    protected AppiumDriver driver;


    public AbstractScreen(AppiumDriver driver) {
        this.driver = driver;
        PageFactory.initElements(new AppiumFieldDecorator(driver, 3, TimeUnit.SECONDS), this);
    }



    public void type(MobileElement element, String text){
        element.clear();
        element.sendKeys(text);
    }

    public void click(MobileElement element){
        element.click();
    }

    public static boolean isElementPresent(MobileElement element) {
        try {
            element.isDisplayed();
            return true;
        } catch (org.openqa.selenium.NoSuchElementException e) {
            return false;
        }
    }
}

Two Screen Classes

public class OnboardingScreen extends AbstractScreen {

    public OnboardingScreen(AppiumDriver driver){
        super(driver);
        PageFactory.initElements(new AppiumFieldDecorator(driver, 3, TimeUnit.SECONDS), this);

    }

    @AndroidFindBy(id = "co.good.teamwork.android:id/btnSignUp")
    public MobileElement signUpBtn;

    public SignUpScreen openSignUpScreen(){
        signUpBtn.click();
        return new SignUpScreen(driver);
    }
}

public class SignUpScreen extends AbstractScreen{



    public SignUpScreen(AppiumDriver driver) {
        super(driver);
        PageFactory.initElements(new AppiumFieldDecorator(driver, 3, TimeUnit.SECONDS), this);
    }

    @AndroidFindBy(xpath = "(//android.widget.LinearLayout/android.widget.TextView)[1]")
    public MobileElement signUpStepLabel;

}

Test which I’m executing

public class VerifyOnboarding extends BaseSetup {



@Test
public void buildTeamTutorial() throws InterruptedException {

    Thread.sleep(10000);

    SignUpScreen signUpScreen = new OnboardingScreen(getDriver()).openSignUpScreen();
    Assert.assertTrue(isElementPresent(signUpScreen.signUpStepLabel), "SignUp screen doesn't open");


}

}

Full Logs from first server

enysvoskovets$ appium --address 127.0.0.1 --port 8220
[Appium] Welcome to Appium v1.8.1
[Appium] Non-default server args:
[Appium]   address: 127.0.0.1
[Appium]   port: 8220
[Appium] Appium REST http interface listener started on 127.0.0.1:8220
[HTTP] --> POST /wd/hub/session
[HTTP] {"capabilities":{"desiredCapabilities":{"appPackage":"co.android","appActivity":"co.android.splash.GCSplashActivity","platformVersion":"5.1.1","automationName":"uiautomator2","platformName":"Android","deviceName":"Nexus5X"},"requiredCapabilities":{}},"desiredCapabilities":{"appPackage":"co.good.teamwork.android","appActivity":"co.good.teamwork.android.splash.GCSplashActivity","platformVersion":"5.1.1","automationName":"uiautomator2","platformName":"Android","deviceName":"Nexus5X"},"requiredCapabilities":{}}
[debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [{"appPackage":"co.android","appActivity":"co.android.splash.GCSplashActivity","platformVersion":"5.1.1","automationName":"uiautomator2","platformName":"Android","deviceName":"Nexus5X"},{},{"desiredCapabilities":{"appPackage":"co.good.teamwork.android","appActivity":"co.good.teamwork.android.splash.GCSplashActivity","platformVersion":"5.1.1","automationName":"uiautomator2","platformName":"Android","deviceName":"Nexus5X"},"requiredCapabilities":{}}]
[debug] [BaseDriver] Event 'newSessionRequested' logged at 1533737077365 (17:04:37 GMT+0300 (EEST))
[Appium] Could not parse W3C capabilities: 'platformName' can't be blank; 'deviceName' can't be blank. Falling back to JSONWP protocol.
[Appium] The following capabilities were provided in the JSONWP desired capabilities that are missing in W3C capabilities: ["appPackage","appActivity","platformVersion","automationName","platformName","deviceName"]. Falling back to JSONWP protocol.
[Appium] Creating new AndroidUiautomator2Driver (v1.12.0) session
[Appium] Capabilities:
[Appium]   appPackage: co.android
[Appium]   appActivity: co.android.splash.GCSplashActivity
[Appium]   platformVersion: 5.1.1
[Appium]   automationName: uiautomator2
[Appium]   platformName: Android
[Appium]   deviceName: Nexus5X
[debug] [BaseDriver] Creating session with MJSONWP desired capabilities: {"appPackage":"co.good.team...
[BaseDriver] Session created with session id: a88a45c9-d50a-4ccb-b633-ad0af1a0c3bb
[debug] [AndroidDriver] Getting Java version
[AndroidDriver] Java version is: 1.8.0_144
[ADB] Checking whether adb is present
[ADB] Found 1 'build-tools' folders under '/Users/denysvoskovets/Library/Android/sdk' (newest first):
[ADB]     /Users/denysvoskovets/Library/Android/sdk/build-tools/26.0.1
[ADB] Using adb from /Users/denysvoskovets/Library/Android/sdk/platform-tools/adb
[AndroidDriver] Retrieving device list
[debug] [ADB] Trying to find a connected android device
[debug] [ADB] Getting connected devices...
[debug] [ADB] 2 device(s) connected
[AndroidDriver] Looking for a device with Android '5.1.1'
[debug] [ADB] Setting device id to emulator-5556
[ADB] Getting device platform version
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5556 shell getprop ro.build.version.release'
[debug] [ADB] Current device property 'ro.build.version.release': 7.0
[debug] [ADB] Setting device id to emulator-5554
[ADB] Getting device platform version
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell getprop ro.build.version.release'
[debug] [ADB] Current device property 'ro.build.version.release': 5.1.1
[AndroidDriver] Using device: emulator-5554
[debug] [ADB] Setting device id to emulator-5554
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell getprop ro.build.version.sdk'
[debug] [ADB] Current device property 'ro.build.version.sdk': 22
[debug] [ADB] Device API level: 22
[AndroidDriver] No app sent in, not parsing package/activity
[ADB] Getting device platform version
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell getprop ro.build.version.release'
[debug] [ADB] Current device property 'ro.build.version.release': 5.1.1
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell wm size'
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell wm density'
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell getprop ro.product.model'
[debug] [ADB] Current device property 'ro.product.model': Android SDK built for x86
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell getprop ro.product.manufacturer'
[debug] [ADB] Current device property 'ro.product.manufacturer': unknown
[debug] [ADB] Device API level: 22
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell am force-stop io.appium.uiautomator2.server'
[debug] [ADB] Checking app cert for /usr/local/lib/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-v1.12.0.apk
[ADB] Using apksigner from /Users/denysvoskovets/Library/Android/sdk/build-tools/26.0.1/apksigner
[debug] [ADB] Starting '/Users/denysvoskovets/Library/Android/sdk/build-tools/26.0.1/apksigner' with args 'verify,--print-certs,/usr/local/lib/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-v1.12.0.apk'
[debug] [ADB] '/usr/local/lib/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-v1.12.0.apk' is already signed.
[debug] [ADB] Checking app cert for /usr/local/lib/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk
[debug] [ADB] Starting '/Users/denysvoskovets/Library/Android/sdk/build-tools/26.0.1/apksigner' with args 'verify,--print-certs,/usr/local/lib/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk'
[debug] [ADB] '/usr/local/lib/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk' is already signed.
[debug] [ADB] Getting install status for io.appium.uiautomator2.server
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell pm list packages io.appium.uiautomator2.server'
[debug] [ADB] App is installed
[debug] [ADB] Getting package info for 'io.appium.uiautomator2.server'
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell dumpsys package io.appium.uiautomator2.server'
[ADB] Checking whether aapt is present
[ADB] Using aapt from /Users/denysvoskovets/Library/Android/sdk/build-tools/26.0.1/aapt
[debug] [ADB] The installed 'io.appium.uiautomator2.server' package does not require upgrade ('1.12.0' >= '1.12.0')
[debug] [ADB] Getting install status for io.appium.uiautomator2.server.test
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell pm list packages io.appium.uiautomator2.server.test'
[debug] [ADB] App is installed
[debug] [ADB] Getting package info for 'io.appium.uiautomator2.server.test'
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell dumpsys package io.appium.uiautomator2.server.test'
[ADB] Cannot read version codes of '/usr/local/lib/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk' and/or 'io.appium.uiautomator2.server.test'
[ADB] Cannot read version names of '/usr/local/lib/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk' and/or 'io.appium.uiautomator2.server.test'. Assuming correct app version is already installed
[debug] [UiAutomator2] Waiting up to 20000ms for instrumentation 'io.appium.uiautomator2.server.test/android.support.test.runner.AndroidJUnitRunner' to be available
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell pm list instrumentation'
[debug] [UiAutomator2] Instrumentation 'io.appium.uiautomator2.server.test/android.support.test.runner.AndroidJUnitRunner' available
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 wait-for-device'
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell echo ping'
[debug] [AndroidDriver] Pushing settings apk to device...
[debug] [ADB] Getting install status for io.appium.settings
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell pm list packages io.appium.settings'
[debug] [ADB] App is installed
[debug] [ADB] Getting package info for 'io.appium.settings'
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell dumpsys package io.appium.settings'
[debug] [ADB] The installed 'io.appium.settings' package does not require upgrade ('2.3.0' >= '2.3.0')
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell ps'
[debug] [AndroidDriver] io.appium.settings is already running. There is no need to reset its permissions.
[debug] [ADB] Device API level: 22
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell settings put secure mock_location 1'
[AndroidDriver] setDeviceLanguageCountry requires language or country.
[AndroidDriver] Got language: 'null' and country: 'null'
[debug] [Logcat] Starting logcat capture
[debug] [AndroidDriver] Pushing unlock helper app to device...
[debug] [ADB] Getting install status for io.appium.unlock
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell pm list packages io.appium.unlock'
[debug] [ADB] App is installed
[debug] [ADB] Getting package info for 'io.appium.unlock'
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell dumpsys package io.appium.unlock'
[debug] [ADB] The installed 'io.appium.unlock' package does not require upgrade ('2.0.0' >= '2.0.0')
[debug] [UiAutomator2] Forwarding UiAutomator2 Server port 6790 to 8200
[debug] [ADB] Forwarding system: 8200 to device: 6790
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 forward tcp\:8200 tcp\:6790'
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell rm -rf /data/local/tmp/strings.json'
[debug] [UiAutomator2] No app capability. Assuming it is already on the device
[debug] [ADB] Getting install status for co.good.teamwork.android
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell pm list packages co.good.teamwork.android'
[debug] [ADB] App is installed
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell am force-stop co.good.teamwork.android'
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell pm clear co.good.teamwork.android'
[debug] [AndroidDriver] Performed fast reset on the installed 'co.good.teamwork.android' application (stop and clear)
[debug] [ADB] Checking app cert for null
[debug] [ADB] 'null' doesn't exist
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell am force-stop io.appium.uiautomator2.server'
[UiAutomator2] Starting uiautomator2 server 1.12.0
[UiAutomator2] Using UIAutomator2 server from '/usr/local/lib/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-v1.12.0.apk' and test from '/usr/local/lib/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk'
[UiAutomator2] Running command: 'adb -s emulator-5554 shell am instrument -w io.appium.uiautomator2.server.test/android.support.test.runner.AndroidJUnitRunner'
[UiAutomator2] Waiting up to 20000ms for UiAutomator2 to be online...
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[debug] [JSONWP Proxy] Got response with status 200: "{\"sessionId\":\"SESSIONID\",\"status\":0,\"value\":\"Status Invoked\"}"
[debug] [JSONWP Proxy] Proxying [POST /session] to [POST http://localhost:8200/wd/hub/session] with body: {"desiredCapabilities":{"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"appPackage":"co.good.teamwork.android","appActivity":"co.good.teamwork.android.splash.GCSplashActivity","platformVersion":"5.1.1","automationName":"uiautomator2","platformName":"Android","deviceName":"Nexus5X"},"appPackage":"co.good.teamwork.android","appActivity":"co.good.teamwork.android.splash.GCSplashActivity","platformVersion":"5.1.1","automationName":"uiautomator2","platformName":"Android","deviceName":"emulator-5554","deviceUDID":"emulator-5554","deviceScreenSize":"1080x1920","deviceScreenDensity":420,"deviceModel":"Android SDK built for x86","deviceManufacturer":"unknown","deviceApiLevel":22}}
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"c97ca1f1-1a57-4234-92e2-536644a31bbd","status":0,"value":"Created Session"}
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell dumpsys window'
[AndroidDriver] Screen already unlocked, doing nothing
[UiAutomator2] UiAutomator2 did not start the activity we were waiting for, 'co.good.teamwork.android/co.good.teamwork.android.splash.GCSplashActivity'. Starting it ourselves
[debug] [ADB] Device API level: 22
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell am start -W -n co.good.teamwork.android/co.good.teamwork.android.splash.GCSplashActivity -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000'
[debug] [JSONWP Proxy] Proxying [GET /appium/device/pixel_ratio] to [GET http://localhost:8200/wd/hub/session/c97ca1f1-1a57-4234-92e2-536644a31bbd/appium/device/pixel_ratio] with body: {}
[debug] [JSONWP Proxy] Got response with status 200: "{\"sessionId\":\"c97ca1f1-1a57-4234-92e2-536644a31bbd\",\"status\":0,\"value\":3}"
[debug] [JSONWP Proxy] Proxying [GET /appium/device/system_bars] to [GET http://localhost:8200/wd/hub/session/c97ca1f1-1a57-4234-92e2-536644a31bbd/appium/device/system_bars] with body: {}
[debug] [JSONWP Proxy] Got response with status 200: "{\"sessionId\":\"c97ca1f1-1a57-4234-92e2-536644a31bbd\",\"status\":0,\"value\":{\"statusBar\":72}}"
[debug] [JSONWP Proxy] Proxying [GET /window/current/size] to [GET http://localhost:8200/wd/hub/session/c97ca1f1-1a57-4234-92e2-536644a31bbd/window/current/size] with body: {}
[debug] [JSONWP Proxy] Got response with status 200: "{\"sessionId\":\"c97ca1f1-1a57-4234-92e2-536644a31bbd\",\"status\":0,\"value\":{\"height\":1776,\"width\":1080}}"
[Appium] New AndroidUiautomator2Driver session created successfully, session a88a45c9-d50a-4ccb-b633-ad0af1a0c3bb added to master session list
[debug] [BaseDriver] Event 'newSessionStarted' logged at 1533737089517 (17:04:49 GMT+0300 (EEST))
[debug] [MJSONWP] Responding to client with driver.createSession() result: {"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"appPackage":"co.good.teamwork.android","appActivity":"co.good.teamwork.android.splash.GCSplashActivity","platformVersion":"5.1.1","automationName":"uiautomator2","platformName":"Android","deviceName":"Nexus5X"},"appPackage":"co.good.teamwork.android","appActivity":"co.good.teamwork.android.splash.GCSplashActivity","platformVersion":"5.1.1","automationName":"uiautomator2","platformName":"Android","deviceName":"emulator-5554","deviceUDID":"emulator-5554","deviceScreenSize":"1080x1920","deviceScreenDensity":420,"deviceModel":"Android SDK built for x86","deviceManufacturer":"unknown","deviceApiLevel":22,"pixelRatio":3,"statBarHeight":72,"viewportRect":{"left":0,"top":72,"width":1080,"height":1704}}
[HTTP] <-- POST /wd/hub/session 200 12181 ms - 982
[HTTP] 
[HTTP] --> POST /wd/hub/session/a88a45c9-d50a-4ccb-b633-ad0af1a0c3bb/timeouts
[HTTP] {"type":"implicit","ms":0}
[debug] [W3C] Bad parameters: BadParametersError: Parameters were incorrect. We wanted "W3C protocol expects any of script, pageLoad or implicit to be set" and you sent {"type":"implicit","ms":0}
[HTTP] <-- POST /wd/hub/session/a88a45c9-d50a-4ccb-b633-ad0af1a0c3bb/timeouts 400 32 ms - 4284
[HTTP] 
[HTTP] --> GET /wd/hub/session/a88a45c9-d50a-4ccb-b633-ad0af1a0c3bb/context
[HTTP] {}
[debug] [W3C] Calling AppiumDriver.getCurrentContext() with args: ["a88a45c9-d50a-4ccb-b633-ad0af1a0c3bb"]
[debug] [MJSONWP] Responding to client with driver.getCurrentContext() result: "NATIVE_APP"
[HTTP] <-- GET /wd/hub/session/a88a45c9-d50a-4ccb-b633-ad0af1a0c3bb/context 200 12 ms - 84
[HTTP] 
[HTTP] --> POST /wd/hub/session/a88a45c9-d50a-4ccb-b633-ad0af1a0c3bb/elements
[HTTP] {"using":"id","value":"co.good.teamwork.android:id/btnSignUp"}
[debug] [W3C] Calling AppiumDriver.findElements() with args: ["id","co.good.teamwork.android:id/btnSignUp","a88a45c9-d50a-4ccb-b633-ad0af1a0c3bb"]
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [BaseDriver] Waiting up to 0 ms for condition
[debug] [JSONWP Proxy] Proxying [POST /elements] to [POST http://localhost:8200/wd/hub/session/c97ca1f1-1a57-4234-92e2-536644a31bbd/elements] with body: {"strategy":"id","selector":"co.good.teamwork.android:id/btnSignUp","context":"","multiple":true}
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"c97ca1f1-1a57-4234-92e2-536644a31bbd","status":0,"value":[{"ELEMENT":"29aebe33-3a0a-4ed5-9531-75027d21d48d"}]}
[debug] [MJSONWP] Responding to client with driver.findElements() result: [{"ELEMENT":"29aebe33-3a0a-4ed5-9531-75027d21d48d"}]
[HTTP] <-- POST /wd/hub/session/a88a45c9-d50a-4ccb-b633-ad0af1a0c3bb/elements 200 26 ms - 124
[HTTP] 
[HTTP] --> POST /wd/hub/session/a88a45c9-d50a-4ccb-b633-ad0af1a0c3bb/timeouts
[HTTP] {"type":"implicit","ms":3000}
[debug] [W3C] Bad parameters: BadParametersError: Parameters were incorrect. We wanted "W3C protocol expects any of script, pageLoad or implicit to be set" and you sent {"type":"implicit","ms":3000}
[HTTP] <-- POST /wd/hub/session/a88a45c9-d50a-4ccb-b633-ad0af1a0c3bb/timeouts 400 3 ms - 4290
[HTTP] 
[HTTP] --> POST /wd/hub/session/a88a45c9-d50a-4ccb-b633-ad0af1a0c3bb/element/29aebe33-3a0a-4ed5-9531-75027d21d48d/click
[HTTP] {"id":"29aebe33-3a0a-4ed5-9531-75027d21d48d"}
[debug] [W3C] Calling AppiumDriver.click() with args: ["29aebe33-3a0a-4ed5-9531-75027d21d48d","a88a45c9-d50a-4ccb-b633-ad0af1a0c3bb"]
[debug] [JSONWP Proxy] Proxying [POST /element/29aebe33-3a0a-4ed5-9531-75027d21d48d/click] to [POST http://localhost:8200/wd/hub/session/c97ca1f1-1a57-4234-92e2-536644a31bbd/element/29aebe33-3a0a-4ed5-9531-75027d21d48d/click] with body: {"element":"29aebe33-3a0a-4ed5-9531-75027d21d48d"}
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"c97ca1f1-1a57-4234-92e2-536644a31bbd","status":0,"value":true}
[debug] [MJSONWP] Responding to client with driver.click() result: true
[HTTP] <-- POST /wd/hub/session/a88a45c9-d50a-4ccb-b633-ad0af1a0c3bb/element/29aebe33-3a0a-4ed5-9531-75027d21d48d/click 200 23 ms - 76
[HTTP] 
[HTTP] --> POST /wd/hub/session/a88a45c9-d50a-4ccb-b633-ad0af1a0c3bb/timeouts
[HTTP] {"type":"implicit","ms":0}
[debug] [W3C] Bad parameters: BadParametersError: Parameters were incorrect. We wanted "W3C protocol expects any of script, pageLoad or implicit to be set" and you sent {"type":"implicit","ms":0}
[HTTP] <-- POST /wd/hub/session/a88a45c9-d50a-4ccb-b633-ad0af1a0c3bb/timeouts 400 3 ms - 4284
[HTTP] 
[HTTP] --> GET /wd/hub/session/a88a45c9-d50a-4ccb-b633-ad0af1a0c3bb/context
[HTTP] {}
[debug] [W3C] Calling AppiumDriver.getCurrentContext() with args: ["a88a45c9-d50a-4ccb-b633-ad0af1a0c3bb"]
[debug] [MJSONWP] Responding to client with driver.getCurrentContext() result: "NATIVE_APP"
[HTTP] <-- GET /wd/hub/session/a88a45c9-d50a-4ccb-b633-ad0af1a0c3bb/context 200 3 ms - 84
[HTTP] 
[HTTP] --> POST /wd/hub/session/a88a45c9-d50a-4ccb-b633-ad0af1a0c3bb/elements
[HTTP] {"using":"xpath","value":"(//android.widget.LinearLayout/android.widget.TextView)[1]"}
[debug] [W3C] Calling AppiumDriver.findElements() with args: ["xpath","(//android.widget.LinearLayout/android.widget.TextView)[1]","a88a45c9-d50a-4ccb-b633-ad0af1a0c3bb"]
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [BaseDriver] Waiting up to 0 ms for condition
[debug] [JSONWP Proxy] Proxying [POST /elements] to [POST http://localhost:8200/wd/hub/session/c97ca1f1-1a57-4234-92e2-536644a31bbd/elements] with body: {"strategy":"xpath","selector":"(//android.widget.LinearLayout/android.widget.TextView)[1]","context":"","multiple":true}
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"c97ca1f1-1a57-4234-92e2-536644a31bbd","status":0,"value":[{"ELEMENT":"4be4872e-c61f-4c6c-b107-a72b888e07b9"}]}
[debug] [MJSONWP] Responding to client with driver.findElements() result: [{"ELEMENT":"4be4872e-c61f-4c6c-b107-a72b888e07b9"}]
[HTTP] <-- POST /wd/hub/session/a88a45c9-d50a-4ccb-b633-ad0af1a0c3bb/elements 200 506 ms - 124
[HTTP] 
[HTTP] --> POST /wd/hub/session/a88a45c9-d50a-4ccb-b633-ad0af1a0c3bb/timeouts
[HTTP] {"type":"implicit","ms":3000}
[debug] [W3C] Bad parameters: BadParametersError: Parameters were incorrect. We wanted "W3C protocol expects any of script, pageLoad or implicit to be set" and you sent {"type":"implicit","ms":3000}
[HTTP] <-- POST /wd/hub/session/a88a45c9-d50a-4ccb-b633-ad0af1a0c3bb/timeouts 400 6 ms - 4290
[HTTP] 
[HTTP] --> GET /wd/hub/session/a88a45c9-d50a-4ccb-b633-ad0af1a0c3bb/element/4be4872e-c61f-4c6c-b107-a72b888e07b9/displayed
[HTTP] {}
[debug] [W3C] Calling AppiumDriver.elementDisplayed() with args: ["4be4872e-c61f-4c6c-b107-a72b888e07b9","a88a45c9-d50a-4ccb-b633-ad0af1a0c3bb"]
[debug] [JSONWP Proxy] Proxying [GET /element/4be4872e-c61f-4c6c-b107-a72b888e07b9/attribute/displayed] to [GET http://localhost:8200/wd/hub/session/c97ca1f1-1a57-4234-92e2-536644a31bbd/element/4be4872e-c61f-4c6c-b107-a72b888e07b9/attribute/displayed] with body: {}
[debug] [JSONWP Proxy] Got response with status 200: "{\"sessionId\":\"c97ca1f1-1a57-4234-92e2-536644a31bbd\",\"status\":0,\"value\":\"true\"}"
[debug] [MJSONWP] Responding to client with driver.elementDisplayed() result: true
[HTTP] <-- GET /wd/hub/session/a88a45c9-d50a-4ccb-b633-ad0af1a0c3bb/element/4be4872e-c61f-4c6c-b107-a72b888e07b9/displayed 200 384 ms - 76
[HTTP] 
[HTTP] --> DELETE /wd/hub/session/a88a45c9-d50a-4ccb-b633-ad0af1a0c3bb
[HTTP] {}
[debug] [W3C] Calling AppiumDriver.deleteSession() with args: ["a88a45c9-d50a-4ccb-b633-ad0af1a0c3bb"]
[debug] [BaseDriver] Event 'quitSessionRequested' logged at 1533737100982 (17:05:00 GMT+0300 (EEST))
[Appium] Removing session a88a45c9-d50a-4ccb-b633-ad0af1a0c3bb from our master session list
[debug] [UiAutomator2] Deleting UiAutomator2 session
[debug] [UiAutomator2] Deleting UiAutomator2 server session
[debug] [JSONWP Proxy] Proxying [DELETE /] to [DELETE http://localhost:8200/wd/hub/session/c97ca1f1-1a57-4234-92e2-536644a31bbd] with no body
[debug] [JSONWP Proxy] Got response with status 200: "{\"sessionId\":\"c97ca1f1-1a57-4234-92e2-536644a31bbd\",\"status\":0,\"value\":\"Session deleted\"}"
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell am force-stop co.good.teamwork.android'
[debug] [Logcat] Stopping logcat capture
[debug] [ADB] Removing forwarded port socket connection: 8200 
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 forward --remove tcp\:8200'
[debug] [BaseDriver] Event 'quitSessionFinished' logged at 1533737101389 (17:05:01 GMT+0300 (EEST))
[debug] [MJSONWP] Received response: null
[debug] [MJSONWP] But deleting session, so not returning
[debug] [MJSONWP] Responding to client with driver.deleteSession() result: null
[HTTP] <-- DELETE /wd/hub/session/a88a45c9-d50a-4ccb-b633-ad0af1a0c3bb 200 410 ms - 76
[HTTP] 

Full Logs Second server

 denysvoskovets$ appium --address 127.0.0.1 --port 8250
[Appium] Welcome to Appium v1.8.1
[Appium] Non-default server args:
[Appium]   address: 127.0.0.1
[Appium]   port: 8250
[Appium] Appium REST http interface listener started on 127.0.0.1:8250
[HTTP] --> POST /wd/hub/session
[HTTP] {"capabilities":{"desiredCapabilities":{"appPackage":"co.android","appActivity":"co.android.splash.GCSplashActivity","platformVersion":"7.0","automationName":"uiautomator2","platformName":"Android","deviceName":"PixelApi24"},"requiredCapabilities":{}},"desiredCapabilities":{"appPackage":"co.good.teamwork.android","appActivity":"co.good.teamwork.android.splash.GCSplashActivity","platformVersion":"7.0","automationName":"uiautomator2","platformName":"Android","deviceName":"PixelApi24"},"requiredCapabilities":{}}
[debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [{"appPackage":"co.android","appActivity":"co.android.splash.GCSplashActivity","platformVersion":"7.0","automationName":"uiautomator2","platformName":"Android","deviceName":"PixelApi24"},{},{"desiredCapabilities":{"appPackage":"co.good.teamwork.android","appActivity":"co.good.teamwork.android.splash.GCSplashActivity","platformVersion":"7.0","automationName":"uiautomator2","platformName":"Android","deviceName":"PixelApi24"},"requiredCapabilities":{}}]
[debug] [BaseDriver] Event 'newSessionRequested' logged at 1533737077375 (17:04:37 GMT+0300 (EEST))
[Appium] Could not parse W3C capabilities: 'platformName' can't be blank; 'deviceName' can't be blank. Falling back to JSONWP protocol.
[Appium] The following capabilities were provided in the JSONWP desired capabilities that are missing in W3C capabilities: ["appPackage","appActivity","platformVersion","automationName","platformName","deviceName"]. Falling back to JSONWP protocol.
[Appium] Creating new AndroidUiautomator2Driver (v1.12.0) session
[Appium] Capabilities:
[Appium]   appPackage: co.android
[Appium]   appActivity: co.android.splash.GCSplashActivity
[Appium]   platformVersion: 7.0
[Appium]   automationName: uiautomator2
[Appium]   platformName: Android
[Appium]   deviceName: PixelApi24
[debug] [BaseDriver] Creating session with MJSONWP desired capabilities: {"appPackage":"co.good.team...
[BaseDriver] Session created with session id: aea24c76-e040-4374-b4e3-3ec4842839fd
[debug] [AndroidDriver] Getting Java version
[AndroidDriver] Java version is: 1.8.0_144
[ADB] Checking whether adb is present
[ADB] Found 1 'build-tools' folders under '/Users/denysvoskovets/Library/Android/sdk' (newest first):
[ADB]     /Users/denysvoskovets/Library/Android/sdk/build-tools/26.0.1
[ADB] Using adb from /Users/denysvoskovets/Library/Android/sdk/platform-tools/adb
[AndroidDriver] Retrieving device list
[debug] [ADB] Trying to find a connected android device
[debug] [ADB] Getting connected devices...
[debug] [ADB] 2 device(s) connected
[AndroidDriver] Looking for a device with Android '7.0'
[debug] [ADB] Setting device id to emulator-5556
[ADB] Getting device platform version
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5556 shell getprop ro.build.version.release'
[debug] [ADB] Current device property 'ro.build.version.release': 7.0
[AndroidDriver] Using device: emulator-5556
[debug] [ADB] Setting device id to emulator-5556
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5556 shell getprop ro.build.version.sdk'
[debug] [ADB] Current device property 'ro.build.version.sdk': 24
[debug] [ADB] Device API level: 24
[AndroidDriver] No app sent in, not parsing package/activity
[ADB] Getting device platform version
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5556 shell getprop ro.build.version.release'
[debug] [ADB] Current device property 'ro.build.version.release': 7.0
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5556 shell wm size'
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5556 shell wm density'
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5556 shell getprop ro.product.model'
[debug] [ADB] Current device property 'ro.product.model': Android SDK built for x86
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5556 shell getprop ro.product.manufacturer'
[debug] [ADB] Current device property 'ro.product.manufacturer': Google
[debug] [ADB] Device API level: 24
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5556 shell am force-stop io.appium.uiautomator2.server'
[debug] [ADB] Checking app cert for /usr/local/lib/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-v1.12.0.apk
[ADB] Using apksigner from /Users/denysvoskovets/Library/Android/sdk/build-tools/26.0.1/apksigner
[debug] [ADB] Starting '/Users/denysvoskovets/Library/Android/sdk/build-tools/26.0.1/apksigner' with args 'verify,--print-certs,/usr/local/lib/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-v1.12.0.apk'
[debug] [ADB] '/usr/local/lib/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-v1.12.0.apk' is already signed.
[debug] [ADB] Checking app cert for /usr/local/lib/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk
[debug] [ADB] Starting '/Users/denysvoskovets/Library/Android/sdk/build-tools/26.0.1/apksigner' with args 'verify,--print-certs,/usr/local/lib/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk'
[debug] [ADB] '/usr/local/lib/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk' is already signed.
[debug] [ADB] Getting install status for io.appium.uiautomator2.server
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5556 shell pm list packages io.appium.uiautomator2.server'
[debug] [ADB] App is installed
[debug] [ADB] Getting package info for 'io.appium.uiautomator2.server'
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5556 shell dumpsys package io.appium.uiautomator2.server'
[ADB] Checking whether aapt is present
[ADB] Using aapt from /Users/denysvoskovets/Library/Android/sdk/build-tools/26.0.1/aapt
[debug] [ADB] The installed 'io.appium.uiautomator2.server' package does not require upgrade ('1.12.0' >= '1.12.0')
[debug] [ADB] Getting install status for io.appium.uiautomator2.server.test
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5556 shell pm list packages io.appium.uiautomator2.server.test'
[debug] [ADB] App is installed
[debug] [ADB] Getting package info for 'io.appium.uiautomator2.server.test'
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5556 shell dumpsys package io.appium.uiautomator2.server.test'
[ADB] Cannot read version codes of '/usr/local/lib/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk' and/or 'io.appium.uiautomator2.server.test'
[ADB] Cannot read version names of '/usr/local/lib/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk' and/or 'io.appium.uiautomator2.server.test'. Assuming correct app version is already installed
[debug] [UiAutomator2] Waiting up to 20000ms for instrumentation 'io.appium.uiautomator2.server.test/android.support.test.runner.AndroidJUnitRunner' to be available
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5556 shell pm list instrumentation'
[debug] [UiAutomator2] Instrumentation 'io.appium.uiautomator2.server.test/android.support.test.runner.AndroidJUnitRunner' available
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5556 wait-for-device'
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5556 shell echo ping'
[debug] [AndroidDriver] Pushing settings apk to device...
[debug] [ADB] Getting install status for io.appium.settings
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5556 shell pm list packages io.appium.settings'
[debug] [ADB] App is installed
[debug] [ADB] Getting package info for 'io.appium.settings'
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5556 shell dumpsys package io.appium.settings'
[debug] [ADB] The installed 'io.appium.settings' package does not require upgrade ('2.3.0' >= '2.3.0')
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5556 shell ps'
[debug] [AndroidDriver] io.appium.settings is already running. There is no need to reset its permissions.
[debug] [ADB] Device API level: 24
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5556 shell appops set io.appium.settings android\:mock_location allow'
[AndroidDriver] setDeviceLanguageCountry requires language or country.
[AndroidDriver] Got language: 'null' and country: 'null'
[debug] [Logcat] Starting logcat capture
[debug] [AndroidDriver] Pushing unlock helper app to device...
[debug] [ADB] Getting install status for io.appium.unlock
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5556 shell pm list packages io.appium.unlock'
[debug] [ADB] App is installed
[debug] [ADB] Getting package info for 'io.appium.unlock'
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5556 shell dumpsys package io.appium.unlock'
[debug] [ADB] The installed 'io.appium.unlock' package does not require upgrade ('2.0.0' >= '2.0.0')
[debug] [UiAutomator2] Forwarding UiAutomator2 Server port 6790 to 8200
[debug] [ADB] Forwarding system: 8200 to device: 6790
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5556 forward tcp\:8200 tcp\:6790'
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5556 shell rm -rf /data/local/tmp/strings.json'
[debug] [UiAutomator2] No app capability. Assuming it is already on the device
[debug] [ADB] Getting install status for co.good.teamwork.android
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5556 shell pm list packages co.good.teamwork.android'
[debug] [ADB] App is installed
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5556 shell am force-stop co.good.teamwork.android'
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5556 shell pm clear co.good.teamwork.android'
[debug] [AndroidDriver] Performed fast reset on the installed 'co.good.teamwork.android' application (stop and clear)
[debug] [ADB] Checking app cert for null
[debug] [ADB] 'null' doesn't exist
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5556 shell am force-stop io.appium.uiautomator2.server'
[UiAutomator2] Starting uiautomator2 server 1.12.0
[UiAutomator2] Using UIAutomator2 server from '/usr/local/lib/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-v1.12.0.apk' and test from '/usr/local/lib/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk'
[UiAutomator2] Running command: 'adb -s emulator-5556 shell am instrument -w io.appium.uiautomator2.server.test/android.support.test.runner.AndroidJUnitRunner'
[UiAutomator2] Waiting up to 20000ms for UiAutomator2 to be online...
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[debug] [JSONWP Proxy] Got response with status 200: "{\"sessionId\":\"SESSIONID\",\"status\":0,\"value\":\"Status Invoked\"}"
[debug] [JSONWP Proxy] Proxying [POST /session] to [POST http://localhost:8200/wd/hub/session] with body: {"desiredCapabilities":{"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"appPackage":"co.good.teamwork.android","appActivity":"co.good.teamwork.android.splash.GCSplashActivity","platformVersion":"7.0","automationName":"uiautomator2","platformName":"Android","deviceName":"PixelApi24"},"appPackage":"co.good.teamwork.android","appActivity":"co.good.teamwork.android.splash.GCSplashActivity","platformVersion":"7.0","automationName":"uiautomator2","platformName":"Android","deviceName":"emulator-5556","deviceUDID":"emulator-5556","deviceScreenSize":"1080x1920","deviceScreenDensity":480,"deviceModel":"Android SDK built for x86","deviceManufacturer":"Google","deviceApiLevel":24}}
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"b4e9531a-6c49-4d6a-8975-ade4a90b1dff","status":0,"value":"Created Session"}
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5556 shell dumpsys window'
[AndroidDriver] Screen already unlocked, doing nothing
[UiAutomator2] UiAutomator2 did not start the activity we were waiting for, 'co.good.teamwork.android/co.good.teamwork.android.splash.GCSplashActivity'. Starting it ourselves
[debug] [ADB] Device API level: 24
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5556 shell am start -W -n co.good.teamwork.android/co.good.teamwork.android.splash.GCSplashActivity -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000'
[debug] [JSONWP Proxy] Proxying [GET /appium/device/pixel_ratio] to [GET http://localhost:8200/wd/hub/session/b4e9531a-6c49-4d6a-8975-ade4a90b1dff/appium/device/pixel_ratio] with body: {}
[debug] [JSONWP Proxy] Got response with status 200: "{\"sessionId\":\"b4e9531a-6c49-4d6a-8975-ade4a90b1dff\",\"status\":0,\"value\":3}"
[debug] [JSONWP Proxy] Proxying [GET /appium/device/system_bars] to [GET http://localhost:8200/wd/hub/session/b4e9531a-6c49-4d6a-8975-ade4a90b1dff/appium/device/system_bars] with body: {}
[debug] [JSONWP Proxy] Got response with status 200: "{\"sessionId\":\"b4e9531a-6c49-4d6a-8975-ade4a90b1dff\",\"status\":0,\"value\":{\"statusBar\":72}}"
[debug] [JSONWP Proxy] Proxying [GET /window/current/size] to [GET http://localhost:8200/wd/hub/session/b4e9531a-6c49-4d6a-8975-ade4a90b1dff/window/current/size] with body: {}
[debug] [JSONWP Proxy] Got response with status 200: "{\"sessionId\":\"b4e9531a-6c49-4d6a-8975-ade4a90b1dff\",\"status\":0,\"value\":{\"height\":1776,\"width\":1080}}"
[Appium] New AndroidUiautomator2Driver session created successfully, session aea24c76-e040-4374-b4e3-3ec4842839fd added to master session list
[debug] [BaseDriver] Event 'newSessionStarted' logged at 1533737090259 (17:04:50 GMT+0300 (EEST))
[debug] [MJSONWP] Responding to client with driver.createSession() result: {"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"appPackage":"co.good.teamwork.android","appActivity":"co.good.teamwork.android.splash.GCSplashActivity","platformVersion":"7.0","automationName":"uiautomator2","platformName":"Android","deviceName":"PixelApi24"},"appPackage":"co.good.teamwork.android","appActivity":"co.good.teamwork.android.splash.GCSplashActivity","platformVersion":"7.0","automationName":"uiautomator2","platformName":"Android","deviceName":"emulator-5556","deviceUDID":"emulator-5556","deviceScreenSize":"1080x1920","deviceScreenDensity":480,"deviceModel":"Android SDK built for x86","deviceManufacturer":"Google","deviceApiLevel":24,"pixelRatio":3,"statBarHeight":72,"viewportRect":{"left":0,"top":72,"width":1080,"height":1704}}
[HTTP] <-- POST /wd/hub/session 200 12895 ms - 980
[HTTP] 
[HTTP] --> POST /wd/hub/session/aea24c76-e040-4374-b4e3-3ec4842839fd/timeouts
[HTTP] {"type":"implicit","ms":0}
[debug] [W3C] Bad parameters: BadParametersError: Parameters were incorrect. We wanted "W3C protocol expects any of script, pageLoad or implicit to be set" and you sent {"type":"implicit","ms":0}
[HTTP] <-- POST /wd/hub/session/aea24c76-e040-4374-b4e3-3ec4842839fd/timeouts 400 6 ms - 4284
[HTTP] 
[HTTP] --> GET /wd/hub/session/aea24c76-e040-4374-b4e3-3ec4842839fd/context
[HTTP] {}
[debug] [W3C] Calling AppiumDriver.getCurrentContext() with args: ["aea24c76-e040-4374-b4e3-3ec4842839fd"]
[debug] [MJSONWP] Responding to client with driver.getCurrentContext() result: "NATIVE_APP"
[HTTP] <-- GET /wd/hub/session/aea24c76-e040-4374-b4e3-3ec4842839fd/context 200 22 ms - 84
[HTTP] 
[HTTP] --> POST /wd/hub/session/aea24c76-e040-4374-b4e3-3ec4842839fd/elements
[HTTP] {"using":"id","value":"co.good.teamwork.android:id/btnSignUp"}
[debug] [W3C] Calling AppiumDriver.findElements() with args: ["id","co.good.teamwork.android:id/btnSignUp","aea24c76-e040-4374-b4e3-3ec4842839fd"]
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [BaseDriver] Waiting up to 0 ms for condition
[debug] [JSONWP Proxy] Proxying [POST /elements] to [POST http://localhost:8200/wd/hub/session/b4e9531a-6c49-4d6a-8975-ade4a90b1dff/elements] with body: {"strategy":"id","selector":"co.good.teamwork.android:id/btnSignUp","context":"","multiple":true}
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"b4e9531a-6c49-4d6a-8975-ade4a90b1dff","status":0,"value":[]}
[debug] [MJSONWP] Responding to client with driver.findElements() result: []
[HTTP] <-- POST /wd/hub/session/aea24c76-e040-4374-b4e3-3ec4842839fd/elements 200 652 ms - 74
[HTTP] 
[debug] [UiAutomator2] [UIAutomator2] io.appium.uiautomator2.server.test.AppiumUiAutomator2Server:.
[debug] [UiAutomator2] [UIAutomator2] Time: 17.032
[debug] [UiAutomator2] [UIAutomator2] OK (1 test)
[HTTP] --> GET /wd/hub/session/aea24c76-e040-4374-b4e3-3ec4842839fd/context
[HTTP] {}
[debug] [W3C] Calling AppiumDriver.getCurrentContext() with args: ["aea24c76-e040-4374-b4e3-3ec4842839fd"]
[debug] [MJSONWP] Responding to client with driver.getCurrentContext() result: "NATIVE_APP"
[HTTP] <-- GET /wd/hub/session/aea24c76-e040-4374-b4e3-3ec4842839fd/context 200 4 ms - 84
[HTTP] 
[HTTP] --> POST /wd/hub/session/aea24c76-e040-4374-b4e3-3ec4842839fd/elements
[HTTP] {"using":"id","value":"co.good.teamwork.android:id/btnSignUp"}
[debug] [W3C] Calling AppiumDriver.findElements() with args: ["id","co.good.teamwork.android:id/btnSignUp","aea24c76-e040-4374-b4e3-3ec4842839fd"]
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [BaseDriver] Waiting up to 0 ms for condition
[debug] [JSONWP Proxy] Proxying [POST /elements] to [POST http://localhost:8200/wd/hub/session/b4e9531a-6c49-4d6a-8975-ade4a90b1dff/elements] with body: {"strategy":"id","selector":"co.good.teamwork.android:id/btnSignUp","context":"","multiple":true}
[MJSONWP] Encountered internal error running command: ProxyRequestError: Could not proxy command to remote server. Original error: Error: connect ECONNREFUSED 127.0.0.1:8200
[MJSONWP]     at JWProxy.proxy$ (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/jsonwp-proxy/proxy.js:152:13)
[MJSONWP]     at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
[MJSONWP]     at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
[MJSONWP]     at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
[MJSONWP]     at GeneratorFunctionPrototype.invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
[MJSONWP]     at <anonymous>
[HTTP] <-- POST /wd/hub/session/aea24c76-e040-4374-b4e3-3ec4842839fd/elements 500 38 ms - 271
[HTTP] 
[HTTP] --> POST /wd/hub/session/aea24c76-e040-4374-b4e3-3ec4842839fd/timeouts
[HTTP] {"type":"implicit","ms":3000}
[debug] [W3C] Bad parameters: BadParametersError: Parameters were incorrect. We wanted "W3C protocol expects any of script, pageLoad or implicit to be set" and you sent {"type":"implicit","ms":3000}
[HTTP] <-- POST /wd/hub/session/aea24c76-e040-4374-b4e3-3ec4842839fd/timeouts 400 2 ms - 4290
[HTTP] 
[HTTP] --> DELETE /wd/hub/session/aea24c76-e040-4374-b4e3-3ec4842839fd
[HTTP] {}
[debug] [W3C] Calling AppiumDriver.deleteSession() with args: ["aea24c76-e040-4374-b4e3-3ec4842839fd"]
[debug] [BaseDriver] Event 'quitSessionRequested' logged at 1533737101666 (17:05:01 GMT+0300 (EEST))
[Appium] Removing session aea24c76-e040-4374-b4e3-3ec4842839fd from our master session list
[debug] [UiAutomator2] Deleting UiAutomator2 session
[debug] [UiAutomator2] Deleting UiAutomator2 server session
[debug] [JSONWP Proxy] Proxying [DELETE /] to [DELETE http://localhost:8200/wd/hub/session/b4e9531a-6c49-4d6a-8975-ade4a90b1dff] with no body
[UiAutomator2] Did not get confirmation UiAutomator2 deleteSession worked; Error was: ProxyRequestError: Could not proxy command to remote server. Original error: Error: connect ECONNREFUSED 127.0.0.1:8200
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5556 shell am force-stop co.good.teamwork.android'
[debug] [Logcat] Stopping logcat capture
[debug] [ADB] Removing forwarded port socket connection: 8200 
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5556 forward --remove tcp\:8200'
[debug] [ADB] Running '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5556 forward --remove tcp\:8200'
[UiAutomator2] Unable to remove port forward 'Error executing adbExec. Original error: 'Command '/Users/denysvoskovets/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5556 forward --remove tcp\:8200' exited with code 1'; Stderr: 'error: listener 'tcp:8200' not found'; Code: '1''
[debug] [BaseDriver] Event 'quitSessionFinished' logged at 1533737102331 (17:05:02 GMT+0300 (EEST))
[debug] [MJSONWP] Received response: null
[debug] [MJSONWP] But deleting session, so not returning
[debug] [MJSONWP] Responding to client with driver.deleteSession() result: null
[HTTP] <-- DELETE /wd/hub/session/aea24c76-e040-4374-b4e3-3ec4842839fd 200 667 ms - 76

#2

This is more of a guess than it is “the logs tell me X”…

You are setting a device “udid” in your TestNg.xml but then you arent calling that value in when you set the DesiredCapabilities for your driver. I have always been under the impression that if you are going to run Androids in parallel, you need to provide a unique device id to each of your Appium servers so they can keep in sync with ADB… I think Appium ignores “deviceName” for these purposes because I run 6 Androids at once and my base driver startup class just says capabilities.setCapability(“deviceName”, “Android”);

Here is my full AndroidDriver startup class for reference… This worked this morning against appium 1.8:

AppiumDriver driver;
if (isAndroid) {

            File appDir = new File("/Users/Foo/Desktop/FooBar/Bar.DeviceTest.TestExecution/apps/");
            File app = new File(appDir, "app-debug.apk");
            DesiredCapabilities capabilities = new DesiredCapabilities();
            capabilities.setCapability("device", "Android");
            capabilities.setCapability("udid", deviceId);
            capabilities.setCapability("deviceName", "Android");
            capabilities.setCapability("bundleId", "com.foo.bar");
            capabilities.setCapability("app", app.getAbsolutePath());
            capabilities.setCapability("nativeEvents", false);
            capabilities.setCapability("newCommandTimeout", 120);

            driver = new AndroidDriver(new URL("http://0.0.0.0:" + appiumPort + "/wd/hub"), capabilities);