I’m not sure how far custom capabilities are supported in Appium. I tell you my workaround and the point I got stucked:
I’ve setup a Selenium Grid 3.14.0 with Appium nodes 1.9.0. Each Appium node is started on a unique port (–port flag) and attached to a mobile device through nodeconfig json capabilities like this:
Notice that I’ve defined a custom homemade capability named groups. Obviously I have a custom capabilities matcher for grid’s hub and its properly linked through hub’s json config file. The capabilities matcher is needed at the moment I want to select nodes by the custom groups capability.
When I start grid’s hub and multiple Appium servers (nodes) all is working fine. Appium nodes register into grid hub and every log seems to be normal.
At the client side, Java in my case, I create a AndroidDriver object with the following capabilities:
DesiredCapabilities dc = new DesiredCapabilities();
dc.setCapability("deviceName", "Appium grid device");
AndroidDriver<WebElement> driver = new AndroidDriver<WebElement>(new URL("http://localhost:4723/wd/hub"), dc);
All seems to be normal except “groups” custom capability: It’s intended to match a ‘wallet’ node with this driver instance.
At the time I try to execute it throws a very nested exceptions with bad looking messages:
- WebDriverException: It is impossible to create a new session because ‘createSession’ which takes HttpClient, InputStream and long was not found or it is not accessible
- GridException: Cannot extract a capabilities from the request
- IllegalArgumentException: Illegal key values seen in w3c capabilities: [groups]
(I omitted some nested levels, there is a lot and repetitives. If you want to see the full exception stacktrace please claim it to me).
Bad luck on me! I excpected to make this work and it just rejected my custom capability at the client side. How I know that exceptions are throwed at client side? Because I removed the capability “groups” from node json configuration file and the result is the same, while the grid environment is up and running without weird messages.
My question is
There is supported custom capabilities at Appium client side??
There is some way to inject custom capabilities to a driver creation for hub’s capabilities matching logics??
There exists some workaround to achieve what I want?? (extra custom capabilities for a more complex client and node matching).
Any suggestion are welcomed!
Thank you very munch.