1

Is there any long click method in Appium on Python? I need to long click on the area in my program.

  def testDevice1(self):

   password = self.driver.find_element_by_id('com.e.eas.android:id/password')
   password.send_keys('111111')
   time.sleep(5)
   password = self.driver.find_element_by_id('com.e.eas.android:id/password').longClick()
user2771350
  • 37
  • 1
  • 7

3 Answers3

0

(Python) look up TouchAction. you can string commands together:

from appium.webdriver.common.touch_action import TouchAction
ta = TouchAction(driver)
ta.press(x=x, y=y).release().perform()

# some_web_obj = driver.find...
ta.press(some_web_obj).wait(duration_in_millisec).release().perform()
jwallis
  • 75
  • 1
  • 9
0
from appium.webdriver.common.touch_action import TouchAction

actions = TouchAction(driver)
actions.long_press(element, duration=press_duration_in_ms)
actions.perform()

For more information https://appium.readthedocs.io/en/stable/en/commands/interactions/touch/long-press/

Community
  • 1
  • 1
Nafeez Quraishi
  • 5,380
  • 2
  • 27
  • 34
0

Working solution with: Python 3.x, Appium 1.22.3, Mac M1

  • Long press on iOS can be achieve using snippet

TouchAction(driver).long_press(element).release().perform()