Skip to main content

Appium Session

A session is a medium to send commands to the specific test applications. Appium works in a client-server architecture. The client requests features that a session should support. Clients initiates a session with a server in ways specific to each library.

Starting an Appium session for a native apps depends on the capabilities set while starting the session. Desired capabilities are sent to the Appium Server to tell the server what kind of automation session we are interested in. The Server receives connection from client and initiates as session.

The Appium server receives a connection from client in the form of a JSON object over HTTP. Once the server receives the details, it creates a session, and return the session ID, which will be maintained until the Appium server is running. So, all testing will be performed in the context of newly created session. All the commands are executed in the context of a session.

To launch an Appium session for a particular app, we need the app to be installed on the device. For hybrid apps, the Appium session will be launched as a native app session only.

On iOS devices/simulators we can't automate two apps in one session due to a limitation from the Apple itself. When we start an Appium session for testing, generally it is tied to an app as we are passing the app parameter in the desired capabilities, so we can't really pass two apps in the desired capabilities.

Every Appium automation session is given a unique ID when the session is first created. 

Since Appium has a one-to-one relationship between sessions and devices, if a session is already running, any new sessions will automate other devices available to the Appium server. A device will not be reused for a session until the session is ended via an HTTP DELETE request sent to /session/:sessionId.

When it comes to your test script, the only thing which differentiates the client object from the client for a different test, is the session ID. All the client libraries automatically save the session ID when a sessions is started and include in in the path for all further commands. 

Tags
Submitted by tgoswami on October 12, 2020

Tarun has 11+ years of experience in Quality Assurance in different domains like Banking, E-commerce, Health and Education.

About

At ProgramsBuzz, you can learn, share and grow with millions of techie around the world from different domain like Data Science, Software Development, QA and Digital Marketing. You can ask doubt and get the answer for your queries from our experts.