我想在屏幕上向下滚动,但我似乎做不好。Appium的原始方式如下:
actions = TouchAction(driver)
actions.scroll_from_element(element, 10, 100)
actions.scroll(10, 100)
actions.perform()
我的代码是:
actions = TouchAction(self.driver)
actions.scroll_from_element('com.android.dialer.dialers', x=90, y=1330)
actions.scroll(x=90, y=170)
actions.perform()
但是,我收到以下错误消息:
line 133, in test_app
scroll.scroll_from_element('com.android.dialer.dialers', x=90, y=1230)
AttributeError: 'TouchAction' object has no attribute 'scroll_from_element'
很可能是因为appium python客户端没有
scroll_from_element
函数而出现错误。你知道吗滚动屏幕的第一种方法是找到2个元素,然后从一个元素滚动到另一个元素。你知道吗
如果要移动到具有偏移的图元,可以按以下方式进行:
其中offsetX,offsetY代表移位。你知道吗
如果您的应用程序具有可滚动视图,则可以使用find+UIAutomator2定位器滚动到所需元素:
当然,最好用
uiselector().resourceid(elementId)
替换UiSelector().text("Element text")
我建议检查客户回购中的官方functional tests作为工作示例
相关问题 更多 >
编程相关推荐