Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/329.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java UnsupportedCommandException:方法尚未实现。使用Appium的混合Android应用程序出现错误_Java_Selenium_Appium_Hybrid Mobile App_Appium Android - Fatal编程技术网

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

Java UnsupportedCommandException:方法尚未实现。使用Appium的混合Android应用程序出现错误,java,selenium,appium,hybrid-mobile-app,appium-android,Java,Selenium,Appium,Hybrid Mobile App,Appium Android,我正在使用Appium为混合Android应用程序编写自动化测试用例。 我使用以下代码行在下拉/弹出菜单上设置光标: Set<String> stringSet = webDriver.getWindowHandles(); webdriver是AppiumDriver的对象 这是一款混合的移动应用程序 我的堆栈跟踪: Apr 03, 2019 4:20:21 PM org.openqa.selenium.remote.ErrorCodes toStatus INFO: HTTP

我正在使用Appium为混合Android应用程序编写自动化测试用例。 我使用以下代码行在下拉/弹出菜单上设置光标:

Set<String> stringSet =  webDriver.getWindowHandles();
webdriver是AppiumDriver的对象

这是一款混合的移动应用程序

我的堆栈跟踪:

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客户端v3.141.59和JDK v1.8.0_152-release之间存在明显的不匹配

解决方案
  • 将JDK升级到当前级别
此错误消息

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客户端v3.141.59和JDK v1.8.0_152-release之间存在明显的不匹配

解决方案
  • 将JDK升级到当前级别

您是否启用了
setWebContentsBuggingEnabled
属性?不幸的是,在你的应用程序构建中还需要一个额外的步骤。如Android远程调试文档中所述,需要将
Android.webkit.WebView
元素上的
setWebContentsBuggingEnabled
属性设置为true


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

您是否启用了
setWebContentsDebuggingEnabled
属性?不幸的是,在你的应用程序构建中还需要一个额外的步骤。如Android远程调试文档中所述,需要将
Android.webkit.WebView
元素上的
setWebContentsBuggingEnabled
属性设置为true


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

下面是我用来从可用上下文切换到第一个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;
}
@Nullable
私有字符串getWebContext(){
ArrayList contexts=新的ArrayList(driver.getContextHandles());
for(字符串上下文:上下文){
如果(!context.equals(“本机应用程序”)){
返回上下文;
}
}
返回null;
}

下面是我用来从可用上下文切换到第一个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;
}
@Nullable
私有字符串getWebContext(){
ArrayList contexts=新的ArrayList(driver.getContextHandles());
for(字符串上下文:上下文){
如果(!context.equals(“本机应用程序”)){
返回上下文;
}
}
返回null;
}

可能是因为解释错误。您是如何从
方法尚未实现到
无法与所需的WebElement进行交互的?OP在
getWindowHandles()
上得到错误。感谢@DebanjanB的友好响应。我将JDK更新为1.8.0_202,但仍然面临同样的问题。2019年4月10日12:23:41 PM org.openqa.selenium.remote.ErrorCodes toStatus信息:HTTP状态:“404”->未知方法的JSON状态映射不正确(预计405)org.openqa.selenium.UnsupportedCommandException:方法尚未实现构建信息:版本:“3.141.59”,版本:“e82be7d358”,时间:“2018-11-14T08:17:03”系统信息:主机:“VIKSHAH2-M-F1AR”,ip:“fe80:0:0:0:1046:c26d:1be1:cb9e%en0”,os.name:“Mac os X”,os.arch:“x86\U 64”,os.version:“10.14.3”,java.version:'1.8.0_202'驱动程序信息:io.appium.java_client.appiumdriver可能是因为解释错误。您是如何从
方法尚未实现到
无法与所需的WebElement进行交互的?OP在
getWindowHandles()
上得到错误。感谢@DebanjanB的友好响应。我将JDK更新为1.8.0_202,但仍然面临同样的问题。2019年4月10日12:23:41 PM org.openqa.selenium.remote.ErrorCodes toStatus信息:HTTP状态:“404”->未知方法的JSON状态映射不正确(预计405)org.openqa.selenium.UnsupportedCommandException:方法尚未实现构建信息:版本:“3.141.59”,版本:“e82be7d358”,时间:“2018-11-14T08:17:03”系统信息:主机:“VIKSHAH2-M-F1AR”,ip:“fe80:0:0:0:1046:c26d:1be1:cb9e%en0”,os.name:“Mac os X”,os.arch:“x86\U 64”,os.version:“10.14.3”,java.version:'1.8.0_202'驱动程序信息:io.appium.java_客户端。AppiumDrivergetWindowHandles()通常用于传统的web浏览器。我想不出任何理由将它与Appium驱动程序一起使用。也许你的意思是使用getContextHandles()?原始海报对他自己的问题没有反应,但这个问题成功地登上了Stack Overflow新闻稿。如果可以的话,我会再次投反对票。@BillHileman我正在研制混合动力车