---
title: "hasHardwareButton(_:)"
framework: xcuiautomation
role: symbol
role_heading: Instance Method
path: "xcuiautomation/xcuidevice/hashardwarebutton(_:)"
---

# hasHardwareButton(_:)

Determines whether the device supports the button type you provide.

## Declaration

```swift
func hasHardwareButton(_ button: XCUIDevice.Button) -> Bool
```

## Parameters

- `button`: The type of physical button on an iOS device to check for.

## Return Value

Return Value True if the device has this type of button, otherwise False.

## Discussion

Discussion Use this method to check if the device supports the particular button type you provide.

## See Also

### Interacting with buttons and the Digital Crown

- [press(_:)](xcuiautomation/xcuidevice/press(_:).md)
- [XCUIDevice.Button](xcuiautomation/xcuidevice/button.md)
- [rotateDigitalCrown(delta:)](xcuiautomation/xcuidevice/rotatedigitalcrown(delta:).md)
- [rotateDigitalCrown(delta:velocity:)](xcuiautomation/xcuidevice/rotatedigitalcrown(delta:velocity:).md)
