Skip to content

Commit 4623e11

Browse files
authored
fix: Set correct geolocation coordinates of the current device (#2109)
1 parent d90df88 commit 4623e11

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/main/java/io/appium/java_client/remote/SupportsLocation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,6 @@ default void setLocation(io.appium.java_client.Location location) {
9090
locationParameters.put("latitude", location.getLatitude());
9191
locationParameters.put("longitude", location.getLongitude());
9292
Optional.ofNullable(location.getAltitude()).ifPresent(altitude -> locationParameters.put("altitude", altitude));
93-
execute(MobileCommand.SET_LOCATION, Map.of("location", locationParameters));
93+
execute(MobileCommand.SET_LOCATION, Map.of("location", locationParameters.build()));
9494
}
9595
}

src/test/java/io/appium/java_client/android/AndroidDriverTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616

1717
package io.appium.java_client.android;
1818

19+
import io.appium.java_client.Location;
1920
import io.appium.java_client.appmanagement.ApplicationState;
2021
import org.apache.commons.io.FileUtils;
2122
import org.hamcrest.Matchers;
2223
import org.junit.jupiter.api.Test;
2324
import org.openqa.selenium.ScreenOrientation;
24-
import org.openqa.selenium.html5.Location;
2525

2626
import java.io.File;
2727
import java.time.Duration;
@@ -192,7 +192,7 @@ public void toggleLocationServicesTest() {
192192

193193
@Test
194194
public void geolocationTest() {
195-
Location location = new Location(45, 45, 100);
195+
Location location = new Location(45, 45, 100.0);
196196
driver.setLocation(location);
197197
}
198198

src/test/java/io/appium/java_client/ios/IOSDriverTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616

1717
package io.appium.java_client.ios;
1818

19+
import io.appium.java_client.Location;
1920
import io.appium.java_client.appmanagement.ApplicationState;
2021
import org.junit.jupiter.api.BeforeEach;
2122
import org.junit.jupiter.api.Disabled;
2223
import org.junit.jupiter.api.Test;
2324
import org.openqa.selenium.By;
2425
import org.openqa.selenium.ScreenOrientation;
2526
import org.openqa.selenium.WebElement;
26-
import org.openqa.selenium.html5.Location;
2727
import org.openqa.selenium.remote.RemoteWebElement;
2828
import org.openqa.selenium.remote.Response;
2929
import org.openqa.selenium.remote.http.HttpMethod;
@@ -88,7 +88,7 @@ public void getDeviceTimeTest() {
8888

8989
@Disabled
9090
@Test public void geolocationTest() {
91-
Location location = new Location(45, 45, 100);
91+
Location location = new Location(45, 45, 100.0);
9292
try {
9393
driver.setLocation(location);
9494
} catch (Exception e) {

0 commit comments

Comments
 (0)