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

# press(_:)

Simulates the user pressing a physical button.

## Declaration

```swift
func press(_ button: XCUIDevice.Button)
```

## Parameters

- `button`: The button to press on the device.

## See Also

### Interacting with buttons and the Digital Crown

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