Unable to install the app and launch the browser one after other on iOS simulator

Hello,
I am fairly new to Appium world.
I want to install an app on iOS simulator and after it is done, Safari should be launched.
However, I am not getting how to achieve this.
I tried multiple ways, but no success.

Way1 i tried: Setting Browser and App capabilities before initiating the driver.
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability(“platformName”, “iOS”);
caps.setCapability(“platformVersion”, “9.3”);
caps.setCapability(“deviceName”, “iPhone 6”);
File app = new File ("/Users/admin/Documents/TestApp.app");
caps.setCapability(“app”, app.getAbsolutePath());
caps.setCapability(CapabilityType.BROWSER_NAME, “safari”);
iosd = new IOSDriver(new URL(“http://127.0.0.1:4723/wd/hub”), caps);

App was not installed in this case.
Way2 :
Tried to install the app using following code:
String[] cmd = {“xcrun”, “simctl”, “install”, “iPhone 6”, “/Users/admin/Documents/TestApp.app”};

	System.out.println(cmd.toString());

	try

	{

	Runtime.getRuntime().exec(cmd);

	}

	catch (Exception e)

	{

		System.out.println(e.getMessage());

		System.out.println(e.getStackTrace());

	}

	System.out.println("Deployed");

And then
driver.get(“http://localhost/test”);

BROWSER capability was set in driver object in this case.
This approach dint work as well. I got my session terminated somehow.

I am using Appium 1.5.3 + Java + iOS simulator.

Hi Amit,

please check the url in appium setteings.
new URL(“http://127.0.0.1:4723/wd/hub”)

Hi Narendar,
Could you please elaborate?

Hi Amit,

launch the appium and go to setting and check there the url and port.

url will be:0.0.0.0