在一次项目中,appium要对某个按钮进行长按操作(大于2s),类似拍微信小视频,参考网上长按视频会报错

action1 = TouchActions(self.driver)  
el = self.driver.find_element_by_name('按住拍')  
action1.long_press(el).wait(10000).perform() 

报错如下:

Appium中长按按钮操作

 

解决方法,使用以下代码可以解决:

action1=TouchActions(self.driver)
e1=self.driver.find_element_by_name('按住拍')
action1.tap_and_hold(540,1800).perform()
time.sleep(10)
action1.release(540.1800).perform()

 特此记录!!

相关文章:

  • 2022-01-12
  • 2022-12-23
  • 2022-12-23
  • 2021-04-06
  • 2022-12-23
  • 2021-05-19
  • 2021-12-06
  • 2022-02-23
猜你喜欢
  • 2022-12-23
  • 2021-06-23
  • 2021-11-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-03-09
相关资源
相似解决方案