appium 2.5.1多进程自动化多台真机测试时候经常提示Stacktrace:
UnknownError: An unknown server-side error occurred while processing the command. Original error: Error executing adbExec. Original error: 'Command '/usr/local/android-sdk-linux/platform-tools/adb -P 5037 -s 8TAQOVSKOFHY4L4D forward tcp:8201 tcp:6790' exited with code 1'; Command output: adb: error: more than one device/emulator
大概看了下,大致意思连接了不只一个手机或模拟器,但有时重启手机和电脑又可正常,不太明白为什么有时可以有时不正常。
def appium_App(self, port, device_name, platform_version,product_brand,network_mode, voice_mode,sim_slot,sim1_num,sim2_num,file_name,file_path):
self.desired_caps = {
# 平台名称
"platformName": "Android",
# 系统版本
"platformVersion": platform_version,
# 设备的名称
"deviceName": device_name,
"udid": device_name,
# 设置使用 Unicode 编码方式发送字符串到设备的键盘
"unicodeKeyboard": "true",
# 设置重置设备的软键盘状态并隐藏键盘
"restKeyboard": "true",
"noReset": True, # 不要重置App
"settings[waitForIdleTimeout]": 100,
"newCommandTimeout": 60000,
}
# 加载测试的配置选项和参数(Capabilities配置)
self.options = UiAutomator2Options().load_capabilities(self.desired_caps)
# Appium服务器地址端口,本地用http://127.0.0.1:4723
self.driver = webdriver.Remote(f"http://127.0.0.1:{port}", options=self.options)