我正在使用 Appium 为混合 Android 应用程序编写自动化测试用例。 我使用下面的代码行将光标设置在下拉/弹出窗口上:
Set<String> stringSet = webDriver.getWindowHandles();
但是,这会产生以下错误:
org.openqa.selenium.UnsupportedCommandException: Method has not yet been implemented.
webdriver是AppiumDriver的对象。
这是一个混合(Cordova) 移动应用。
我的堆栈跟踪:
Apr 03, 2019 4:20:21 PM org.openqa.selenium.remote.ErrorCodes toStatus
INFO: HTTP Status: '404' -> incorrect JSON status mapping for 'unknown method' (405 expected)
org.openqa.selenium.UnsupportedCommandException: Method has not yet been implemented
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'VIKSHAH-M-F1AR', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.3', java.version: '1.8.0_152-release'
Driver info: io.appium.java_client.AppiumDriver
更新: 更新JDK后
Apr 10, 2019 12:47:45 PM org.openqa.selenium.remote.ErrorCodes toStatus
INFO: HTTP Status: '404' -> incorrect JSON status mapping for 'unknown method' (405 expected)
org.openqa.selenium.UnsupportedCommandException: Method has not yet been implemented
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'VIKSHAH2-M-F1AR', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.3', java.version: '1.8.0_202'
Driver info: io.appium.java_client.android.AndroidDriver
有人遇到过类似的问题吗? 还有其他方法可以使用 Appium 测试下拉菜单吗?
最佳答案
此错误消息...
org.openqa.selenium.remote.ErrorCodes toStatus INFO: HTTP Status: '404' -> incorrect JSON status mapping for 'unknown method' (405 expected)
org.openqa.selenium.UnsupportedCommandException: Method has not yet been implemented Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03' System info: host: 'VIKSHAH-M-F1AR', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.3', java.version: '1.8.0_152-release' Driver info: io.appium.java_client.AppiumDriver
...暗示 WebDriver 变体无法与所需的 WebElement 交互。
您的主要问题是您使用的二进制文件版本之间不兼容,如下所示:
- 您的 Selenium 客户端 版本是 2018-11-14T08:17:03 的 3.141.59,这是最新版本。
- 您的JDK版本是1.8.0_152-release,它非常古老并且古老。
因此,Selenium Client v3.141.59 和 JDK v1.8.0_152-release 之间存在明显的不匹配。
解决方案
- 将 JDK 升级到当前级别 JDK 8u202 .
关于java - 不支持的命令异常 : Method has not yet been implemented error with hybrid Android app using Appium,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55494070/