Unable to connect Real device to APPIUM

Hello Everyone , I am very new in appium IOS , Presently I am write practice script for google search . It is working fine into simulator but not working into real device . Please help me.I have got following error.

Exception in thread “main” org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: ‘3.0.0-beta3’, revision: ‘c7b525d’, time: ‘2016-09-01 14:57:03 -0700’
System info: host: ‘Hannas-Mac-mini-2.local’, ip: ‘192.168.0.113’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.10.5’, java.version: ‘1.8.0_101’
Driver info: driver.version: RemoteWebDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:618)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:242)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:129)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:156)
at demo.IOSREalDevice.main(IOSREalDevice.java:25)
Caused by: org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{app=safari, udid=5bc3162231c690e7805896d8b774323c5a2fb8f0, version=8.4.1}], required capabilities = null
Build info: version: ‘3.0.0-beta3’, revision: ‘c7b525d’, time: ‘2016-09-01 14:57:03 -0700’
System info: host: ‘Hannas-Mac-mini-2.local’, ip: ‘192.168.0.113’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.10.5’, java.version: ‘1.8.0_101’
Driver info: driver.version: RemoteWebDriver
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:80)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:597)
… 4 more

My Code is :
ackage demo;
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;

public class IOSREalDevice {
    public static void main(String... args){
        
        DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
        desiredCapabilities.setCapability("version", "8.4.1");
        desiredCapabilities.setCapability("udid","mydeviceudid");
        desiredCapabilities.setCapability("app", "safari");  
        URL url = null;
        try {
            url = new URL("http://127.0.0.1:4723/wd/hub");
        } catch (MalformedURLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } 
        
        WebDriver remoteWebDriver = new RemoteWebDriver(url, desiredCapabilities);
        remoteWebDriver.get("http://www.google.com");
        WebElement ele = remoteWebDriver.findElement(By.name("q"));
        ele.click();
        ele.sendKeys("This is a test");    
        WebElement searchButton = remoteWebDriver.findElement(By.name("btnG"));
        System.out.println(searchButton.getSize());
        searchButton.click();
        
        remoteWebDriver.quit();
    }
}

This thread may be of help: https://discuss.appium.io/t/real-ios-device-is-not-recognized-what-is-uuid-udid-provisioning-and-device-name/12451.

There is a lot more to executing appium scripts against an iOS device than against the simulator. Make sure you have the safari launcher app built with the correct bundle ID and your provisioning profile.

@Cauthon Thank you for response. I have installed 1.4.6 appium version .and it working fine but while using 1.5 appium version , It isnot working for me . Is there any issue in latest appium for IOS environment

Hi VPK,

I am using Appium version 1.5.3 to connect to iOS devices, so you should be able to as well. If I remember correctly, there were some directory structure changes between version 1.4.6 and 1.5.X.

I would double check that your signed safari launcher app is in the correct directory, node_modules > appium-ios_driver > build > SafariLauncher, of your appium installation. I do remember having trouble getting my tests to run again after upgrading to 1.5.3 and ended up rebuilding SafariLauncher. Also are you starting appium from the commandline or via the Appium GUI? There were changes in how to call appium from the commandline between the two versions.