Appium LogsEvent / ServerEvent fails with 'UnsupportedCommandException'

I am getting ‘unsupportedcommandexception’ when trying to use ‘driver.logEvent(CustomEvent)’. Also, i am not able to successfully execute / use ‘serverevents (getEvents)’.

I am using appium java-client (7.3.0.jar) and selenium (3.141.59)

Build info: version: ‘3.141.59’, revision: ‘e82be7d358’, time: ‘2018-11-14T08:25:53’
System info: host: ‘C02NQD1KG3QC’, ip: ‘fe80:0:0:0:427:3a37:fcf1:21fc%en0’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.14.6’, java.version: ‘1.8.0_25’
Driver info: io.appium.java_client.ios.IOSDriver
Capabilities {app: cloud:xxy.yyz.tts.test, appBuildVersion: , appReleaseVersion: , appiumVersion: 1.8.0, autoAcceptAlerts: false, autoDismissAlerts: true, autoGrantPermissions: true, autoLaunch: false, autoWebview: false, automationName: XCUITest, browserName: , bundleId: xxy.yyz.tts.test, cloudViewLink: https://icloud.seetest.c…, commandTimeouts: 120000, desired: {app: cloud:xxy.yyz.tts.test, autoDismissAlerts: true, autoGrantPermissions: true, autoLaunch: false, automationName: XCUITest, browserName: , bundleId: xxy.yyz.tts.test, eventTimings: true, noReset: true, platform: IOS, platformName: iOS, testName: PerfMetrics, udid: 9f6e76dddab3b2d133b8075cd…}, device.category: PHONE, device.majorVersion: 11, device.manufacture: Apple, device.model: iPhone 6s, device.name: TEST Device Attribute, device.os: iOS, device.screenSize: 640x1136, device.serialNumber: 9f6e76dddab3b2d133b8075cd…, device.version: 11.1.2, deviceUDID: 9f6e76dddab3b2d133b8075cd…, dontGoHomeOnQuit: false, dontStopAppOnReset: false, ehmPrefixUrl: /agent-2, ehmUrl: https://icloud.seetest.c…, eventTimings: true, fullReset: false, gridNodePort: 7820, install.only.for.update: false, instrumentApp: false, javascriptEnabled: true, keystorePath: ~/.android/debug.keystore, locationServicesAuthorized: false, newSessionWaitTimeout: 600, noReset: true, platform: IOS, platformName: iOS, projectName: , reportDirectory: reports, reportFormat: xml, reportUrl: https://icloud.seetest.c…, reservationDuration: 240, takeScreenshots: true, test.type: Mobile, testName: PerfMetrics, udid: 9f6e76dddab3b2d133b8075cd…, useKeystore: false, waitForDeviceTimeout: 120000}
Session ID: CLOUD-SID:2020-01-15_13-02-45-ff9045e2-75b8-4fb2-85e7-8e88b8db45ff
org.openqa.selenium.UnsupportedCommandException: unknown command (Unknown command) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
Build info: version: ‘3.141.59’, revision: ‘e82be7d358’, time: ‘2018-11-14T08:25:53’
System info: host: ‘C02NQD1KG3QC’, ip: ‘fe80:0:0:0:427:3a37:fcf1:21fc%en0’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.14.6’, java.version: ‘1.8.0_25’
Driver info: io.appium.java_client.ios.IOSDriver
Capabilities {app: cloud:xxy.yyz.tts.test, appBuildVersion: , appReleaseVersion: , appiumVersion: 1.8.0, autoAcceptAlerts: false, autoDismissAlerts: true, autoGrantPermissions: true, autoLaunch: false, autoWebview: false, automationName: XCUITest, browserName: , bundleId: xxy.yyz.tts.test, cloudViewLink: https://icloud.seetest.c…, commandTimeouts: 120000, desired: {app: cloud:xxy.yyz.tts.test, autoDismissAlerts: true, autoGrantPermissions: true, autoLaunch: false, automationName: XCUITest, browserName: , bundleId: xxy.yyz.tts.test, eventTimings: true, noReset: true, platform: IOS, platformName: iOS, testName: PerfMetrics, udid: 9f6e76dddab3b2d133b8075cd…}, device.category: PHONE, device.majorVersion: 11, device.manufacture: Apple, device.model: iPhone 6s, device.name: TEST Device Attribute, device.os: iOS, device.screenSize: 640x1136, device.serialNumber: 9f6e76dddab3b2d133b8075cd…, device.version: 11.1.2, deviceUDID: 9f6e76dddab3b2d133b8075cd…, dontGoHomeOnQuit: false, dontStopAppOnReset: false, ehmPrefixUrl: /agent-2, ehmUrl: https://icloud.seetest.c…, eventTimings: true, fullReset: false, gridNodePort: 7820, install.only.for.update: false, instrumentApp: false, javascriptEnabled: true, keystorePath: ~/.android/debug.keystore, locationServicesAuthorized: false, newSessionWaitTimeout: 600, noReset: true, platform: IOS, platformName: iOS, projectName: , reportDirectory: reports, reportFormat: xml, reportUrl: https://icloud.seetest.c…, reservationDuration: 240, takeScreenshots: true, test.type: Mobile, testName: PerfMetrics, udid: 9f6e76dddab3b2d133b8075cd…, useKeystore: false, waitForDeviceTimeout: 120000}
Session ID: CLOUD-SID:2020-01-15_13-02-45-ff9045e2-75b8-4fb2-85e7-8e88b8db45ff
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
at org.openqa.selenium.remote.http.JsonHttpResponseCodec.reconstructValue(JsonHttpResponseCodec.java:40)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:80)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:44)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:41)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.ios.IOSDriver.execute(IOSDriver.java:1)
at io.appium.java_client.LogsEvents.logEvent(LogsEvents.java:43)
at com.seetest.automation.tests.launchmetrics.appLaunch(launchmetrics.java:40)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:133)
at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:584)
at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:172)
at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:804)
at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:145)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
at org.testng.TestRunner$$Lambda$226/1514795208.accept(Unknown Source)
at java.util.ArrayList.forEach(ArrayList.java:1249)
at org.testng.TestRunner.privateRun(TestRunner.java:770)
at org.testng.TestRunner.run(TestRunner.java:591)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:402)
at org.testng.SuiteRunner.access$000(SuiteRunner.java:41)
at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:443)
at org.testng.internal.thread.ThreadUtil.lambda$execute$0(ThreadUtil.java:67)
at org.testng.internal.thread.ThreadUtil$$Lambda$31/806511723.call(Unknown Source)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Exception - Session CLOUD-SID:2020-01-15_13-02-45-ff9045e2-75b8-4fb2-85e7-8e88b8db45ff could not be found (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
Build info: version: ‘3.141.59’, revision: ‘e82be7d358’, time: ‘2018-11-14T08:25:53’
System info: host: ‘C02NQD1KG3QC’, ip: ‘fe80:0:0:0:427:3a37:fcf1:21fc%en0’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.14.6’, java.version: ‘1.8.0_25’
Driver info: io.appium.java_client.ios.IOSDriver
Capabilities {app: cloud:xxy.yyz.tts.test, appBuildVersion: , appReleaseVersion: , appiumVersion: 1.8.0, autoAcceptAlerts: false, autoDismissAlerts: true, autoGrantPermissions: true, autoLaunch: false, autoWebview: false, automationName: XCUITest, browserName: , bundleId: xxy.yyz.tts.test, cloudViewLink: https://icloud.seetest.c…, commandTimeouts: 120000, desired: {app: cloud:xxy.yyz.tts.test, autoDismissAlerts: true, autoGrantPermissions: true, autoLaunch: false, automationName: XCUITest, browserName: , bundleId: xxy.yyz.tts.test, eventTimings: true, noReset: true, platform: IOS, platformName: iOS, testName: PerfMetrics, udid: 9f6e76dddab3b2d133b8075cd…}, device.category: PHONE, device.majorVersion: 11, device.manufacture: Apple, device.model: iPhone 6s, device.name: TEST Device Attribute, device.os: iOS, device.screenSize: 640x1136, device.serialNumber: 9f6e76dddab3b2d133b8075cd…, device.version: 11.1.2, deviceUDID: 9f6e76dddab3b2d133b8075cd…, dontGoHomeOnQuit: false, dontStopAppOnReset: false, ehmPrefixUrl: /agent-2, ehmUrl: https://icloud.seetest.c…, eventTimings: true, fullReset: false, gridNodePort: 7820, install.only.for.update: false, instrumentApp: false, javascriptEnabled: true, keystorePath: ~/.android/debug.keystore, locationServicesAuthorized: false, newSessionWaitTimeout: 600, noReset: true, platform: IOS, platformName: iOS, projectName: , reportDirectory: reports, reportFormat: xml, reportUrl: https://icloud.seetest.c…, reservationDuration: 240, takeScreenshots: true, test.type: Mobile, testName: PerfMetrics, udid: 9f6e76dddab3b2d133b8075cd…, useKeystore: false, waitForDeviceTimeout: 120000}
Session ID: CLOUD-SID:2020-01-15_13-02-45-ff9045e2-75b8-4fb2-85e7-8e88b8db45ff

You don’t give any details about your event so it’s hard to guess what your code looks like. Maybe reading this will help:

I followed exactly the code given in the document, but i am getting error.

Below is my event code.

CustomEvent evt = new CustomEvent();
evt.setVendor(vendorName);
evt.setEventName(eventName);
driver.logEvent(evt);
driver.launchApp();
CustomEvent evt = new CustomEvent();
evt.setVendor(vendorName);
evt.setEventName(newEventName);
driver.logEvent(evt);

ServerEvents events = driver.getEvents();
events.save(new File(filePath).toPath());
driver.quit();

Basically, i am trying to get the app launch time.

The exception occurs at ‘driver.logEvent’

Most likely the version of Appium server is too old to support this feature

I’m seeing 1.8.0 as released in 2018, so it’s probably good advice to update.

Current release is 1.16.0:

I am able to use the LogsEvent / ServerEvent after updating my appium version to 1.16