简体   繁体   中英

How to allow access to the browsers geolocation API using slimerJS?

I am trying to access a website using SlimerJS. On the website you can not proceed without allowing access to the browsers geolocation API. Its the popup that appears when to click allow.

Is there any way to allow and provide a geolocation to this website using SlimerJS?

It seems like you can't just tell the browser to send a specific position. But the code of your webpage under test uses the window.navigator object to get the location. So if you manage to somehow change or fake window.navigator.geolocation your problem should be solved.

Check this answer where Artjom points out on how to use casper.js to proxy the window.navigator.appName object. It should be possible to adapt that to your problem with the window.navigator.geolocation object.

Also this issue might be of your interest.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM