相关疑难解决方法(0)

Xcode UI测试 - UI测试失败 - 点击搜索字段"取消"按钮时无法滚动显示(通过AX操作)

我试图通过点击搜索栏中的"取消"按钮来关闭搜索字段.

测试用例未能找到取消按钮.它在Xcode 7.0.1中运行良好

我添加了谓词等待按钮出现.当我们点击"取消"按钮时,测试用例失败

let button = app.buttons[“Cancel”]
let existsPredicate = NSPredicate(format: "exists == 1")

expectationForPredicate(existsPredicate, evaluatedWithObject: button, handler: nil)
waitForExpectationsWithTimeout(5, handler: nil)

button.tap() // Failing here
Run Code Online (Sandbox Code Playgroud)

日志:

    t =     7.21s     Tap SearchField
t =     7.21s         Wait for app to idle
t =     7.29s         Find the SearchField
t =     7.29s             Snapshot accessibility hierarchy for com.test.mail
t =     7.49s             Find: Descendants matching type SearchField
t =     7.49s             Find: Element at index 0
t =     7.49s             Wait for app to idle …
Run Code Online (Sandbox Code Playgroud)

xcode xcode7 xcode-ui-testing

70
推荐指数
3
解决办法
2万
查看次数

Xcode UI测试 - 带时间戳的事件匹配错误

录制UI测试时出现此错误.此时录像机停止录制代码.这是什么意思?

在此输入图像描述

xcode7 xcode-ui-testing

30
推荐指数
1
解决办法
6547
查看次数

Xcode UI测试:UITableViewCell上的辅助功能查询失败

问题

使用Xcode UI测试,我无法查询UITableView中的单元格

说明

UITableView

UITableView包含3个单元格:

import UIKit

@objc class DumpTable: UITableViewController {
    var objects: [NSDate] = [NSDate]()

    override func viewDidLoad() {
        super.viewDidLoad()

        objects.append(NSDate())
        objects.append(NSDate())
        objects.append(NSDate())

        tableView.isAccessibilityElement = true
        tableView.accessibilityLabel = "Thetable"
        tableView.accessibilityIdentifier = "Thetable"
    }

    override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
        return 1
    }

    override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return objects.count
    }

    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        let cell = UITableViewCell()

        let object = objects[indexPath.row]
        cell.textLabel!.text = object.description …
Run Code Online (Sandbox Code Playgroud)

xcode uitableview swift xcode-ui-testing

6
推荐指数
1
解决办法
1156
查看次数

标签 统计

xcode-ui-testing ×3

xcode ×2

xcode7 ×2

swift ×1

uitableview ×1