Copied to clipboard

Get Kobiton session id

The Kobiton Session Id can be obtained from the RemoteWebDriver or AppiumDriver instance. See the code snippets for the specified languages below:

1. JavaScript

    import BPromise from 'bluebird'
    const sessionCapabilities = await BPromise.fromCallback((done) => driver.sessionCapabilities(done))
    console.log(sessionCapabilities.kobitonSessionId)

2. Java

Selenium Webdriver

    String kobitonSessionId = driver.getCapabilities().getCapability("kobitonSessionId").toString();
    System.out.println("kobitonSessionId: " + kobitonSessionId);

Appium Driver

    String kobitonSessionId = driver.getSessionDetails().get("kobitonSessionId").toString();
    System.out.println("kobitonSessionId: " + kobitonSessionId);

3. C#

Selenium Webdriver

    string kobitonSessionId = driver.Capabilities.GetCapability("kobitonSessionId").ToString();
    Console.WriteLine("kobitonSessionId: " + kobitonSessionId);

Appium Driver

    string kobitonSessionId = driver.SessionDetails["kobitonSessionId"].ToString();
    Console.WriteLine("kobitonSessionId: " + kobitonSessionId);

4. Python (Selenium Webdriver & Appium Driver)

    kobitonSessionId = self.driver.desired_capabilities.get('kobitonSessionId')
    print(kobitonSessionId)

5. PHP

Selenium Webdriver

    $getCapabilities = $this->driver->getCapabilities()->toArray();
    $kobitonSessionId = $getCapabilities['kobitonSessionId'];
    print($kobitonSessionId);

6. Ruby

Selenium Webdriver

    puts @driver.capabilities['kobitonSessionId']

Appium Driver

    puts @driver.driver.capabilities['kobitonSessionId']

Feedback

SELECTED

Tip

You can select a specific word, line of text, or one or more paragraphs to comment.

COMMENT

Please give us some feedback !
Thank you!
  • We are listening,
  • we will do our best to fix this soon