Skip to content

Instantly share code, notes, and snippets.

@PramodKumarYadav
Created January 17, 2022 10:06
Show Gist options
  • Save PramodKumarYadav/2e4795b20a75dc3f4c3994cbfdb4c756 to your computer and use it in GitHub Desktop.
Save PramodKumarYadav/2e4795b20a75dc3f4c3994cbfdb4c756 to your computer and use it in GitHub Desktop.
package org.powertester.hulk.actions.session;
import io.appium.java_client.AppiumDriver;
import org.openqa.selenium.html5.Location;
public class GeoLocation {
AppiumDriver driver;
public GeoLocation(AppiumDriver driver) {
this.driver = driver;
}
public Location getGeoLocation() {
return driver.location();
}
// convenience method
public void setGeoLocation(double latitude, double longitude) {
setGeoLocation(latitude, longitude, 1.0);
}
/**
* Must be a driver that implements LocationContext
*/
public void setGeoLocation(double latitude, double longitude, double altitude) {
driver.setLocation(new Location(latitude, longitude, altitude));
try {
Thread.sleep(6000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment