TestProject Forum

iOS. Mock location doesn't seem to work [OPEN]

Hi, I need to test my app in different countries. For that, I am trying to use “Set mock location” action.
In Android, it works fine (actually I see changes after I re-start app but it is ok)
in iOS, I am not able to change the location at all.
I am using 2 iPhones, 7 and 11 with iOS 14 on both.

Does this feature work for you?
Do you have some advice on how to use the “Set mock location” action?

Here is just an example of how do I use action:

Thanks for any help

Hello,
Set mock location is only supported on Android and on IOS simulators, please try to use an IOS simulators,

as mocking the real devices location doesn’t work in selenium.
Another option is to change the app behavior as described here:

Hi Amit, We tried to use the mock location add-on with the xcode iOS simulator. But no success. We were able to change the location though on x-code simulator manually using their “mock location” feature. But in our test we need to change the location several times, so we want to change location within the test itself with that add-on.

Can you please let us know how we can make it work? (It works fine with Android)

Hi,
There is indeed an issue with mocking IOS simulator location which should get resolved on the next agent version. I will let you know here once it’s released. (ticket - 15768), the root cause of the issue is in Appium and on the next version a newer Appium (1.21.0) should be supported which should allow you set mock location on IOS simulators.

1 Like