iphone - iOS UIAutomation UIAActivityIndi​​cator

标签 iphone ios testing ios-ui-automation

加载内容时,我的根 TableView 上有一个事件指示器。我正在尝试测试指示器是否存在,但似乎无法获取 UIAActivityIndi​​cator,也无法在应用程序元素树层次结构中的任何位置找到它。该指示器是根 TableView 的 subview ,因此我希望它被视为该元素树的一部分,但我在任何地方都看不到它(除了实际在屏幕上)。

从 javascript 获取事件指示器还需要其他魔法吗?

埃德

最佳答案

这是我为等待 iOS 中的页面加载而构建的函数。您可以在函数代码执行之前传递一个可选的 preDelay,除了等待 activityIndi​​cator 对象变为 null 30 秒(每半秒尝试一次,60 次)。当我点击对象时,我扩展了 UIAutomation 工具以包含此命令。

this.wait_for_page_load = function(preDelay) {        
    if (!preDelay) {
        target.delay(0);
    }
    else {
        target.delay(preDelay);
    }

    var done = false;
    var counter = 0;      
    while ((!done) && (counter < 60)) {
        var progressIndicator = UIATarget.localTarget().frontMostApp().windows()[0].activityIndicators()[0];
        if (progressIndicator != "[object UIAElementNil]") {
            target.delay(0.5);
            counter++;  
        }
        else {
            done = true;           
        }
    }
    target.delay(0.5);
}

关于iphone - iOS UIAutomation UIAActivityIndi​​cator,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6755477/

相关文章:

python - 什么是行业广泛使用的持续集成工具,基于 Python 的程序的夜间构建系统

ios - Swift CollectionView 自定义布局单元格间距

ios - 每秒保存到核心数据性能

ios - 获取 UIButton 在 UITableViewCell 中的位置

ios - 具有分页功能的动态表格 View

reactjs - Jest 无法从测试文件中找到模块

iphone - iOS 理解 iPhone 在自由落体中的加速度计数据

iphone - 在 iPhone 模拟器中模拟飞行模式

iphone - 如何在UIWebView中显示本地pdf文件?

bash - 从 bash 映射中检索时如何区分 null 和空字符串