Need to allow geolocation in chrome and firefox (running in browserstack)

253 views
Skip to first unread message

Jose Sanchez

unread,
Nov 7, 2018, 10:04:01 AM11/7/18
to NightwatchJs
So I have this case where I need to test a geolocation service and I need to give browser permission to access to my location, when I run the tests a popup or notification shows up. I need to set geo location permission to enabled or something. How can I do this? (beware I need to test this in chrome and firefox running in browserstack)

Thanks

Simon Correia

unread,
Nov 8, 2018, 12:22:45 AM11/8/18
to nightw...@googlegroups.com
Hi,

If you get a pop up everytime you run the tests, just add .acceptAlert() when the pop up appears. This applies only if there is a pop up with Yes and No OR Ok and Cancel OR Accept and Decline etc buttons on it.
You can find the method here - http://nightwatchjs.org/api#acceptAlert

Thanks & Regards,

Simon


On Wed, Nov 7, 2018 at 8:34 PM Jose Sanchez <jose.s...@insendi.com> wrote:
So I have this case where I need to test a geolocation service and I need to give browser permission to access to my location, when I run the tests a popup or notification shows up. I need to set geo location permission to enabled or something. How can I do this? (beware I need to test this in chrome and firefox running in browserstack)

Thanks

--
You received this message because you are subscribed to the Google Groups "NightwatchJs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nightwatchjs...@googlegroups.com.
To post to this group, send email to nightw...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nightwatchjs/8838045c-9ce6-4f06-ba8c-6c44b63a1c31%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jose Sanchez

unread,
Nov 8, 2018, 5:24:56 AM11/8/18
to NightwatchJs
Thanks for your answer Simon, but that doesn't work because is a pop from the browser and not from the website. 

A screenshot here:

popup.png

Simon Correia

unread,
Nov 8, 2018, 5:37:55 AM11/8/18
to nightw...@googlegroups.com
Yes it should work.
I tried the same site just to check but i did not get the pop up while the test ran. The geo location was automatically enabled and it displayed my current location.
Whereas if i manually navigate to the site on another chrome browser window i get the popup. Weird.
May be selenium auto handles it.

Thanks & Regards,

Simon


Jose Sanchez

unread,
Nov 8, 2018, 5:41:26 AM11/8/18
to NightwatchJs
Well, my selenium doesn't handle it then. I need a way to tell selenium to handle but for now I don't know how.
Reply all
Reply to author
Forward
0 new messages