Skip to main content

SeeTest Client - WaitForDevice

info

Please note that this tool is classified as a Legacy tool. We recommend transitioning to our updated solutions to maintain optimal performance and security in your workflows. For more information on this matter, please reach out to technical support .

String = WaitForDevice(Device, Timeout)

Description

The command gives the ability to choose device for testing dynamically based on query of the devices properties.

It is mandatory to release the device and make it available for other future tests, use the SeeTest Client - ReleaseDevice command.

The command returns the device's name.

Parameters

  • Device: Search device query.
  • Timeout: Timeout in milliseconds to wait for an available device according to the search query.

Optional properties for queries:

  • device added: if device is available on the device list in the user's machine.
  • host: IP of the host machine in the SeeTestCloud configuration.
  • location: Location of the host machine as set in the SeeTestCloud configuration.
  • manufacture
  • model: Device model, for example: SM-G935F
  • modelName:  Device marketing name: for example: Galaxy S7 Edge
  • name
  • os: Operating system.
  • remote: If device is connected through SeeTestCloud or not (values are true/false).
  • serialnumber: S/N of the device.
  • version: The device's operating system version (for example 4.1.2).
  • versionnumber: The device's operating system version number (for example 4.1).
  • category: The device category. Currently supported in android devices. possible values- 'WATCH', 'PHONE' or 'TABLET'.
info

Note: If the device is in the cloud, the command will make a reservation and use the device. However, if the device is already reserved, the command will not be able to reserve the device.

Usage

Command usage: Assigns a device to a test based on a device query. The query is written in XPath syntax. 

Example Queries: 

  • "@added='false' and @location='US' and @manufacture='Samsung' and @os='android' and @version='4.2.2' and @remote='true'"
  • "@added='false' and @location='UK' and @manufacture='apple' and @model='iphone/ipod(3/4/5)' and @os='ios' and @remote='false' and @versionnumber='7.0'"
  • "@added='false' and @location='UK' and @manufacture='apple' and @model='iphone/ipod(3/4/5)' and @os='ios' and contains(@name, 'iPhone')'"
  • "@added='false' and @location='UK' and @manufacture='apple' and @model='iphone/ipod(3/4/5)' and @os='ios' and starts-with(@name, 'iPhone')'"

Code Example

UFT Example Expand source

' Get information about all available devices in XML format.
print MDriver("Driver").GetDevicesInformation

Dim deviceName

' Wait for android cloud device (30 seconds timeout)
deviceName = MDriver("Driver").WaitForDevice ("@os='android' AND @remote='true'", 30000)
print "Following device was selected: " + deviceName

' Perform some actions on device
MDevice("name:=" + deviceName).Open
MDevice("name:=" + deviceName).Swipe "Right", 0
wait(3)
MDevice("name:=" + deviceName).Swipe "Left", 0

' Release the device from cloud after using it, but do not remove from device manager.
MDriver("Driver").ReleaseDevice deviceName, false

' Additional examples for WaitForDevice usage
deviceName = MDriver("Driver").WaitForDevice ("@serialnumber='00000011-07ad-5c10-0000-000000000000'", 30000)
deviceName = MDriver("Driver").WaitForDevice ("@os='android'", 30000)
deviceName = MDriver("Driver").WaitForDevice ("@name='Nexus 5'", 30000)