Start using Kobiton Command Line Interface

Learn how to use Kobiton Command Line Interface to control and operate your private device lab.

Before you start

  • Set up Kobiton CLI.

  • Ensure private devices are available in the Kobiton Portal. Public devices are not supported.

Create a CLI session

Open a terminal program on the computer.

Find a private device that is available (not in use or retained by other users):

kobiton device list --booked false --reserved false --private

Note down the UDID of the device to use.

Create a session on the device:

Example
kobiton session create -u <UDID>
Output
Session <SESSION_ID> created for device <UDID>.
Session token <SESSION_TOKEN>

Note down the <SESSION_ID> for later use.

Export the <SESSION_TOKEN> to the KOBITON_SESSION_TOKEN environment variable for later use

  • macOS and Linux

  • Windows - Powershell

  • Windows - Command Prompt

export KOBITON_SESSION_TOKEN=<SESSION_TOKEN>
$env:KOBITON_SESSION_TOKEN="<SESSION_TOKEN>"
set KOBITON_SESSION_TOKEN=<SESSION_TOKEN>

Most CLI commands require either SESSION_ID or KOBITON_SESSION_TOKEN. See this page for the list of commands and their basic usage.

  • For CLI sessions:

    • No Session Explorer available.

    • Session video and logs are not available in Session Overview.

    • Mixed sessions between manual and CLI are not supported.

    • CLI sessions time out after 10 minutes by default and can be configured for up to 2 hours. You can reset the timeout using the kobiton session ping command.

Troubleshooting

If you run into an error while running the CLI commands, try the below steps:

  • Double-check the command syntax and usage. It is possible to bring up the manual for each command by adding -h or --help. Examples:

    • kobiton --help or kobiton -h

    • kobiton device --help or kobiton session -h

    • kobiton device list -h or kobiton session create -h

  • If the error is not resolved, look up the error messages and their resolutions in the below table:

    Message Solution

    environment variable not found

    Export the environment variables for authentication.

    The credential you entered was not authorized. Please double-check and try again.

    Double-check the Kobiton account’s username and API Key.

    error sending request for url (/https://api.kobiton.com/v2/sessions): client error (Connect): dns error: failed to lookup address information: nodename nor servname provided, or not known

    504 Gateway Time-out

    Ensure the local machine can access the Cloud or Standalone Kobiton Portal

    This command requires a session ID (-s).

    Create a CLI session to get a <SESSION_ID>, then add -s <SESSION_ID> to the command.

    This command requires a --session-token or KOBITON_SESSION_TOKEN env. See session create.

    Create a CLI session to get a <SESSION_TOKEN>, then add -a <SESSION_TOKEN> to the command or export the KOBITON_SESSION_TOKEN environment variable.

    Session not found or already ended

    The CLI session is not found or already completed. Create a new CLI session before running the command.

    Device --udid is required.

    Provide the UDID of the device using -u <UDID>