简体   繁体   中英

Appium Android test - location problems

I want to test an android app with appium. The app is using Google Maps to show the current location. It's important for the app, that it starts directly at a certain location, otherwise it blocks and gives a message, that the app isn't available at the current location.

Even if I set the location with Appium directly after starting the app, the app blocks as I explained previously. The location is set properly in the current location, but I guess the Google Maps cache is resetted (or something like that) and it starts at a wrong location.

When I test the app manually in the same emulator, I can open the app and it works without problems. The Google Maps shows directly the location that I set. This problem only occurs when the app is started with Appium.

Any ideas? Thank you very much!

Without Appium server logs it is unclear if service succeed to change location. Make sure you are setting location correctly :

driver.setLocation(location);

where location is instance of Location (double latitude, double longitude, double altitude)

In addition, you may try to toggle location on/off before actually setting value:

driver.toggleLocationServices();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM