# DeviceBuilder Class

> Use this class to configure the device that you want to connect with.

Use this class to configure the device that you want to connect with.

## Definition

**Namespace**: UiPath.MobileAutomation.API.Models

**Assembly**: UiPath.MobileAutomation.API (in UiPath.MobileAutomation.API.dll)

## Syntax

```
public class DeviceBuilder
```

The `DeviceBuilder` type exposes the following members.

## Constructors

```
DeviceBuilder(
	string appiumUrl,
	string displayName
)
```

### `DeviceBuilder`
:   Initializes a new instance of the `DeviceBuilder` class.

**`appiumUrl`** [String](https://learn.microsoft.com/en-us/dotnet/api/system.string?view=net-8.0)
:   The Appium URL.

**`displayName`** [String](https://learn.microsoft.com/en-us/dotnet/api/system.string?view=net-8.0)
:   The name of the device

## Methods

These are the methods that you can use to build your device.

### Build

Create a `Device` object.

#### Definition

**Namespace**: UiPath.MobileAutomation.API.Models

**Assembly**: UiPath.MobileAutomation.API (in UiPath.MobileAutomation.API.dll)

#### `DeviceBuilder.Build()`

```
public Device Build()
```

#### Return Value

[Device](https://docs.uipath.com/activities/other/latest/ui-automation/device-class#device-class)

A `Device` object that you use to create a connection.

### WithCapabilities

Configure additional desired capabilities for the device.

#### Definition

**Namespace**: UiPath.MobileAutomation.API.Models

**Assembly**: UiPath.MobileAutomation.API (in UiPath.MobileAutomation.API.dll)

#### `DeviceBuilder.WithCapabilities`

```
WithCapabilities(
	Dictionary<string, string> capabiltiies
)
```

**`capabilities`** [Dictionary](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.dictionary-2?view=net-8.0) < [String](https://learn.microsoft.com/en-us/dotnet/api/system.string?view=net-8.0), [String](https://learn.microsoft.com/en-us/dotnet/api/system.string?view=net-8.0)>
:   Additional desired capabilities for a device.
    Visit [Appium capabilities](https://appium.io/docs/en/2.2/guides/caps/#appium-capabilities) to learn about
    the additional capabilities that you can configure.

#### Return value

`DeviceBuilder`

Returns an updated device builder.

### WithCapability

Configure a single capability for the device.

#### Definition

**Namespace**: UiPath.MobileAutomation.API.Models

**Assembly**: UiPath.MobileAutomation.API (in UiPath.MobileAutomation.API.dll)

#### `DeviceBuilder.WithCapability(string, string)`

```
WithCapability(
	string key,
	string value
)
```

**`key`** [String](https://learn.microsoft.com/en-us/dotnet/api/system.string?view=net-8.0)
:   The name of the capability that you want to configure.
:   Visit [Appium capabilities](https://appium.io/docs/en/2.2/guides/caps/#appium-capabilities) to learn about
    the additional capabilities that you can configure.

`value` [String](https://learn.microsoft.com/en-us/dotnet/api/system.string?view=net-8.0)
:   Enter the value of the capability.

#### Return value

`DeviceBuilder`

Returns an updated device builder.

### WithDeviceName

Specify the name of the device.

#### Definition

**Namespace**: UiPath.MobileAutomation.API.Models

**Assembly**: UiPath.MobileAutomation.API (in UiPath.MobileAutomation.API.dll)

#### `DeviceBuilder.DeviceName(string)`

```
WithDeviceName(
	string deviceName
)
```

**`deviceName`** [String](https://learn.microsoft.com/en-us/dotnet/api/system.string?view=net-8.0)
:   The name of a particular device to automate. (for example, iPhone 13).

#### Return value

`DeviceBuilder`

Returns an updated device builder.

### WithHttpHeaders

Add custom http headers to the default one that Appium generates to allow for an easier mobile
testing experience behind a proxy. Custom Http headers allow mobile testing to work with
proxies that accept only certain headers, by specifically adding them. The custom
headers that you add don't overwrite the already existent header, but they add to the
collection of values that the header can support.

#### Definition

**Namespace**: UiPath.MobileAutomation.API.Models

**Assembly**: UiPath.MobileAutomation.API (in UiPath.MobileAutomation.API.dll)

#### `DeviceBuilder.WithHttpHeaders(string)`

```
WithHttpHeaders(
	Dictionary<string, string> headers
)
```

**`headers`** [Dictionary](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.dictionary-2?view=net-8.0) < [String](https://learn.microsoft.com/en-us/dotnet/api/system.string?view=net-8.0), [String](https://learn.microsoft.com/en-us/dotnet/api/system.string?view=net-8.0)>
:   The names and values of the custom headers that you want to add.

#### Return value

`DeviceBuilder`

Returns an updated device builder.

### WithPlatformName

Specify the platform name of a device.

#### Definition

**Namespace**: UiPath.MobileAutomation.API.Models

**Assembly**: UiPath.MobileAutomation.API (in UiPath.MobileAutomation.API.dll)

#### `DeviceBuilder.WithPlatformName(PaltformType)`

```
WithPlatformName(
	PlatformType type
)
```

**`type`** `PlatformType`
:   The type of platform hosting the app or browser.

#### Return value

`DeviceBuilder`

Returns an updated device builder.

### WithPlatformVersion

Specify the version of the device's platform.

#### Definition

**Namespace**: UiPath.MobileAutomation.API.Models

**Assembly**: UiPath.MobileAutomation.API (in UiPath.MobileAutomation.API.dll)

#### `DeviceBuilder.WithPlatformVersion(string)`

```
WithPlatformVersion(
	string version
)
```

**`version`** [String](https://learn.microsoft.com/en-us/dotnet/api/system.string?view=net-8.0)
:   The version of a platform. (For example, iOS 16)

#### Return value

`DeviceBuilder`

Returns an updated device builder.
