How can i execute code depending of an event on InAppBrowser's Window?

I’m trying to create a webview and do a programaticall login filling some fields in a login and doing click (the webpage it’s in a host of my propertie).

I’m looking into documentation and i don’t know how call the methods on the events listeners, always i’m receiving errors.

Could someone explain me some methods of this plugins? Because for example in the docs of the plugin you can do addEventListener, but this doesn’t work at all.

I’m trying to detect a click in al element to close the inappbrowser’s window… How could achieve that?

I try this to communicate with my window, but doesn’t works

    this.browser = this.iab.create(this.url, '_self', 'location=no,hidden=yes,hardwareback=no',);;
      this.browser.executeScript("alert('Alert sucess');");


UPDATE: I achieve this first problem doing this:

    this.browser = this.iab.create(this.url, '_self', 'location=true');
      console.log('load start');