Python Appium中的长单击方法

2024-04-29 16:57:59 发布

您现在位置:Python中文网/ 问答频道 /正文

在Python上的Appium中有没有长单击方法? 我需要长时间点击我程序中的区域。在

  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()

Tags: 方法self程序comid区域bydef
2条回答
from appium.webdriver.common.touch_action import TouchAction

actions = TouchAction(driver)
actions.long_press(element)
actions.perform()

有关详细信息https://appium.readthedocs.io/en/stable/en/commands/interactions/touch/long-press/

(Python)查找TouchAction。可以将命令串在一起:

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()

相关问题 更多 >