UnsupportedCommandException:使用Appium的混合Android应用程序尚未实现方法错误

问题描述 投票:1回答:3

我正在使用Appium为混合Android应用编写自动化测试用例。我使用下面的代码行将光标设置在下拉/弹出窗口中:

Set<String> stringSet =  webDriver.getWindowHandles();

但是,这会产生以下错误:

org.openqa.selenium.UnsupportedCommandException: Method has not yet been implemented.

webdriver是AppiumDriver的对象。

这是Hybrid(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测试下拉?

java selenium appium hybrid-mobile-app appium-android
3个回答
0
投票

此错误消息...

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版本,这是相当古老和古老的。

因此,Selenium Client v3.141.59和JDK v1.8.0_152-release之间存在明显的不匹配。


0
投票

你启用了setWebContentsDebuggingEnabled财产吗?遗憾的是,您的应用内置还需要一个额外的步骤。如Android远程调试文档中所述,必须在setWebContentsDebuggingEnabled元素上将android.webkit.WebView属性设置为true。

如果尚未启用,请在生成构建之前要求开发人员设置为true。


0
投票

下面是我用来从可用上下文切换到第一个Web视图(非本机视图)的代码。如果您不确定上下文文本实际包含的内容,则编写代码以捕获数组并显示所有值。

@Nullable
private String getWebContext() {
    ArrayList<String> contexts = new ArrayList<String>(driver.getContextHandles());
    for (String context : contexts) {
        if (!context.equals("NATIVE_APP")) {
            return context;
        }
    }
    return null;
}
© www.soinside.com 2019 - 2024. All rights reserved.