首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >想要在Appium自动化中使用"xcrun simctl“

想要在Appium自动化中使用"xcrun simctl“
EN

Stack Overflow用户
提问于 2015-01-07 22:44:18
回答 1查看 572关注 0票数 1

有什么方法可以在我的Appium自动化中使用xcrun simctl命令吗?我已经到了这样的情况,我想使用卸载和安装应用程序从模拟器,这是不可用的appium方法。所以,我在想,如果我能在自动化代码中使用这个实用程序的话。

我正在用Java在iOS上运行自动化。

EN

回答 1

Stack Overflow用户

发布于 2022-10-27 09:57:03

代码语言:javascript
复制
public class XCRunUtil {

ProcessBuilder processBuilder = new ProcessBuilder();

Process process;

public void execute(String url) {
    String link = "xcrun simctl list devices";
    System.out.println("link : " + link);
    processBuilder.command("sh", "-c", link);
    try {
        process = processBuilder.start();

        BufferedReader stdInput = new BufferedReader(new InputStreamReader(process.getInputStream()));
        BufferedReader stdError = new BufferedReader(new InputStreamReader(process.getErrorStream()));

        System.out.println("Here is the standard output of the command:\n");
        String s = null;
        while ((s = stdInput.readLine()) != null) {
            System.out.println(s);
        }
        // Read any errors from the attempted command
        System.out.println("Here is the standard error of the command (if any):\n");
        while ((s = stdError.readLine()) != null) {
            System.out.println(s);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

}

}

上面的代码可以工作。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27830013

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档