UI Automation,如何在progressBar中动态引用.staticText?

时间:2013-10-31 23:39:47

标签: ios-ui-automation

这是UIAutomation的场景:

我正在上传文件'文件A'。在上传过程中,有一个进度条'0-100%'反映了上传进度。此信息保存在.staticTexts& .value - 当我检查logElementTree

UIATarget.localTarget().logElementTree();

一个。我需要参考&返回此元素的.static文本或.value 湾断言预期的“100%完成”。

我正在定义realProgress以捕获静态文本或进度条的值。 我尝试了不同的迭代...... 捕获当前文本百分比的正确方法是什么?

    var realProgress = window.staticTexts()[0];

断言功能的输出:

Expected 'Upload Progress 100%' but was '[object UIAStaticText]'!
target.frontMostApp().toolbar().buttons()["Icon Upload"].tap()

由于

1 个答案:

答案 0 :(得分:2)

解决方案是在我声明的变量的末尾添加.name()

     rProgress.name()

if (rProgress.name() != "your message"){
UIALogger.logerror("your error message not equal to " + rProgress.name() ) }