Selenium GRID does not find node with desired capabilities (iOS, C#)

Hi

I am trying to run a small test against the iOS Simulator using Appium together with Selenium GRID. I am using the C# language bindings.
If I run my test, I get the following exception:
System.InvalidOperationException : Error forwarding the new session cannot find : Capabilities [{platformVersion=8.1, browserName=safari, platformName=iOS, deviceName=iPhone 5}]

In my test I use the following capabilities:

  • platformName: iOS
  • platformVersion: 8.1
  • browserName: safari
  • deviceName: iPhone 5

Before I start the tests, I start the Simulator and the Safari app on my mac.

On my Mac I use XCode 6.1 and Appium 1.3.1

I use the following nodeconfig for Appium:
{
“capabilities”:
[
{
“browserName”: “iPhone 5”,
“version”:“8.1”,
“maxInstances”: 1,
“platform”:“MAC”
}
],

“configuration”:
{
“cleanUpCycle”:2000,
“timeout”:30000,
“proxy”: “org.openqa.grid.selenium.proxy.DefaultRemoteProxy”,
“url”:“http://10.116.1.129:4723/wd/hub”,
“maxSession”: 1,
“port”: 4723,
“host”: “10.116.1.129”,
“register”: true,
“registerCycle”: 5000,
“hubPort”: 4444,
“hubHost”: “10.116.1.74” }
}

  • I ran the Doctor from the Appium GUI and all iOS checks succeeded.
  • I checked the device list in XCode. It contains a simulated device
    with the capabilities defined in the nodeconfig.
  • The GRID hub on my Windows PC is running and the Appium node is
    connected successfully.
  • The Grid console shows the device capabilities defined in the
    nodeconfig.

I tried different combinations of capabilites, but I am always ending up with the same error.
Any ideas what is going wrong?

I really appreciate your help.

With best regards,
Nicolas

Hi Nicolas,

Selenium Grid cannot find your node because you have differents browserNames: ‘iPhone 5’ and ‘safari’. You must configure your node with “browserName”: “safari”.

The problem here is that browserName is used by Grid to find the node and is used by Appium to launch the browser instead of an app. If you need to launch your Safari tests in different devices, e.g. ‘iPhone 5’ and ‘iPhone 6’, you can use the solution of dhuanggithub in https://github.com/appium/appium/issues/3834: add ‘applicationName’ Grid capability.

Regards
Rubén

2 Likes

Hi Ruben

Its working. You made my day.
Thx a lot!

regards,
Nicolas

Hi @rgonalo ,
I am facing the same issue but in my case i am using Selenium Grid Extras. I tried different ways but nothing helped.getting the same Error forwarding the new session cannot find : Capabilities
Can you please help?
I am trying to run a simple test against the real iOS device using Appium 1.7.1 together with Selenium GRID Extras. I am using Java language.
When i run the test my expectation is the hub should identify the node and run the test. correct me if i am wrong.
In the below test i have used IOSDriver but if i am passing the hubip then should i have to use RemoteWebDriver? i am not sure about it.

My test:
public void test() throws InterruptedException {

    IOSDriver driver;
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone");
    capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME , "iOS");
    capabilities.setCapability (MobileCapabilityType.PLATFORM_VERSION, "11.2.1");
    capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, BrowserType.SAFARI);
    capabilities.setCapability(MobileCapabilityType.UDID,"xxxxxxx");
    capabilities.setCapability("xcodeOrgId","xxxxxxx");
    capabilities.setCapability("xcodeSigningId","id");
    capabilities.setCapability("applicationName","automation");

   
    URL url = new URL("http://hubip:4445/wd/hub");
    driver = new IOSDriver(url,capabilities);
    driver.navigate().to("https://www.google.com");
    System.out.println("Title"+ driver.getTitle());

}

appium node config:

{
“capabilities”: [
{
“seleniumProtocol”: “WebDriver”,
“browserName”: “safari”,
“maxInstances”: 1,
“version”: “11”,
“platform”: “MAC”,
“applicationName”: “automation”
}
],
“loadedFromFile”: “appium_node_4723.json”,
“proxy”: “com.groupon.seleniumgridextras.grid.proxies.SetupTeardownProxy”,
“servlets”: [],
“maxSession”: 1,
“port”: 4723,
“register”: true,
“unregisterIfStillDownAfter”: 10000,
“hubPort”: 4445,
“hubHost”: “hubip”,
“host”: “hubip”,
“url”: “http://hubip:4723/wd/hub”,
“registerCycle”: 5000,
“nodeStatusCheckTimeout”: 10000,
“appiumStartCommand”: “appium”,
“custom”: {
“grid_extras_port”: 3000
},
“downPollingLimit”: 0
}

Hub Config:

{
“port”: 4445,
“newSessionWaitTimeout”: 25000,
“servlets”: [
“com.groupon.seleniumgridextras.grid.servlets.ProxyStatusJsonServlet”
],
“capabilityMatcher”: “org.openqa.grid.internal.utils.DefaultCapabilityMatcher”,
“throwOnCapabilityNotPresent”: true,
“nodePolling”: 5000,
“cleanUpCycle”: 5000,
“browserTimeout”: 120000,
“timeout”: 120000,
“maxSession”: 5
}

when i try to run the test i get the following error
org.openqa.selenium.WebDriverException: Error forwarding the new session cannot find : Capabilities {applicationName: automation, browserName: safari, deviceName: iPhone, platformName: ios, platformVersion: 11.2.1, udid:xxx., xcodeOrgId: XXX, xcodeSigningId: id}

In the test if i specify the url with the appium port
URL url = new URL(“http://hubip:4723/wd/hub”);
then the test works fine
but if i specify the Hub port it throws the above error
URL url = new URL(“http://hubip:4445/wd/hub”);

Hello Sara , Have u found any solution, if yes then please let me know?

You really made my day. Thanks for the answer. I spent some time figuring out why my tests are not working remotely. Then I found your answer. :slight_smile: