1

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?

Marco
  • 550
  • 2
  • 6
  • 22
Max Golden
  • 11
  • 3
  • @Marco Danke fur deinen Edit, ich wuste nicht das es "geolocation API" heisst, hast du eine idee wie man das macht? Ich habe schon sehr viel online gekuken und nix gefunden.. – Max Golden Jul 31 '19 at 14:54
  • No I am sorry. I don't know the answer but I can confirm that googling for a solution did not work for me either :) The up vote is mine as I am interested in the solution as well. However you can read more about your browsers geolocation API [here](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API). – Marco Jul 31 '19 at 15:01

1 Answers1

0

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.

Marco
  • 550
  • 2
  • 6
  • 22
  • Marco, thank you for your effort, but I am not trying to change my location using proxy, I am trying to give permission to the browser to access my location.. allow access the popup – Max Golden Aug 02 '19 at 12:09
  • Then I am afraid, the functions SlimerJS currently exposes to control your browser are too limited to achieve such behavior. SlimerJS mainly works through injecting JS into the webpage under test, if you are not willing to do that you should probably go away from SlimerJS towards a framework that gives you more control over the browser implementation. [Selenium](https://www.seleniumhq.org/) would be a good candidate. – Marco Aug 02 '19 at 14:38
  • Yes I think you are right Marco, Selenium or maybe CEFSharp? https://cefsharp.github.io/ I never used Selenium and I need to learn from scratch how to use it.. – Max Golden Aug 02 '19 at 23:38
  • check this out: https://stackoverflow.com/questions/16292634/always-allow-geolocation-in-firefox-using-selenium/21144965#21144965 – Max Golden Aug 05 '19 at 10:56