Hi Martin, You might need to access the wrapped window object when sending an event like that: `window.wrappedJSObject.dispatchEvent(event)`
But more generally, for UI tests I think best approach is to mimic the user as much as possible. So for this case, have you tried waiting for the geolocation permission prompt to show up, then clicking the "allow" button, and then continuing with your test? -M On Mon, Oct 19, 2015 at 11:08 AM, Martijn <[email protected]> wrote: > I was working on a Gaia UI test script that would automatically grant > geolocation to https://maps.google.com when visiting from a browser. > > This is what I used: > " > var detail = {'type': 'geolocation', 'permissions': [], > 'origin': 'test', 'isApp': false, 'remember': true, > 'id': 'perm1' }; > var response = { > 'id': 'perm1', > 'permissions': ['geolocation'], > 'isApp': false, > 'type': 'permission-allow', > 'remember': true, > 'isGranted': true, > 'manifestURL': '', > 'origin': "https://maps.google.com" > }; > > var event = document.createEvent('CustomEvent'); > event.initCustomEvent('mozContentEvent', true, true, {detail: > response}); > window.dispatchEvent(event); > " > > I ran this from the system app, it didn't work at all. > > What am I doing wrong here? > > Regards, > Martijn > > _______________________________________________ > dev-fxos mailing list > [email protected] > https://lists.mozilla.org/listinfo/dev-fxos > >
_______________________________________________ dev-fxos mailing list [email protected] https://lists.mozilla.org/listinfo/dev-fxos

