Answer the question
In order to leave comments, you need to log in
How to set up parallel launch of autotests on 2 android devices?
I'm trying to set up parallel autotests of an application on several android devices.
For each device I created a json file like this:
{ "capabilities":
[
{
"deviceName": "LGM700dcbaf29c",
"version":"8.1.0",
"maxInstances": 10,
"platform":"ANDROID"
}
],
"configuration":
{
"cleanUpCycle":2000,
"timeout":30000,
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"url": " 127.0.0.1:4723/wd/hub " ,
"host": "127.0.0.1",
"port":
"hubHost": "127.0.0.1"
}
}
I start the hub, and separate Appium instances with a command like appium -a 127.0.0.1 -p 4723 -bp 2253 -U LGM700dcbaf29c --nodeconfig /home/test/LGM700dcbaf29c.json
In Environment.py wrote the following:
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
def before_feature(context, feature):
caps = DesiredCapabilities.ANDROID.copy()
caps["app"] = WD + "/apps/" + AppName
caps["appPackage "] = "en.messenger.android"
caps["appActivity"] = "en.messenger.android.activity.main.StartActivity"
caps["newCommandTimeout"] = "1000"
context.driver = webdriver.Remote(
command_executor=" 127.0.0.1:4444/wd/hub ",
desired_capabilities=caps
)
But here comes the problem. DesiredCapabilities.ANDROID only returns {'browserName': 'android', 'version': '', 'platform': 'ANDROID'}. I still need deviceName to connect. On the Internet, it is advised to add deviceName to caps manually, just as other parameters are added, but then how to run the test on two devices if the deviceName of one of them is manually registered. I thought that I could somehow pull out the deviceName from the json file that I specify when starting the instance, but DesiredCapabilities.ANDROID.copy () apparently will not help me with this. I have to somehow list the deviceName and do this. so that the running test pulls the desired name. Is there any option?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question