Closed mafahn closed 3 weeks ago
How about driver.execute_script("flutter:longTap", finder, {"durationMilliseconds": 3000, "frequency": 60})
?
Similar to https://github.com/appium/appium-flutter-driver/blob/main/example/python/example.py#L40
Thanks, @KazuCocoa!
After revisiting the example you linked, I noticed the difference in handling the element parameter. Originally, I passed element.id
in my long_tap_params
, but in the example, the entire element
object was used instead.
Updating my code to pass element
directly instead of element.id
resolved the issue, and now the durationMilliseconds
parameter is correctly recognized. Thanks again for the help — much appreciated!
Here’s the working code snippet; __get_element_by_key
returns a FlutterElement
object:
element = self.__get_element_by_key(driver, value_key, timeout=timeout)
driver.execute_script(
"flutter:longTap",
element,
{
"durationMilliseconds": press_duration,
"frequency": 60
}
)
I'm working with the Appium Python client to test a Flutter app, and I'm looking for a way to perform a long tap. I've already found the implementation in the
scroll.ts
file in this project for thelongTap
function and built up my Python command using theexecute_script
function, based on the required arguments in the ts-file function definition.Additionally, I've verified that the Appium Python client creates the expected request by capturing the request with Wireshark. The following is transmitted to Appium and matches my expectations:
Unfortunately, I get the response that the argument
durationMilliseconds
is not correct:Has anyone had experience performing a long tap using the Appium Python client, or can anyone help me understand what's wrong?