<!--
{
  "availability" : [
    "Xcode: 16.3.0 -",
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "XCUIAutomation",
  "identifier" : "/documentation/XCUIAutomation/XCUIDevice/hasHardwareButton(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "XCUIAutomation"
    ],
    "preciseIdentifier" : "c:objc(cs)XCUIDevice(im)hasHardwareButton:"
  },
  "title" : "hasHardwareButton(_:)"
}
-->

# hasHardwareButton(_:)

Determines whether the device supports the button type you provide.

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

## Parameters

`button`

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

## Return Value

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

## Discussion

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

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)