New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for geolocation mock? #1077
Comments
Since you're passing a |
@dickeylth @ebidel
how do you update chrome location? by javascript code or by yourself operation? |
You can't modify devtools settings by running code in the console. That
would be a huge security concern. You could try using the raw devtools
protocol for overriding geolocation settings. Just note that puppeteer
doesn't expose a way to access the raw devtools protocol, so that's harder
to do than it should be.
devtools-protocol/tot/Emulation/#method-setGeolocationOverride
…On Mon, Oct 23, 2017, 3:01 AM LeoXu ***@***.***> wrote:
navigator.geolocation.getCurrentPosition = function(success, failure) {
success({ coords: {
latitude: 31.230416,
longitude: 121.473701
}, timestamp: Date.now() });
}
maybe i can use this function to change my geolocation, but how could i
enable Geolocation from "No override" to "Custom location" with js code on
console?
[image: 1508752797]
<https://user-images.githubusercontent.com/13128637/31883359-3783da84-b81c-11e7-9be4-afa2d2772879.png>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1077 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAOigPHe-IANDG4ywHiHBHSzBfzPIVosks5svGQIgaJpZM4P9Gj5>
.
|
This should be easy to implement using the Emulation.setGeolocationOverride method. I'd be happy to review a PR. |
how do you override the geolocation settings? @ebidel |
We need to add that feature. What @aslushnikov suggested :) |
Is anyone working on a fix for this? If not, I'd like to try implementing it! |
@slohmes don't think so. Feel free to send a PR with what was suggested in #1077 (comment). |
@ebidel any updates on this ? |
We haven't prioritized this but would be willing to accept a PR. As mentioned you can also use the devtools protocol apis to override the settings. |
Didn't see that. Seems like we need permission dialog support in puppeteer in order for that PR to work: #1297 (comment). You can send raw protocol methods with: |
@ebidel Thanks a lot 👍 let me try |
@ebidel i tried and the location still set to my current location
I was expecting the maps to point to the lat n long given. |
Support for Mobile deviceOrientation mock? |
Steps to reproduce
Tell us about your environment:
What steps will reproduce the problem?
Please include code that reproduces the issue.
What is the expected result?
The Geolocation preset config is saved to user-dir, and next time chromium should use the settings here to enable geolocation mock.
What happens instead?
The settings in devtools/sensors were not persistent, next time the code runs the geolocation settings were reset, which made the code in the page request geolocation failed.
Or is there any way to set the geolocation mock by
args
param when chromium launch?The text was updated successfully, but these errors were encountered: