Created
January 17, 2022 10:06
-
-
Save PramodKumarYadav/2e4795b20a75dc3f4c3994cbfdb4c756 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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