我在appium 1.7.2上使用python-client并试图在2秒内点击相同的元素3次。为此,我尝试将“actionAcknowledgmentTimeout”更改为400毫秒(found in docs)。我猜默认后端是UIAutomator2。那么它是一个bug还是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.
根据接受的答案进行更新。以下代码片段工作正常,没有任何额外的动作。
action = TouchAction(self.driver)
action.press(el).release()
action.press(el).release()
action.press(el).release()
action.perform()