appium / appium-uiautomator2-driver

Appium driver for Android UIAutomator2
Apache License 2.0
607 stars 177 forks source link

Unknown mobile command "setGeolocation" #834

Open ErodriguezQA opened 3 weeks ago

ErodriguezQA commented 3 weeks ago

I think that the mobile: setGeolocation is not available on the last stable version of UIAutomator2 since I get the following error:

WebDriverError: Unknown mobile command "setGeolocation". Only shell,execEmuConsoleCommand,startLogsBroadcast,stopLogsBroadcast,changePermissions,getPermissions,performEditorAction,getDeviceTime,startScreenStreaming,stopScreenStreaming,getNotifications,listSms,pushFile,pullFile,pullFolder,deleteFile,isAppInstalled,queryAppState,activateApp,removeApp,terminateApp,installApp,clearApp,startService,stopService,startActivity,broadcast,getContexts,lock,unlock,isLocked,refreshGpsCache,startMediaProjectionRecording,isMediaProjectionRecordingRunning,stopMediaProjectionRecording,getConnectivity,setConnectivity,hideKeyboard,isKeyboardShown,deviceidle,bluetooth,nfc,setUiMode,getUiMode,injectEmulatorCameraImage,sendTrimMemory,getPerformanceData,getPerformanceDataTypes,toggleGps,isGpsEnabled,getDisplayDensity,getSystemBars,statusBar,fingerprint,sendSms,gsmCall,gsmSignal,gsmVoice,powerAc,powerCapacity,networkSpeed,sensorSet,getCurrentActivity,getCurrentPackage,dragGesture,flingGesture,doubleClickGesture,clickGesture,longClickGesture,pinchCloseGesture,pinchOpenGesture,swipeGesture,scrollGesture,scrollBackTo,scroll,viewportScreenshot,viewportRect,deepLink,acceptAlert,dismissAlert,batteryInfo,deviceInfo,openNotifications,type,replaceElementValue,getAppStrings,installMultipleApks,backgroundApp,pressKey,screenshots,scheduleAction,getActionHistory,unscheduleAction,setClipboard,getClipboard commands are supported. when running "execute/sync" with method "POST" and args "mobile: setGeolocation"

Im using Appium through the last version available of WebdriverIO. Appium version: 2.12.2 UIAutomator2 version: 3.8.0

The way I use said command is through the following method:

async setPosition(latitude, longitude, altitude){
    await driver.executeScript('mobile: setGeolocation',[{latitude,longitude,altitude}]);
}
mykola-mokhnach commented 3 weeks ago

Please provide the full server log. Most likely your driver is out of date