enter image description here错误信息: [调试] [MJSONWP]遇到内部错误运行命令:错误:找不到自动化名称“ Appium”和平台名称“ Android”的驱动程序。请检查您所需的功能。 似乎功能有问题。但是我认为我的代码没有错。 我可以使用Appium v1.9.1运行脚本而不会出现任何错误 为什么Appium vv1.12.1会遇到此问题?
Config.initLog(this.getClass().getSimpleName());
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability(MobileCapabilityType.UDID, cf.readConf2("uuid"));
caps.setCapability(MobileCapabilityType.DEVICE_NAME, cf.readConf2("uuid"));
caps.setCapability(MobileCapabilityType.PLATFORM_VERSION, "6.0");
caps.setCapability(MobileCapabilityType.AUTOMATION_NAME, "Appium");
caps.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
caps.setCapability(MobileCapabilityType.BROWSER_NAME, "Chrome");
AndroidDriver<AndroidElement> driver = new AndroidDriver<AndroidElement>(new URL("http://127.0.0.1:4723/wd/hub"), caps);
Detail error info:
[HTTP] {"capabilities":{"desiredCapabilities":{"platformVersion":"6.0","automationName":
"Appium","browserName":"Chrome","udid":"8DF6R16826005016","platformName":"Android","devi
ceName":"8DF6R16826005016"},"requiredCapabilities":{}}}
[debug] [W3C] Calling AppiumDriver.createSession() with args: [null,null,{"desiredCapabi
lities":{"platformVersion":"6.0","automationName":"Appium","browserName":"Chrome","udid"
:"8DF6R16826005016","platformName":"Android","deviceName":"8DF6R16826005016"},"requiredC
apabilities":{}}]
[debug] [BaseDriver] Event 'newSessionRequested' logged at 1554197751059 (17:35:51 GMT+0
800 (GMT+08:00))
[debug] [BaseDriver] Event 'newSessionStarted' logged at 1554197751060 (17:35:51 GMT+080
0 (GMT+08:00))
[debug] [W3C] Encountered internal error running command: Error: Either JSONWP or W3C ca
pabilities should be provided
[debug] [W3C] at parseCapsForInnerDriver (C:\Users\v.yuanwenfang\AppData\Roaming\npm
\node_modules\appium\lib\utils.js:58:14)
答案 0 :(得分:0)
您的愿望功能应该看起来像这样,它们也更多,但这足以运行常规的android自动化
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "4.4");
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator");
capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, "Chrome");
我还与您分享了一个链接,他们给了一个例子供参考
https://www.toolsqa.com/mobile-automation/appium/appium-test-using-testng/
并且您还忘记给出automationName
取决于您使用UiAutomator或UiAutomator2的条件
修改 应该提供JSONWP还是W3C功能?
此下面的链接将为您提供帮助
Appium - Create Session - Error: Either JSONWP or W3C capabilities should be provided