These custom events will show up when you call getEvents later on! Here are some that I triggered in a test of my application. Why do we need this vendor prefix? To ensure that custom events can never conflict with built-in ones, or with events logged by another library. In the example above, we are logging an 'eventName' event with the vendor name 'prefix'. To do this, you need to log the event: CustomEvent evt = new CustomEvent() In addition to the hand-picked events automatically included by the Appium team, you can also tell the Appium server to include your own events within the event log, so that you can have a record of when actions within the world of your test logic took place with respect to the built-in Appium commands. The ServerEvents object for this reason has a commands field and an events field, each constituting a list of their own type ( CommandEvent and ServerEvent) respectively, and containing the event name and timestamp(s). (In all cases, the numeric values are timestamps in milliseconds.) In addition, the hand-picked named events are included, for example xcodeDetailsRetrieved or appConfigured above. All commands sent to the Appium server are considered events, and their start and end times are tracked. There are two main sections here, one labeled commands, and then a bunch of other names consisting of timestamps. Let's take a look at the (truncated) raw API response for an example call, so you can see its shape: What you get back from this call is a ServerEvents object encapsulating the various types of data returned with this API. However, in the W3C protocol there is no route that corresponds to getSessionDetails, and so the Appium team has added its own route, which is supported in the Java client as the getEvents command: ServerEvents events = driver.getEvents() Previously, it was possible to retrieve events using the getSessionDetails command: Map details = driver.getSessionDetails() įor this to work, you also had to use the eventTimings capability, and set it to true, in order for Appium to decorate the session details response with the appropriate timing information. Basically, the timestamps of various points of interest in the lifecycle of a session are logged automatically as "events", which can be retrieved at any point during the test. Getting event dataįor this reason, the Appium team developed something called the "Events API" (or sometimes the "Event Timings API"). You could turn on timestamps in the logs (using -log-timestamp), but then you have to do a bunch of mental gymnastics to develop a picture of the startup flow over time. Just looking at the logs doesn't necessarily tell you how long Appium spent within each zone of its startup routine, though. Having a look at the Appium logs can clear up this confusion (maybe you notice that the first time you run an iOS test with a new version of Appium, it spent time rebuilding WebDriverAgent-that makes sense). Ever wondered what goes on under the hood while Appium is starting up, say, an iOS session using the XCUITest driver? Sometimes this is a process that takes several minutes, and sometimes it only takes a handful of seconds.