wkwebview中添加的自定义视图在Uitesting期间未列出

发布于 2025-01-21 11:47:52 字数 684 浏览 6 评论 0原文

我有一个带有以下视图层次结构的Uitable视图。

UIViewController
  |--UITableView
     |--WKWebview
        |--ScrollView
           |--UIView

uiview完成WebView负载后,将添加,并且视图正确出现在UI中。 当我运行Uitestcases时,在uitesting中未列出动态添加的内容。

下面的方法是尝试的,并且不起作用。

  • SET InscoscessibilityElement对上述层次结构中的所有视图false
  • print app.debugdescription未显示新添加的视图内容
  • 。此外,在此也未显示新添加的视图内容,
  • 添加了conseviencyIdendifier不列出新添加的内容

不确定这是预期的行为还是我在添加内容时做错了什么。

子视图代码:

[tableViewCell.webView.scrollView addSubview:customView]

帮助赞赏

I have a UITableview with the below view hierarchy.

UIViewController
  |--UITableView
     |--WKWebview
        |--ScrollView
           |--UIView

The UIView is added once the Webview load is completed and the view appeared properly in the UI.
When I run the UITestcases the dynamically added content is not listed during the UITesting.

The below approaches are tried and didn't work.

  • Set isAccessibilityElement false to all the views in the mentioned hierarchy
  • print the app.debugDescription the newly added view contents are not displayed
  • print the XCUIApplication() and here also the newly added view contents are not displayed
  • added the accessibilityIdentifier to all the views the newly added contents are not listed

Not sure whether this is expected behavior or am I doing something wrong here in adding the contents.

Subview code:

[tableViewCell.webView.scrollView addSubview:customView]

Help Appreciated

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

薆情海 2025-01-28 11:47:52

通过将自定义视图添加到可访问性元素列表中来解决问题。

[self.view setAccessibilityElements:@[customView]];

The issue is fixed by adding the custom view to the accessibility elements list.

[self.view setAccessibilityElements:@[customView]];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文