Hi All,
I have a Selenium Grid running with multiple Android emulators, and there are several scripts connecting to the Grid which end up executing on one of the emulators. This is all working fine.
Until recently, I had two emulators with Android 6.0.1 and Appium, and all tests ran fine. Now, however, I have an app that requires Android 7.1.2 (or just 7 to be precise) so I have set up a new emulator on a VM with Android 7.1.2 and installed Appium on this node. I have connected this node to the hub as well, but now stuff is getting mixed up.
The two Android 6.0.1 emulators have the following Appium node config:
{
âcapabilitiesâ:
[
{
âbrowserNameâ: âAndroidâ,
âversionâ: â6.0.1â,
âmaxInstancesâ: 1,
âplatformâ: âANDROIDâ,
âdeviceNameâ: âAndroidâ
}
],
âconfigurationâ:
{
âcleanUpCycleâ: 2000,
âtimeoutâ: 20,
âurlâ: âhttp://192.168.101.103:4723/wd/hubâ,
âproxyâ: âorg.openqa.grid.selenium.proxy.DefaultRemoteProxyâ,
âmaxSessionâ: 1,
âportâ: 4723,
âhostâ:â192.168.101.103â,
âregisterâ: true,
âregisterCycleâ: 5000,
âhubâ: âhttp://192.168.101.100:4445â,
âhubPortâ: 4445,
âcleanUpCycleâ: 2000,
âhubHostâ: â192.168.101.100â
}
}
And the 7.1.2 instance has the following:
{
âcapabilitiesâ:
[
{
âbrowserNameâ: âAndroidâ,
âversionâ: â7.1.2â,
âmaxInstancesâ: 1,
âplatformâ: âANDROIDâ,
âdeviceNameâ: âAndroidâ
}
],
âconfigurationâ:
{
âcleanUpCycleâ: 2000,
âtimeoutâ: 20,
âurlâ: âhttp://192.168.101.107:4723/wd/hubâ,
âproxyâ: âorg.openqa.grid.selenium.proxy.DefaultRemoteProxyâ,
âmaxSessionâ: 1,
âportâ: 4723,
âhostâ:â192.168.101.107â,
âregisterâ: true,
âregisterCycleâ: 5000,
âhubâ: âhttp://192.168.101.100:4445â,
âhubPortâ: 4445,
âcleanUpCycleâ: 2000,
âhubHostâ: â192.168.101.100â
}
}
I can see the Android device being registered in the hub console, and I can see there is a different version of the OS running on it.
I have a few different tests, with the following desired capabilities (note, this is Python code):
desired_caps[âplatformNameâ] = âANDROIDâ
desired_caps[âbrowserNameâ] = âAndroidâ
desired_caps[âplatformVersionâ] = â6.0.1â
desired_caps[âdeviceNameâ] = âAndroidâ
And:
desired_caps[âplatformNameâ] = âANDROIDâ
desired_caps[âbrowserNameâ] = âAndroidâ
desired_caps[âplatformVersionâ] = â7.1.2â
desired_caps[âdeviceNameâ] = âAndroidâ
When the tests run, it works fine sometimes, but also randonly fails. I have two 6.0.1 emulators and one 7.1.2 emulator, and four scripts requiring 6.0.1 and one script requiring 7.1.2. As long as Selenium Grid decides to run the 6.0.1 script on the 6.0.1 emulator (which is a 2 out of 3 chance) it all works fine. Most of the time it does this, but sometimes it does not. I then end up with the following error:
Unable to find an active device or emulator with OS 7.1.2. The following are available: 192.168.101.106:5555 (6.0.1)
Or the other way around:
Unable to find an active device or emulator with OS 6.0.1. The following are available: 192.168.101.108:5555 (7.1.2)
As you can see, while there are emulators available, Selenium Grid still wrongly directs a session requiring platform version X to a server running platform version Y. The next time when the script runs, it can go to the correct emulator, and it works fine.
Iâm probably missing something very silly here, but I have tried many different subtle changes in configuration for both Appium and Grid, but it keeps on directing the test to a wrong instance. Can anyone help me in getting this working? In due time, I will be adding iOS checks to this same grid as well, quite possibly with different versions of iOS emulators, so I really would like to have the Grid do what it is supposed to do.
Any help is greatly appreciated. For now I have worked around the issue by directing the 7.1.2 script straight into the 7.1.2 Appium instance, by means of some Apache trickery, but this is of course not idealâŚ