Quaatso Education

Home Forums Appium Forum Set GPS location on google map by passing latitude and longitude

Set GPS location on google map by passing latitude and longitude

Tagged: ,

This topic contains 0 replies, has 1 voice, and was last updated by Profile photo of Premprakash Premprakash 6 months ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #4853
    Profile photo of Premprakash
    Premprakash
    Participant

    I am trying to set GPS location on google map by passing latitude and longitude. But it is taking my current location. My code for Appium is below which is not setting GPS location which I passed. If it is not implemented, then please implement it.

     

    Below code showing error FAILED CONFIGURATION: @BeforeClass setUp org.openqa.selenium.WebDriverException: ERROR running Appium command: port should be string=false

     

     

    CODE:
    <h2>package Test; import io.appium.java_client.AppiumDriver; import io.appium.java_client.android.AndroidDriver; import java.net.MalformedURLException; import java.net.URL; import java.util.Set; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.html5.Location; //import org.openqa.selenium.remote.CapabilityType; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.remote.RemoteWebDriver; import org.testng.annotations.*; public class FullHouse { WebDriver driver; @BeforeClass public void setUp() throws MalformedURLException { //Set up desired capabilities and pass the Android app-activity and app-package to Appium DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability(“BROWSER_NAME”, “”); capabilities.setCapability(“platformName”, “Android”); capabilities.setCapability(“deviceName”, “emulator-5554”); capabilities.setCapability(“platformVersion”, “5.1”); // capabilities.setCapability(“autoWebview”,”true”); //capabilities.setCapability(“automationName”,”selendroid”); // capabilities.setCapability(“newCommandTimeout”, “180”); capabilities.setCapability(“appPackage”, “com.google.android.apps.maps”); capabilities.setCapability(“appActivity”, “com.google.android.maps.MapsActivity”); AppiumDriver driver = new AndroidDriver(new URL(“http://127.0.0.1:4723/wd/hub“), capabilities); Location location = new Location(77.59974003, 12.91024781, 909); driver.setLocation(location); driver.manage().timeouts().implicitlyWait(200, TimeUnit.SECONDS); } @Test public void testCal() throws Exception { Some Test here } @AfterClass public void teardown() { //close the app driver.quit(); ` } }</h2>

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.