问题描述
我正在执行以下步骤
设置功能并启动 ABC 应用程序.通过提供应用路径
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");capabilities.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 会话时重置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!