【发布时间】:2018-04-03 21:48:46
【问题描述】:
我正在使用 python-client 使用 appium 1.7.2,并尝试在 2 秒内单击同一元素 3 次。为此,我尝试将 "actionAcknowledgmentTimeout" 更改为 400 毫秒 (found in docs)。我猜默认后端是 UIAutomator2。那么它是一个错误还是 UIAutomator2 不支持 actionAcknowledgmentTimeout?感谢任何指针
cfg = Config.instance()
self.driver = webdriver.Remote(
command_executor="http://127.0.0.1:4723/wd/hub",
desired_capabilities= {
"app": cfg.apk_path,
"platformName": cfg.platform_name,
"platformVersion": cfg.platform_version,
"deviceName": cfg.device_name
})
# inject Id
self.session_id = self.driver.session_id
# tweak delays
androidTimeoutParams = {
"settings": {
"actionAcknowledgmentTimeout": 400,
}
}
self.driver.execute(MobileCommand.UPDATE_SETTINGS, androidTimeoutParams)
# check what we have after update
settings = self.driver.execute(MobileCommand.GET_SETTINGS, {})
print(settings)
根据日志,点击之间的默认超时时间约为 3 秒。
点击的示例代码。
el = self.driver.find_element(*Locators.HIDDEN_BUTTON)
#three taps on hidden menu
el.click() # expect 400 ms timeout but get 3000ms
el.click() # same
el.click() # same.
根据接受的答案更新。以下代码 sn-p 工作得很好,没有任何额外的动作。
action = TouchAction(self.driver)
action.press(el).release()
action.press(el).release()
action.press(el).release()
action.perform()
【问题讨论】:
标签: appium ui-automation appium-android