Set Geo Location on Google map by passing latitute and longitude in Appium

I have to set Geo location by passing lat and long . But Google map automatically setting current location when app started. I have to pass lat and long and set the GPS location according to lat and long in Appium

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

Below is the code I have written correct me if I am wrong

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”);

//It will launch the Calculator App in Android Device using the configurations specified in Desired Capabilities
//driver = new RemoteWebDriver(new URL(“http://127.0.0.1:4723/wd/hub“), capabilities);

AppiumDriver driver = new AndroidDriver(new URL(“http://127.0.0.1:4723/wd/hub“), capabilities);
// WebDriver driver = new AndroidDriver(new URL(“http://127.0.0.1:4723/wd/hub”),getDesiredCapabilities(“192.21.168.56:5555“));
Location location = new Location(77.59974003, 12.91024781, 909);
driver.setLocation(location);
driver.manage().timeouts().implicitlyWait(200, TimeUnit.SECONDS);
//driver.manage().timeouts().implicitlyWait(100, TimeUnit.SECONDS);

}

@Test
public void testCal() throws Exception {
Some test here

}

@AfterClass
public void teardown(){
//close the app
driver.quit();
}
}

Default Asked on December 26, 2016 in Appium.
Add Comment
  • 0 Answer(s)
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.