Simulate iBeacon proximity events in your iOS app without physical beacon hardware.
Use device.injectBeacon() to simulate the device detecting a nearby iBeacon, triggering CLLocationManager callbacks in your app as if real hardware were present. Pushing a .region file triggers a region-entry callback; also pushing a .beacon file triggers ranging callbacks.See the iOS Device Controls for the full injectBeacon API.
const cleanup = await device.injectBeacon(driver, "com.example.app", { uuid: "8613BEAD-5465-4515-8F9C-AEEA717484C9", beacons: [{ major: 1, minor: 7 }],});// assert your app responded to the beacon eventawait cleanup();
Region entry only (no ranging)Omit the beacons array to trigger only a region-entry event.
const cleanup = await device.injectBeacon(driver, "com.example.app", { uuid: "e62c96fd-014a-454f-9b41-32245d802bb3",});// assert your app responded to the region entryawait cleanup();
iBeacons require location permissions. Two important caveats:autoAcceptAlerts chooses “Ask Next Time” for location dialogs. If the permission dialog appears, Appium will not choose “Always Allow” — and there is no way to change it after the fact.Background location access cannot be auto-accepted. If your app requires “Change to Always Allow” for background beacon detection, you must handle the dialog manually using respectSystemAlerts: true: