我把 caps 里的 noreset 参数去掉,可以正常分配设备了
appium2.5.1 配合 pytest-xdist,请教下 config.json 和 case 中的 caps 是如何配置的 还需要添加设备信息吗?按照我自己的设置后,有以下几种情况
FAILED testcase/test_demo.py::test1 - selenium.common.exceptions.NoSuchElementException: Message: An element could not be located on the page using the given search parameters.; For docu...
FAILED testcase/test_demo1.py::test2 - selenium.common.exceptions.UnknownMethodException: Message: The requested resource could not be found, or a request was received using an HTTP metho...
config.json
{
"server": {
"port": 31337,
"plugin": {
"device-farm": {
"platform": "android",
"skipChromeDownload": true
}
}
}
}
case1 示例
caps = {
"platformName": "Android",
"automationName": "UiAutomator2",
"appActivity": "xxx",
"appPackage": "xxx",
"autoGrantPermissions": True,
"unicodeKeyboard": True,
"resetKeyboard": True,
"newCommandTimeout": 0,
}
url = "http://127.0.0.1:31337/wd/hub"
capabilities_options = UiAutomator2Options().load_capabilities(caps)
def test1():
driver = webdriver.Remote(command_executor=url, options=capabilities_options)
print(f"我是test1:{id(driver)}")
driver.implicitly_wait(10)
driver.find_element(
"xpath",
"(//xxx)[2]",
).click()
print(f"我是test1:{id(driver)}")
driver.close()
driver.quit()
case2 示例
caps = {
"platformName": "Android",
"automationName": "UiAutomator2",
"appActivity": "xxx",
"appPackage": "xxx",
"autoGrantPermissions": True,
"unicodeKeyboard": True,
"resetKeyboard": True,
"newCommandTimeout": 0,
}
url = "http://127.0.0.1:31337/wd/hub"
capabilities_options = UiAutomator2Options().load_capabilities(caps)
def test2():
driver = webdriver.Remote(command_executor=url, options=capabilities_options)
print(f"我是test2:{id(driver)}")
driver.implicitly_wait(10)
driver.find_element(
"xpath",
"(//xxx)[3]",
).click()
print(f"我是test2:{id(driver)}")
driver.close()
driver.quit()
tidevice 可以获取/操作模拟器吗
重跑机制的话,是把当前失败的 appium 服务停止,在重新起一个新的服务吗?我这边是长时间运行后,重启服务也不管用,必须要卸载掉三个安装的 apk 和重启设备才行
请问是怎么修改的,我这边也经常碰到
但是 Ocr 识别的话,会不会很慢,导致时间增加
最近也在调研 airtest 的两种模式,希望能有作用
看过了
正常 appium 和 pytest 的库使用也没有使用太多的第三方库
问题不在于不同设备执行不同 case,而是在于如何用 pytest 来同时调起多个设备而互相之间不冲突