gpt4 book ai didi

java - 如何在 Appium Java 上使用 setClipboardText

转载 作者:行者123 更新时间:2023-11-29 23:30:58 29 4
gpt4 key购买 nike

    ((HasClipboard) driver).setClipboardText(“happy testing”);

我使用该代码来控制我的 android 设备剪贴板,但它给我错误。我在远程设备 android 6.0 上测试了这段代码。这是我的错误

Oct 06, 2018 7:47:01 AM org.openqa.selenium.remote.ErrorCodes toStatus INFO: HTTP Status: '404' -> incorrect JSON status mapping for 'unknown method' (405 expected) Exception in thread "main" org.openqa.selenium.UnsupportedCommandException: Method has not yet been implemented Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:05:20.749Z' System info: host: 'ADMIN-PC', ip: '192.168.100.79', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_181' Driver info: io.appium.java_client.android.AndroidDriver Capabilities {appActivity: com.gbwhatsapp.HomeActivity, appPackage: com.gbwhatsapp, databaseEnabled: false, desired: {appActivity: com.gbwhatsapp.HomeActivity, appPackage: com.gbwhatsapp, deviceName: Mito 1, newCommandTimeout: 300, noReset: true, platformName: android, platformVersion: 6.0, udid: 90404820557607}, deviceManufacturer: A67, deviceModel: A67, deviceName: 90404820557607, deviceScreenSize: 360x640, deviceUDID: 90404820557607, javascriptEnabled: true, locationContextEnabled: false, networkConnectionEnabled: true, newCommandTimeout: 300, noReset: true, platform: LINUX, platformName: Android, platformVersion: 6.0, takesScreenshot: true, udid: 90404820557607, warnings: {}, webStorageEnabled: false} Session ID: 63e74633-a0be-4314-bd81-9d042a9eda71 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187) at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122) at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158) at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:231) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548) at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42) at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1) at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1) at io.appium.java_client.CommandExecutionHelper.execute(CommandExecutionHelper.java:27) at io.appium.java_client.clipboard.HasClipboard.setClipboard(HasClipboard.java:42) at io.appium.java_client.clipboard.HasClipboard.setClipboardText(HasClipboard.java:63) at mito1.MitoAppiumTest1.runPromotion(MitoAppiumTest1.java:75) at mito1.MitoAppiumTest1.main(MitoAppiumTest1.java:43)

最佳答案

您得到的错误状态是 UnsupportedCommandException: Method has not yet been implemented

当您使用客户端库的新版本旧的Appium服务器版本时可能会发生:服务器尚未支持或规范更新为POST/wd/hub/session/:session_id/appium/device/set_clipboard 调用。

我建议安装最新的 Appium 服务器 1.9.1并将 Java 客户端库更新为 6.1.0 ,然后重试:

driver.setClipboardText(“happy testing”) 无需强制转换

如果仍然有错误,请报告给https://github.com/appium/appium/issues

关于java - 如何在 Appium Java 上使用 setClipboardText,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52674841/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com