# Simulate a Tap Event for Functional Tests

**URL:** <https://forum.ionicframework.com/t/simulate-a-tap-event-for-functional-tests/133085>\
**Category:** Ionic Native\
**Created:** [June 18, 2018, 2:12pm UTC](https://forum.ionicframework.com/t/simulate-a-tap-event-for-functional-tests/133085 "2018-06-18T14:12:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JoeOSMG](https://avatars.discourse-cdn.com/v4/letter/j/848f3c/32.png) [@JoeOSMG](https://forum.ionicframework.com/u/JoeOSMG)\
**Post date:** [June 18, 2018, 2:12pm UTC](https://forum.ionicframework.com/t/simulate-a-tap-event-for-functional-tests/133085/1 "2018-06-18T14:12:54Z")

</div>

We’d like to simulate a button `tap` event in order to run functional tests in an Ionic/Cordova app. It appears `click` events work on the buttons, but when the event is triggered by a `tap` (which we consider better UX), we’re unable to simulate the event with our test code.

Here’s our Ionic button:

```auto
<button id="loginBtn" ion-button block (tap)="login()">LOGIN</button>

```

Here’s how we trigger `click` events:

```auto
document.getElementById('loginBtn').click();

```

How can we do this for Ionic tap events?

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2021, 9:32pm UTC](https://forum.ionicframework.com/t/simulate-a-tap-event-for-functional-tests/133085/2 "2021-07-19T21:32:03Z")

</div>

Closed on July 19, 2021, 9:32pm UTC


