Java Client 1.6 Troubleshooting setLocation()

On Thu, Aug 28, 2014 at 4:29 PM, Jonah Stiennon [email protected] wrote:
I’ll take a look at this right now!

In the meantime, can you repost this to our New Forum at discuss.appium.io ? Thanks.

On Thursday, August 28, 2014 2:25:26 PM UTC-7, Ben Boral wrote:
Hi Jonah,

Have you been able to use setLocation() successfully?

I’m attempting to use it with the extremely simple case:

Location location = new Location(1, 1, 1);
appiumDriver.setLocation(location);

This yields an error related how location is specified. See below from Appium logs. Any help with this, such as sample code snippet, would be much appreciated.

info: <-- POST /wd/hub/session/603244c1-ff73-4227-9cb7-af07f0a94c19/location 500 151.991 ms - 193

debug: Socket data being routed.

debug: Got result from instruments: {“status”:17,“value”:“location not specified correctly”}

debug: Responding to client with error: {“status”:17,“value”:{“message”:“An error occurred while executing user supplied JavaScript.”,“origValue”:“location not specified correctly”},“sessionId”:“603244c1-ff73-4227-9cb7-af07f0a94c19”}

debug: [INST] 2014-08-28 20:42:37 +0000 Error: Error during eval: setLocationWithOptions@[native code]

   eval code 

eval@[native code]

startProcessing@file://localhost/Applications/Appium.app/Contents/Resources/node_modules/appium/0977A26B-81A8-44C8-B350-AF7A8C00E4CE/commands.js:120:30

bootstrap@file://localhost/Applications/Appium.app/Contents/Resources/node_modules/appium/BB489BDA-8783-44B4-8327-5217ED01E91C/bootstrap.js:18:29

global code@file://localhost/Applications/Appium.app/Contents/Resources/node_modules/appium/9D200DD6-D975-4964-8CC4-4D56440CB0D8/bootstrap-fe8fa37a970f98cc.js:9:10

debug: [INST] 2014-08-28 20:42:37 +0000 Debug: Running system command #52: /Applications/Appium.app/Contents/Resources/node/bin/node /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{“status”:17,“value”:“location not specified correctly”}…

Thanks,
Ben

Welcome to the new forum :smile:

Can you also add a tag for the version of Appium Server you are running? I’m assuming v1.2.2

So I ran the same code:

Location location = new Location(1,1,1);
driver.setLocation(location);

And my logs looked like this:

info: --> POST /wd/hub/session/61fc55c2-25d9-4b99-a11a-a19df6d79aee/location {"location:{"altitude":1,"class":"org.openqa.selenium.html5.Location","longitude":1,"latitude":1,"hCode":1369576173}}
info: [debug] Pushing command to appium work queue: "target.setLocationWithOptions({\"latitude\":1,\"longitude\":1},{\"altitude\":1})"
info: [debug] Sending command to instruments: target.setLocationWithOptions({"latitude":1,"longitude":1},{"altitude":1})
info: [debug] Sending command to instruments: target.setLocationWithOptions({"latitude":1,"longitude":1},{"altitude":1})
info: [debug] [INST] 2014-08-28 21:36:36 +0000 Debug: Got new command 2 from instruments: target.setLocationWithOptions({"latitude":1,"longitude":1},{"altitude":1})

info: [debug] [INST] 2014-08-28 21:36:36 +0000 Debug: evaluating target.setLocationWithOptions({"latitude":1,"longitude":1},{"altitude":1})

info: [debug] [INST] 2014-08-28 21:36:36 +0000 Debug: target.setLocationWithOptions({longitude:"1", latitude:"1"}, {altitude:"1"})
       2014-08-28 21:36:36 +0000 Debug: evaluation finished
2014-08-28 21:36:36 +0000 Debug: responding with:
2014-08-28 21:36:36 +0000 Debug: Running system command #3: /usr/local/bin/node /Users/jonahss/Workspace/appium/submodules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{"status":0,"value":true}...

info: [debug] Socket data received (27 bytes)
info: [debug] Socket data being routed.
info: [debug] Got result from instruments: {"status":0,"value":true}
info: [debug] Responding to client with success: {"status":0,"value":true,"sessionId":"61fc55c2-25d9-4b99-a11a-a19df6d79aee"}
info: <-- POST /wd/hub/session/61fc55c2-25d9-4b99-a11a-a19df6d79aee/location 200 113.174 ms - 76 {"status":0,"value":true,"sessionId":"61fc55c2-25d9-4b99-a11a-a19df6d79aee"}

============
It would be good to see in the logs what arguments get passed to appium with your /location request.

Thanks Jonah,

I was running 1.2, and after upgrading to 1.2.2, the location command works. Thanks!

Unfortunately, I was running 1.2 because 1.2.1 and 1.2.2 consistently crash every time I use the inspector. Anyway, that is a topic for another thread, and my problem is resolved here. Thanks.

1 Like