【问题标题】:Get Clipboard from Real iOS Device从真实 iOS 设备获取剪贴板
【发布时间】:2019-06-26 12:44:30
【问题描述】:

我无法获取 Real iOS 设备的剪贴板..所有结果都是空的..

driver.getClipboard(ClipboardContentType.URL); driver.getClipboard(ClipboardContentType.IMAGE); driver.getClipboard(ClipboardContentType.PLAINTEXT); driver.getClipboardText()); driver.getClipboardImage());

虽然我可以成功设置剪贴板..使用下面的方法。

driver.setClipboardText("Text");

有没有办法修复它,或者终端中是否有可以获取剪贴板的命令?

操作系统:MacOS Mojave。 Appium:1.9 iPhone X (12.2)。

【问题讨论】:

    标签: ios macos terminal appium-ios


    【解决方案1】:

    Appium getClipboardText issue

    Appium 不提供任何用于在真实设备上复制剪贴板上下文的原语。相反,您可以将文本粘贴到任何文本字段中。我正在为我的应用程序使用以下内容。

    TouchAction ta = new TouchAction(iDriver);
    //For pasting content
     ta.press(PointOption.point(x,y))
    .waitAction(WaitOptions.waitOptions(Duration.ofSeconds(2)))
    .perform();
    By byPaste = By.xpath("//XCUIElementTypeMenuItem[@name='Paste']");
    iDriver.findElement(byPaste).click();
    //Get the text in the text field            
    element.getAttribute("value");
    

    【讨论】:

    • 感谢您的重播,有没有办法支持这样的图像?
    猜你喜欢
    • 1970-01-01
    • 2011-02-16
    • 1970-01-01
    • 1970-01-01
    • 2013-02-21
    • 2016-09-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多