系统提示没有出现在元素树中iOS12

问题描述 投票:1回答:1

对于iOS11,我用下面的我的UI测试中访问脸部无法识别系统警报:

XCUIApplication(bundleIdentifier: "com.apple.springboard").alerts.firstMatch

这不是在iOS12为我工作。该警报不再显示出来的元素树。

有谁知道我可以在iOS12现在访问此?

enter image description here

这是iOS11元素树:enter image description here

这是PO XCUIApplication的结果(bundleIdentifier: “com.apple.springboard”)为iOS12:

    Attributes: Application, pid: 30484, label: ' '
Element subtree:
 →Application, 0x60000105c000, pid: 30484, label: ' '
    Window, 0x60000105c0d0, {{0.0, 0.0}, {414.0, 896.0}}
      Other, 0x60000105c1a0, {{0.0, 0.0}, {414.0, 896.0}}
        Other, 0x60000105c270, {{0.0, 0.0}, {414.0, 896.0}}
          Other, 0x60000105c340, {{0.0, 0.0}, {414.0, 896.0}}
      Other, 0x60000105c410, {{0.0, 0.0}, {414.0, 896.0}}
    Window, 0x60000105c4e0, {{0.0, 0.0}, {414.0, 896.0}}
      Other, 0x60000105c5b0, {{0.0, 0.0}, {0.0, 0.0}}
        Icon, 0x60000105c680, {{-2.3, -2.0}, {70.0, 91.3}}
        Icon, 0x60000105c750, {{-2.0, -2.0}, {68.0, 91.3}}
        Icon, 0x60000105c820, {{-2.0, -2.0}, {68.0, 91.3}}
        Icon, 0x60000105c8f0, {{-2.0, -2.0}, {68.0, 91.3}}
        Icon, 0x60000105c9c0, {{-2.0, -2.0}, {68.0, 91.3}}
        Icon, 0x60000105ca90, {{-2.0, -2.0}, {68.0, 91.3}}
        Icon, 0x60000105cb60, {{-2.0, -2.0}, {68.0, 91.3}}
      Other, 0x60000105cc30, {{0.0, 0.0}, {414.0, 896.0}}
        Other, 0x60000105cd00, {{0.0, 0.0}, {414.0, 896.0}}
          Other, 0x60000105cdd0, {{0.0, 0.0}, {414.0, 100.0}}
          Other, 0x60000105cea0, {{0.0, 0.0}, {414.0, 896.0}}
        Other, 0x60000105cf70, {{0.0, 0.0}, {414.0, 896.0}}
    Window, 0x60000105d040, {{0.0, 0.0}, {414.0, 896.0}}
      Other, 0x60000105d110, {{0.0, 0.0}, {414.0, 896.0}}
    Window, 0x60000105d1e0, {{0.0, 0.0}, {414.0, 896.0}}
      Other, 0x60000105d2b0, {{0.0, 0.0}, {414.0, 896.0}}
        Other, 0x60000105d380, {{0.0, 0.0}, {414.0, 896.0}}
          Other, 0x60000105d450, {{0.0, 0.0}, {414.0, 896.0}}
            Other, 0x60000105d520, {{0.0, 0.0}, {414.0, 896.0}}
              Other, 0x60000105d5f0, {{0.0, 0.0}, {414.0, 896.0}}
                Other, 0x60000105d6c0, {{0.0, 0.0}, {414.0, 896.0}}
                  Other, 0x60000105d790, {{0.0, 0.0}, {414.0, 896.0}}
                    Other, 0x60000105d860, {{0.0, 0.0}, {414.0, 896.0}}
                      Other, 0x60000105d930, {{0.0, 0.0}, {414.0, 896.0}}
                        Other, 0x60000105da00, {{0.0, 0.0}, {414.0, 896.0}}
                        Other, 0x60000105dad0, {{0.0, 0.0}, {414.0, 896.0}}
                          Other, 0x60000105dba0, {{0.0, 0.0}, {414.0, 896.0}}
                            Other, 0x60000105dc70, {{0.0, 0.0}, {414.0, 896.0}}
                            Other, 0x60000105dd40, {{0.0, 0.0}, {414.0, 896.0}}
                            Other, 0x60000105de10, {{0.0, 0.0}, {414.0, 896.0}}
                        Other, 0x60000105dee0, {{0.0, 0.0}, {414.0, 896.0}}
                          Other, 0x60000105dfb0, {{0.0, 0.0}, {414.0, 896.0}}
                            Other, 0x60000105e080, {{0.0, 0.0}, {414.0, 896.0}}
    Other, 0x60000105e150, {{0.0, 0.0}, {1242.0, 2688.0}}
      Other, 0x60000105e220, {{0.0, 0.0}, {1242.0, 2688.0}}
        Other, 0x60000105e2f0, {{0.0, 0.0}, {1242.0, 2688.0}}
          Other, 0x60000105e3c0, {{0.0, 0.0}, {1242.0, 2688.0}}
            Other, 0x60000105e490, {{0.0, 0.0}, {1242.0, 2688.0}}
        Other, 0x60000105e560, {{0.0, 0.0}, {1242.0, 2688.0}}
          Other, 0x60000105e630, {{0.0, 0.0}, {1242.0, 2688.0}}
            Other, 0x60000105e700, {{0.0, 0.0}, {1242.0, 2688.0}}
        Other, 0x60000105e7d0, {{0.0, 0.0}, {1242.0, 2688.0}}
          Other, 0x60000105e8a0, {{0.0, 0.0}, {1242.0, 2688.0}}
            Other, 0x60000105e970, {{0.0, 0.0}, {1242.0, 2688.0}}
        Other, 0x60000105ea40, {{0.0, 0.0}, {1242.0, 2688.0}}
        Other, 0x60000105eb10, {{0.0, 0.0}, {1242.0, 2688.0}}
          Other, 0x60000105ebe0, {{0.0, 0.0}, {1242.0, 2688.0}}
        Other, 0x60000105ecb0, {{0.0, 0.0}, {1242.0, 2688.0}}
          Other, 0x60000105ed80, {{0.0, 0.0}, {1242.0, 2688.0}}
        Other, 0x60000105ee50, {{0.0, 0.0}, {1242.0, 2688.0}}
          Other, 0x60000105ef20, {{0.0, 0.0}, {1242.0, 2688.0}}
        Other, 0x60000105eff0, {{0.0, 0.0}, {1242.0, 2688.0}}
          Other, 0x60000105f0c0, {{0.0, 0.0}, {1242.0, 2688.0}}
        Other, 0x60000105f190, {{0.0, 0.0}, {1242.0, 2688.0}}
          Other, 0x60000105f260, {{0.0, 0.0}, {1242.0, 2688.0}}
            Other, 0x60000105f330, {{0.0, 0.0}, {1242.0, 2688.0}}
        Other, 0x60000105f400, {{0.0, 0.0}, {1242.0, 2688.0}}
          Other, 0x60000105f4d0, {{0.0, 0.0}, {1242.0, 2688.0}}
            Other, 0x60000105f5a0, {{0.0, 0.0}, {1242.0, 2688.0}}
        Other, 0x60000105f670, {{0.0, 0.0}, {1242.0, 2688.0}}
          Other, 0x60000105f740, {{0.0, 0.0}, {1242.0, 2688.0}}
            Other, 0x60000105f810, {{0.0, 0.0}, {1242.0, 2688.0}}
        Other, 0x60000105f8e0, {{0.0, 0.0}, {1242.0, 2688.0}}
          Other, 0x60000105f9b0, {{0.0, 0.0}, {1242.0, 2688.0}}
            Other, 0x60000105fa80, {{0.0, 0.0}, {1242.0, 2688.0}}
        Other, 0x60000105fb50, {{0.0, 0.0}, {1242.0, 2688.0}}
          Other, 0x60000105fc20, {{0.0, 0.0}, {1242.0, 2688.0}}
            Other, 0x60000105fcf0, {{0.0, 0.0}, {1242.0, 2688.0}}
        Other, 0x60000105fdc0, {{0.0, 0.0}, {1242.0, 2688.0}}
          Other, 0x60000105fe90, {{0.0, 0.0}, {1242.0, 2688.0}}
            Other, 0x600001063190, {{0.0, 0.0}, {1242.0, 2688.0}}
      Other, 0x600001062d80, {{0.0, 0.0}, {1242.0, 2688.0}}
    Window, 0x600001063260, {{0.0, 0.0}, {414.0, 896.0}}, identifier: 'SBSwitcherWindow'
      Other, 0x600001062f20, {{0.0, 0.0}, {414.0, 896.0}}
        Other, 0x600001062ff0, {{0.0, 0.0}, {414.0, 896.0}}
          Other, 0x600001062e50, {{0.0, 0.0}, {414.0, 896.0}}
            Other, 0x600001063dc0, {{0.0, 0.0}, {414.0, 896.0}}
              ScrollView, 0x600001063e90, {{0.0, 0.0}, {414.0, 896.0}}
              Other, 0x600001062cb0, {{0.0, 0.0}, {414.0, 896.0}}, identifier: 'AppSwitcherContentView'
                Other, 0x600001063330, {{0.0, 0.0}, {414.0, 896.0}}, label: 'App', value: Active
                  ScrollView, 0x600001063c20, {{0.0, -448.0}, {414.0, 1344.0}}
                    Other, 0x600001062150, {{0.0, 0.0}, {414.0, 996.0}}
                      Other, 0x600001062560, {{0.0, 0.0}, {414.0, 896.0}}
                      Other, 0x600001061ba0, {{0.0, 0.0}, {414.0, 896.0}}
                        Other, 0x600001061c70, {{0.0, 0.0}, {414.0, 896.0}}
                          Other, 0x600001062220, {{0.0, 0.0}, {414.0, 896.0}}
                            Other, 0x600001062630, {{0.0, 0.0}, {414.0, 896.0}}
                              Other, 0x600001061fb0, {{0.0, 0.0}, {414.0, 896.0}}
                                Other, 0x600001061e10, {{0.0, 0.0}, {414.0, 896.0}}
                      Other, 0x600001062be0, {{0.0, 0.0}, {414.0, 896.0}}
    Window (Main), 0x600001061ee0, {{0.0, 0.0}, {414.0, 896.0}}
      Other, 0x600001063670, {{0.0, 0.0}, {414.0, 896.0}}
        Other, 0x600001063740, {{0.0, 0.0}, {414.0, 896.0}}
          Other, 0x600001062700, {{0.0, 0.0}, {414.0, 896.0}}
            Other, 0x600001062490, {{0.0, 0.0}, {414.0, 896.0}}
              Other, 0x600001061040, {{0.0, 0.0}, {414.0, 896.0}}
                Other, 0x600001062080, {{0.0, 0.0}, {414.0, 896.0}}
                  Other, 0x6000010639b0, {{0.0, 0.0}, {414.0, 896.0}}
          Other, 0x6000010628a0, {{0.0, 0.0}, {414.0, 896.0}}, identifier: 'Home Grabber'
            Other, 0x600001063a80, {{133.0, 883.0}, {148.0, 5.0}}
    Window, 0x6000010638e0, {{0.0, 0.0}, {414.0, 896.0}}
      Other, 0x600001061d40, {{0.0, 0.0}, {414.0, 896.0}}
        Other, 0x6000010627d0, {{0.0, 896.0}, {414.0, 243.0}}
        Other, 0x600001063400, {{0.0, 0.0}, {414.0, 896.0}}
          Other, 0x6000010635a0, {{0.0, 0.0}, {414.0, 896.0}}
    Window, 0x600001063b50, {{-0.0, -0.0}, {414.0, 896.0}}
      Other, 0x600001063cf0, {{-0.0, -0.0}, {414.0, 896.0}}
        Other, 0x600001063810, {{0.0, 0.0}, {414.0, 896.0}}
          Other, 0x6000010634d0, {{-0.0, -0.0}, {414.0, 896.0}}
    Window, 0x600001062b10, {{0.0, 0.0}, {414.0, 896.0}}
    Window, 0x6000010630c0, {{0.0, 0.0}, {414.0, 896.0}}
      Other, 0x600001062970, {{0.0, 0.0}, {414.0, 896.0}}
    Window, 0x6000010622f0, {{0.0, 0.0}, {414.0, 896.0}}
      Other, 0x6000010623c0, {{0.0, 0.0}, {414.0, 896.0}}
      Other, 0x600001062a40, {{0.0, 0.0}, {0.0, 0.0}}
Path to element:
 →Application, pid: 30484, label: ' '
Query chain:
 →Find: Application 'com.apple.springboard'
  Output: {
    Application, pid: 30484, label: ' '
  }
ios xcode ios12 xcuitest xcode10.1
1个回答
0
投票

尝试XCUIApplication(privateWithPath: nil, bundleID: "com.apple.springboard").coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).tap()。也许你有一个价值发挥的偏移。

如果它导致解除警报,那么你至少可以取消此警报。这可能是这样,如果警报是由UIInterruptionMonitor处理。

在这种情况下使用addUIInterruptionMonitor:https://developer.apple.com/documentation/xctest/xctestcase/1496273-adduiinterruptionmonitor


有一种方法,以不触发UIInterruptionMonitor并点击坐标,但你应该发现XCUIElement警报并点击其坐标,任何其他元素上轻敲触发UIInterruptionMonitor。


如果UIInterruptionMonitor不工作,那么您可以点击坐标。硬编码的坐标就可以OK,但如果显示或者不显示警告你无法察觉。

为了获得精确坐标,并检查是否显示在屏幕上的任何东西,你可以找到的图片:您在屏幕截图按钮的图像:https://gist.github.com/artyom-razinov/f5b190e2a5f3282eb0b5c1191a1bc674

在代码中的算法需要的图像的像素的100%匹配,它可能需要有一个按钮的快照每个设备(但是,如果有人将写SIFT算法的UIImage和的CGRect在夫特,它可以使用1个图像对每个装置,因为SIFT是尺度不变特征变换)。


也许此警报不跳板的应用层次存在的,但在其他应用程序层次结构在某种程度上存在。


建议:不要介意自动化测试。它是好的,有一些手工测试。

© www.soinside.com 2019 - 2024. All rights reserved.