w3c / w3c/webdriver

A means to emit geolocation positions

Open
#1,700 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
718
Forks
228
PR merge metrics
No merged PRs in 30d

Description

It would be great if Web Driver provided a means for a user agent to emit a Geolocation coordinates. These would be picked up by the Geolocation API's requestPosition() and watchPosition() methods.

This would be beneficial to both web developers and implementers.

The straw person is to allow developers to pass an JSON object with a shape that matches GeolocationCoordinates.

Then the UA can just echo that as a real GeolocationCoordinates object.

On WPT, at least, (and yes, I'm aware test_driver is not part of this spec.. just showing it as a use case) I'm imagining something like:

await test_driver.set_permission({"name": "geolocation"}, "granted");
const positionPromise = new Promise((res, rej) => navigator.geolocation.getCurrentPosition(res, rej));
await test_driver.emit_geo_position({ latitude: -37, longitude: 100 });
const position = await positionPromise; 

Similarly, with watchPosition(), one would get the 3 positions:

navigator.geolocation.watchPosition(console.log);
await test_driver.emit_geo_position({ latitude: 37, longitude: 100 });
await test_driver.emit_geo_position({ latitude: 36, longitude: 100 });
await test_driver.emit_geo_position({ latitude: 35, longitude: 100 });

Thoughts?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the WebDriver issue's proposed JSON shape and the example calls to test_driver.emit_geo_position, alongside the Geolocation API methods named there. Compare the desired behavior for getCurrentPosition() and watchPosition(), then determine the specification changes and tests needed to demonstrate that supplied positions are delivered to both callbacks.

Written by the indexing model from the issue text.

Assessment

Tech stack
html, javascript
Domain
api, testing-qa, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.