UIAScrollView的scrollToElementWithName()不工作

发布于 2025-01-02 00:13:21 字数 381 浏览 4 评论 0原文

我正在尝试第一手 UIAutomation。我有一个滚动视图,其中有更多的子滚动视图。我可以点击前 6 个可见的子滚动视图,但后来当我尝试点击第 7 个时,它说“点击点不在屏幕范围内”。所以我尝试了以下解决方案,但这些都不起作用。 1.scrollToElementWithName("name")不滚动 2.scrollUP或scrollDown直接滚动到顶部/底部。它不会在中间停止 3.我还尝试在子scrollView对象上使用UIAElement类的scrollToVisible()方法,但它说“无法使用scrollToVisible,因为可滚动祖先元素不可见。”

我没有尝试过使用scrollToElementWithValueForKey,因为我对应该使用什么键值对感到困惑。 请建议。任何帮助都是值得赞赏的。谢谢。

I am trying my first hand on UIAutomation. I had a scrollview inside which I had more sub-scrollviews. I am able to tap first 6 visible sub-scrollview but later when I try to tap on 7th it says "tap point is not within bounds of screen". So I tried with following solution but none of these works.
1. scrollToElementWithName("name") does not scrolls
2. scrollUP or scrollDown directly scroll to top/bottom. It doesn't stop in the middle
3. I also tried to scrollToVisible() method of UIAElement class on sub-scrollView object but it says, "scrollToVisible cannot be used because a scrollable ancestor element is not visible."

I have not tried with scrollToElementWithValueForKey as I am confused with what key-value pair should I use.
Please suggets. Any help is appreciable. Thank you.

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

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

发布评论

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

评论(2

左岸枫 2025-01-09 00:13:21

我找到了其他执行滚动的方法。我使用dragFromToForDuration()方法来拖动屏幕,以使下一个子滚动视图的点击点可见。现在效果很好。但我现在遇到了另一个问题,该问题在此处打开。

I have found other way to perform scrolling. I used dragFromToForDuration() method to drag the screen so as to make the tap point of next sub-scrollview visible. And this works fine now. But I am running into another issu now which is opened here.

帥小哥 2025-01-09 00:13:21

如果您收到类似以下错误消息:“无法使用 scrollToVisible,因为可滚动祖先元素不可见。”,当使用 UIAElement 类的 scrollToVisible() 方法时, pdf 或内容尚未加载,您必须滚动尚未加载的内容。

解决此问题的解决方案是:

1。添加一些延迟,直到内容加载

2。每 x 秒使用重试方法 y 次。 (参考:Alex vollmeter 的 tuneup js 中的重试方法)

3。如果活动指示器(存在加载微调器),则等待该元素可见。
使用这三种解决方案中的任何一种都可以解决此错误。
此外,类似的情况也适用于 scrollToElementWithName()。如果该元素尚未加载并且您正在绑定访问它。

希望有帮助:)

--Swathy。

If you get an Error message like : "scrollToVisible cannot be used because a scrollable ancestor element is not visible.", when using the scrollToVisible() method of UIAElement class , the pdf or the content is not loaded yet and you are tying to scroll that content which is not yet loaded.

The solutions to fix this issue are :

1. Add some delay until the content is loaded

2. Use the retry method after every x sec for y times. (Refer: retry method from tuneup js by Alex vollmeter)

3. If the activity indicator (loading spinner exists) then wait until that element is visible.
Using any of the three solutions will resolve this error.
Also, the similar thing applies for scrollToElementWithName(). If the element is not loaded yet and you are tying to access it.

Hope that helps :)

--Swathy.

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