Cannot invoke Safari Browser in ios 10 with Appium 1.6.2

I am trying to automate script with Safari Browser in iOS 10.0.2 real device. I am using Appium 1.6.2 and OS X El Captain 10.11.6.
When i invoke the execution i can see WebDriverAgentRunner installed in the device but i cannot see Safari Launcher or Safari Browser being invoked. I have installed all the dependency modules and added required desired capabilities while creating driver.
Desired Capabilities are as given below,
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, );
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME,“ios”);
capabilities.setCapability(“automationName”, “XCUITest”);
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION,“10.0.2”);
capabilities.setCapability(“app”, “io.appium.SafariLauncher”);
capabilities.setCapability(“realDeviceLogger”, " “/usr/local/lib/node_modules/appium/node_modules/deviceconsole/deviceconsole”);
capabilities.setCapability(“udid”, );

In the Appium logs i can see,

[XCUITest] Waiting for WebDriverAgent to start on device
[debug] [XCUITest] Log file for xcodebuild test: /Users/siriusit/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Logs/Test/3B17BE28-4F38-4BF3-AD58-48D73EFD39E3/Session-WebDriverAgentRunner-2016-12-09_025129-beDmyn.log
[debug] [WebDriverAgent] Device: Dec 9 02:51:35 Phone XCTRunner[250] : Running tests…
[debug] [WebDriverAgent] Device: Dec 9 02:51:36 Phone XCTRunner[250] : Continuing to run tests in the background with task ID 1
[debug] [XCUITest] Waiting for WebDriverAgent server to finish loading…

Safari works fine when launched through Similator. But in real device it doesnt work.
Any idea what might be the problem?

Are you setting the Bundle ID? It is required for tests on real device.

Also, have you tried this? It’s for an older version but could still be applicable.

Yes I have done that. I am able to invoke safari launcher in the device directly from the xcode but not through appium.

Try to add Browser_name capability and remove “app” capability. Example below

capabilitiesForAppium.setCapability(MobileCapabilityType.BROWSER_NAME,
“safari”);

Done. Still no luck. I can see the WebDriverAgentRunner open to display a blank black screen and close very quickly. No errors in log.
[debug] [XCUITest] Waiting for WebDriverAgent server to finish loading… keeps repeating every 2 minutes in the log.

Have you code-signed the WDA? If not, try including:

capabilities.SetCapability(“xcodeConfigFile”, "/path/to/file.xcconfig); // This config file manages the code signing for WebDriverAgent

The .xcconfig file should contain the following:

DEVELOPMENT_TEAM = [TeamID]
CODE_SIGN_IDENTITY = iPhone Developer

Your team ID can be found here after logging in.

Can you share appium logs…

Blinkk,
Yes I have code signed. I used xcode to sign it.

Sireesha,

[XCUITest] Waiting for WebDriverAgent to start on device
[debug] [XCUITest] Log file for xcodebuild test: /Users/siriusit/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Logs/Test/3B17BE28-4F38-4BF3-AD58-48D73EFD39E3/Session-WebDriverAgentRunner-2016-12-09_025129-beDmyn.log
[debug] [WebDriverAgent] Device: Dec 9 02:51:35 Phone XCTRunner[250] : Running tests…
[debug] [WebDriverAgent] Device: Dec 9 02:51:36 Phone XCTRunner[250] : Continuing to run tests in the background with task ID 1
[debug] [XCUITest] Waiting for WebDriverAgent server to finish loading…
[debug] [XCUITest] Waiting for WebDriverAgent server to finish loading…
[debug] [XCUITest] Waiting for WebDriverAgent server to finish loading…
[debug] [XCUITest] Waiting for WebDriverAgent server to finish loading…
[debug] [XCUITest] Waiting for WebDriverAgent server to finish loading…

Try to remove WebDriver Derived data which are available @ /Users/<>/Library/Developer/Xcode/DerivedData and re execute the script