iOS应用在创建新的appium会话时重置 [英] iOS app gets reset on creation of new appium session

查看:340
本文介绍了iOS应用在创建新的appium会话时重置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在执行以下步骤

  1. 设置功能并启动ABC应用程序.通过提供应用程序路径

  1. Set capabilities and launch ABC app. By providing app path

capabilities.setCapability("app","/Users/changdeojadhav/Library/Developer/Xcode/DerivedData/ABC/Build/Products/Debug-iphonesimulator/ABC.app"); abilities.setCapability("bundleId","com.abc.ABC-Demo");

capabilities.setCapability("app", "/Users/changdeojadhav/Library/Developer/Xcode/DerivedData/ABC/Build/Products/Debug-iphonesimulator/ABC.app"); capabilities.setCapability("bundleId","com.abc.ABC-Demo");

执行一些操作

推荐答案

我能够重新启动同一应用程序,而无需在运行Mavericks的Mac Mini上使用Xcode 6.1与Appium 1.3.1一起重置其状态.我没有尝试在两次发布之间启动另一个应用程序.我正在从C#推动自动化.

I was able to relaunch the same app without it resetting its state with Appium 1.3.1 running with Xcode 6.1 on a Mac Mini running Mavericks. I did not try launching another app in between launches. I'm driving the automation from C#.

    protected AppiumDriver GetAppiumDriver(bool forRestart = false)
    {
        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.SetCapability("appium-version", "1.0");
        capabilities.SetCapability("platformName", "iOS");
        capabilities.SetCapability("platformVersion", "7.1");
        capabilities.SetCapability("deviceName", "iPhone Simulator");
        capabilities.SetCapability("app", _appPath);
        capabilities.SetCapability("locationServicesEnabled", true);
        if (forRestart)
        {
            capabilities.SetCapability("noReset", true);
        }
        AppiumDriver driver = new AppiumDriver(_serverUrl), capabilities, new TimeSpan(0, 5, 0));
        return driver;
    }

    public void iOSMobileAppBasicUITest()
    {
        // Initially Launch the app with the noReset capability at its default value of false to ensure a clean starting point.
        _driver = GetAppiumDriver(false);

        //Shut down the app.
        _driver.Quit();

        // Launch the app again, this time with the noReset capability set to true.
        _driver = GetAppiumDriver(true);

        // Use _driver to do whatever UI automation is desired.

        // Optional: Send the app to the background so that iOS does state preservation.
        _driver.BackgroundApp(3);

        // Close the app.
        _driver.CloseApp();
        // Alternative: _driver.Quit();

        // Launch the app.
        _driver.LaunchApp();
        // Alternative: _driver = GetAppiumDriver(true);
        ...

这篇关于iOS应用在创建新的appium会话时重置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆