Skip to content
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

Handle geolocation on iOS 15.5 #2526

Open
simoDama opened this issue Feb 19, 2025 · 3 comments
Open

Handle geolocation on iOS 15.5 #2526

simoDama opened this issue Feb 19, 2025 · 3 comments

Comments

@simoDama
Copy link

I have installed the Appium XCUItest driver version 8.3.1.
I need to set the geolocation for an Appium test on an iOS 15.5 emulator. However, when I attempt to use the setSimulatedLocation method on this device, I receive the following error:
Your device does not support location simulation" UserInfo={NSLocalizedDescription=Your device does not support location simulation} when running "execute/sync" with method "POST" and args "mobile: setSimulatedLocation"

On another emulator with iOS 18.0, I can set the geolocation using this method from XCUItest:

mobile: setSimulatedLocation
This method sets the simulated geolocation value, but it is only available starting with XCUItest driver version 4.18. Additionally, Xcode must be at version 14.3 or later, and iOS must be at version 16.4 or later.
For iOS 17+ real devices, it is recommended to simulate the device's location.

How can I handle geolocation on an iOS device with a version earlier than 16.4?

@KazuCocoa
Copy link
Member

Set location endpoint such as driver.location = ::Appium::Location.new(10, 10, 10) (in ruby) might work.

async setGeoLocation(location) {

@simoDama
Copy link
Author

In TypeScript, I don't have this method. To use seGeoLocation, I use...

 await driver.executeScript('mobile:  setSimulatedLocation', [{
      latitude: latitude,
      longitude: longitude
    }]);

But this on iOS 15.5 doesn't work

@KazuCocoa
Copy link
Member

You could define a command with https://webdriver.io/docs/api/browser/addCommand to call https://github.com/appium/appium/blob/master/packages/base-driver/lib/protocol/routes.js#L319-L322 endpoint if you used webdriverio. It is not in W3C WebDriver, so such a 3rd party client removed or doesn't have it today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants