You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Appium向iOS模拟器推送文件遇ApplicationLookupFailed错误求助

Appium向iOS模拟器推送文件遇ApplicationLookupFailed错误求助

在使用Appium做iOS自动化测试时,我尝试向模拟器推送文件失败,尽管已经在应用的Info.plist中设置UIFileSharingEnabled为true,仍抛出以下错误:

org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Failed to vend into the application documents. Error: ApplicationLookupFailed

我已经尝试了以下方案,但均未解决问题:

  • 测试多种远程路径格式:@bundleId:Documents/、Documents/及完整物理路径
  • 推送前将文件转换为base64编码格式
  • 反复核对Bundle ID的正确性,确认UIFileSharingEnabled配置无误
  • 改用XCUITest的mobile: pushFile原生命令执行推送
  • 确认推送操作前应用已正确安装并处于激活状态

以上操作要么返回相同的ApplicationLookupFailed错误,要么无任何提示但推送实际失败。有没有人成功实现过Appium向iOS模拟器推送文件,或者知道这个错误的解决方法?

以下是我使用的推送文件函数:

import java.io.File;
import java.io.IOException;
import java.util.Arrays;

public byte[] pushFileToIOSDevice(String imagePath) {
    // 构造iOS设备上的远程路径
    String remotePath = "@com.lambdatest.proverbial:Documents/" + new File(imagePath).getName();
    try {
        // 推送文件到iOS设备
        driver.pushFile(remotePath, new File(imagePath));
    } catch (IOException e) {
        // 捕获IO异常并抛出运行时异常
        throw new RuntimeException(e);
    }
    // 从iOS设备拉取文件为字节数组
    byte[] fileBase64 = driver.pullFile(remotePath);
    // 打印字节数组到控制台
    System.out.println("Byte value of file: " + Arrays.toString(fileBase64));
    // 返回字节数组
    return fileBase64;
}

内容的提问来源于stack exchange,提问作者David Razmadze

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.16 13:51:18