Create New Session

Create a new session

Example Usage

// Java
DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
desiredCapabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "10.3");
desiredCapabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone Simulator");
desiredCapabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, "XCUITest");
desiredCapabilities.setCapability(MobileCapabilityType.APP, "/path/to/ios/");

URL url = new URL("");

IOSDriver driver = new IOSDriver(url, desiredCapabilities);
String sessionId = driver.getSessionId().toString();

# Python
desired_caps = desired_caps = {
  'platformName': 'Android',
  'platformVersion': '7.0',
  'deviceName': 'Android Emulator',
  'automationName': 'UiAutomator2',
  'app': PATH('/path/to/app')
self.driver = webdriver.Remote('', desired_caps)

// Javascript
// example
let options = { desiredCapabilities: {
  platformName: 'Android',
  platformVersion: '7.0',
  automationName: 'UiAutomator2',
  app: path.resolve('path', 'to', 'app.apk')
let client = webdriverio.remote(options);

// wd example
let driver = await wd.promiseChainRemote({
  host: '',
  port: 4723
let desiredCaps = {
  platformName: 'Android',
  platformVersion: '7.0',
  deviceName: 'Android Emulator',
  app: path.resolve('path', 'to', 'app.apk')
await driver.init(desiredCaps);

# Ruby
# ruby_lib example
APP_PATH = '../../path/to/'

desired_caps = {
  caps: {
    platformName:  'iOS',
    platformVersion: '10.2',
    deviceName:    'iPhone 6',
    app:           APP_PATH,
    automationName: "XCUITest"

# ruby_lib_core example

// TODO PHP sample

// C#
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.SetCapability(MobileCapabilityType.PlatformName, "Android");
capabilities.SetCapability(MobileCapabilityType.PlatformVersion, "7.1.1");
capabilities.SetCapability(MobileCapabilityType.DeviceName, "Android Device");
capabilities.SetCapability("appPackage", "");
capabilities.SetCapability("appActivity", "");

AndroidDriver<AndroidElement> driver = new AndroidDriver<AndroidElement>(new Uri(""), capabilities);


The server should attempt to create a session that most closely matches the desired and required capabilities.


Appium Server

Platform Driver Platform Versions Appium Version Driver Version
iOS XCUITest 9.3+ 1.6.0+ All
UIAutomation 8.0 to 9.3 All All
Android Espresso ?+ 1.9.0+ All
UiAutomator2 ?+ 1.6.0+ All
UiAutomator 4.2+ All All
Mac Mac ?+ 1.6.4+ All
Windows Windows 10+ 1.6.0+ All

Appium Clients

Language Support Documentation
Java All
Python All
Javascript (WebdriverIO) All
Javascript (WD) All
Ruby All
C# All

HTTP API Specifications


POST /session

URL Parameters


JSON Parameters

name type description
desiredCapabilities object (JSONWP specification) Object describing session's desired capabilities
requiredCapabilities object (JSONWP specification) Object describing session's required capabilities that must be applied by remote end
capabilities object (W3C specification) object containing 'alwaysMatch' and 'firstMatch' properties
capabilities.alwaysMatch object The desired capabilities that the remote end must match
capabilities.firstMatch array<object> List of capabilities that the remote end tries to match. Matches the first in the list


An object describing the session's capabilities (object)

See Also