Appium android。在 click/tap 之间设置自定义超时
Appium android. Set custom timeout between click/tap
我在 appium 1.7.2 上 python-client and trying to click on same element 3 times within 2 seconds. To do it I have tried to change "actionAcknowledgmentTimeout" to 400 milliseconds (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.
根据已接受的答案进行更新。以下代码片段无需任何额外操作即可正常工作。
action = TouchAction(self.driver)
action.press(el).release()
action.press(el).release()
action.press(el).release()
action.perform()
尝试使用 Touch 操作 TouchActions Python 并使用类似于 press(...).release().press(...).release().....
我在 appium 1.7.2 上 python-client and trying to click on same element 3 times within 2 seconds. To do it I have tried to change "actionAcknowledgmentTimeout" to 400 milliseconds (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.
根据已接受的答案进行更新。以下代码片段无需任何额外操作即可正常工作。
action = TouchAction(self.driver)
action.press(el).release()
action.press(el).release()
action.press(el).release()
action.perform()
尝试使用 Touch 操作 TouchActions Python 并使用类似于 press(...).release().press(...).release().....