gpt4 book ai didi

ui-automation - 在设备上测试时出现 scrollToVisible 错误,UIAutomation

转载 作者:行者123 更新时间:2023-12-04 06:22:31 24 4
gpt4 key购买 nike

对于这行测试代码:view.scrollViews()[0].tapWithOptions({tapOffset:{x:0.32, y:0.25}})

我收到这个错误

2012-11-02 18:09:23 +0000 None: Script threw an uncaught JavaScript error: target.frontMostApp().mainWindow().scrollViews()[0] could not be tapped on line 244 of feature.js
2012-11-02 18:09:23 +0000 Debug: target.frontMostApp().mainWindow().scrollViews()[0].tapWithOptions({tapOffset:{x:"0.32", y:"0.25"}})
2012-11-02 18:09:23 +0000 Debug: target.frontMostApp().mainWindow().scrollViews()[0].scrollToVisible()
2012-11-02 18:09:23 +0000 Debug: target.frontMostApp().mainWindow().scrollViews()[0] - scrollToVisible cannot be used on the element because it does not have a scrollable ancestor.
2012-11-02 18:09:23 +0000 Debug: target.frontMostApp().mainWindow().scrollViews()[0] - scrollToVisible cannot be used on the element because it does not have a scrollable ancestor.
2012-11-02 18:09:23 +0000 Debug: target.frontMostApp().mainWindow().scrollViews()[0] could not be tapped

logelement 树看起来像这样

UIATarget "MyiPadname" {{0, 0}, {1024, 768}}
elements: {
UIAApplication "myAppName" {{0, 0}, {1024, 768}}
elements: {
UIAWindow "(null)" {{0, 0}, {1024, 768}}
elements: {
UIAScrollView "(null)" {{0, 0}, {1024, 768}}
elements: {
UIAImage "(null)" {{1017, 761}, {7, 7}}
UIAImage "(null)" {{1017, 761}, {7, 7}}
}
UIAImage "nav_bar.png" {{0, 724}, {1024, 44}}
UIAButton "button featured" {{0, 730}, {134, 39}}
UIAButton "See the world" {{134, 730}, {223, 39}}
UIAButton "button my favorites" {{357, 730}, {180, 39}}
UIAButton "button settings" {{967, 736}, {33, 27}}
}
}
}

我正在使用 XCode 4.5.1。谁能帮我解决这个问题。谢谢

最佳答案

您是否使用 iOS 5.x 模拟器或 iOS 5.x 设备?如果是,那么我会看到同样的问题。我相信 Xcode 4.5.1 不喜欢 ScrollViews。

但是,我找到了解决方法。

我的元素看起来像:

target.frontMostApp().mainWindow().scrollViews()[0].buttons()["Wikipedia"]

因此,我没有直接访问按钮,而是尝试访问按钮的静态文本。

target.frontMostApp().mainWindow().scrollViews()[0].buttons()["Wikipedia"].staticTexts()["Wikipedia"].tap();

我希望这对你有用。

关于ui-automation - 在设备上测试时出现 scrollToVisible 错误,UIAutomation,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13200893/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com