grid相关问题,开启2个node,运行代码提示mo re than one device/emulator'; Code: '1'

问题描述:

`E selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the c
ommand. Original error: Error executing adbExec. Original error: ‘Command ‘‘D:\Program Files (x86)\appium\sdk\platform-t
ools\adb.exe’ -P 5037 -s 192.168.48.102:5555 forward tcp:8200 tcp:6790’ exited with code 1’; Stderr: ‘adb.exe: error: mo
re than one device/emulator’; Code: ‘1’

我发现当我开启一个模拟器的时候,开启2个节点,运行代码,代码是能正常pass的 ;
当开启2个模拟器,开启2个节点,运行代码,提示 mo re than one device/emulator’; Code: ‘1’

节点1的json文件
{
“capabilities”:
[
{
“browserName”: “emulator”,
“deviceName”: “emulator-7.1”,
“version”:“7.1”,
“maxInstances”: 1,
“platform”:“android”
}
],
“configuration”:
{
“cleanUpCycle”:2000,
“timeout”:30000,
“proxy”: “org.openqa.grid.selenium.proxy.DefaultRemoteProxy”,
“url”:“http://169.254.188.226:4725/wd/hub”,
“host”: “169.254.188.226”,
“port”: 4725,
“maxSession”: 1,
“register”: true,
“registerCycle”: 5000,
“hubPort”: 4444,
“hubHost”: “169.254.188.226”,
“hubProtocol”: “http”
}
}
节点2 的json文件

{
“capabilities”:
[
{
“browserName”: “mumu”,
“deviceName”: “emulator-5554”,
“version”:“6.0.1”,
“maxInstances”: 1,
“platform”:“android”
}
],
“configuration”:
{
“cleanUpCycle”:2000,
“timeout”:30000,
“proxy”: “org.openqa.grid.selenium.proxy.DefaultRemoteProxy”,
“url”:“http://169.254.188.226:4723/wd/hub”,
“host”: “169.254.188.226”,
“port”: 4723,
“maxSession”: 1,
“register”: true,
“registerCycle”: 5000,
“hubPort”: 4444,
“hubHost”: “169.254.188.226”,
“hubProtocol”: “http”
}
}

开启的模拟器:版本是6.0.1mumu
开启的模拟器:安卓 7.1

2、node日志
node.txt (16.2 KB)

3、测试内容
class TestWeixin:
def setup(self):
caps = {}
caps[“platformName”] = “Android”
caps[“deviceName”] = “abc”
caps[‘udid’] = os.getenv(“udid”, None)
# caps[“appPackage”] = “com.tencent.wework”
# caps[“appActivity”] = “.launch.WwMainActivity”
caps[“appPackage”] = “com.xueqiu.android”
caps[“appActivity”] = “.view.WelcomeActivityAlias”
caps[‘noReset’] = “true”
# caps[‘skipServerInstallation’] = True
# caps[‘skipDeviceInitialization’] = True
# caps[‘dontStopAppOnReset’] = True
self.driver = webdriver.Remote(‘http://169.254.188.226:4444/wd/hub’, caps)
self.driver.implicitly_wait(10)

def teardown(self):
    self.driver.quit()

def test_search(self):
    self.driver.find_element(MobileBy.ID, "com.xueqiu.android:id/tv_search")

4、运行命令
set udid=192.168.48.102:5555&&pytest appium_xueqiu_normal/testcases/test_xueqiu1.py

5、环境:windows
hub版本:selenium-server-standalone-3.141.59.jar
appium :1.15.1

我试了一下,唯一可能有问题的地方就是执行命令了
建议你还是分成两行去运行 windows单行运行的命令是有问题的,后面的命令并不能获取到前面设置的参数

set udid=192.168.48.102:5555
pytest appium_xueqiu_normal/testcases/test_xueqiu1.py
关闭