Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Clients can set any coordinates for the simulated location. #274

Merged
merged 1 commit into from

2 participants

Graham Lee mmmulani
Graham Lee
Owner

The method previously ignored client input and hard-coded the location. Now it uses the "latitude" and "longitude" keys in the request payload.

mmmulani mmmulani merged commit 96e1d99 into from
Graham Lee iamleeg deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 22, 2014
This page is out of date. Refresh to see the latest.
12 server/src/main/java/org/uiautomation/ios/command/uiautomation/SetLocationNHandler.java
View
@@ -16,6 +16,7 @@
import org.json.JSONException;
import org.json.JSONObject;
+import org.openqa.selenium.WebDriverException;
import org.uiautomation.ios.communication.WebDriverLikeRequest;
import org.uiautomation.ios.IOSServerManager;
import org.uiautomation.ios.command.UIAScriptHandler;
@@ -31,9 +32,18 @@
public SetLocationNHandler(IOSServerManager driver, WebDriverLikeRequest request) {
super(driver, request);
JSONObject payload = request.getPayload();
+ String latitude;
+ String longitude;
+ try {
+ latitude = String.valueOf(payload.getDouble("latitude"));
+ longitude = String.valueOf(payload.getDouble("longitude"));
+ }
+ catch (JSONException e) {
+ throw new WebDriverException("error parsing request " + request + "\n" + e.getMessage(), e);
+ }
String js = template.generate(
request.getSession(),
- "{'latitude': 45 ,'longitude': 45 }");
+ "{'latitude': " + latitude + " ,'longitude': " + longitude + " }");
setJS(js);
}
Something went wrong with that request. Please try again.