4

Code for Pinch:

def contract(self, from_loc_up, from_loc_down):
    window_size = self.driver.get_window_size()
    xx = window_size["width"] / 2
    yy = window_size["height"] / 2
    yy_d = (from_loc_down - from_loc_up) / 2
    action1 = TouchAction(self.driver)
    action1.long_press(x=xx, y=yy - yy_d).move_to(x=0, y=100).wait(500).release()
    action2 = TouchAction(self.driver)
    action2.long_press(x=xx, y=yy + yy_d).move_to(x=0, y=-100).wait(500).release()
    m_action = MultiAction(self.driver)
    m_action.add(action2, action1)
    m_action.perform()

For some reason,this code which should pinch does not do so,instead zooms a bit.

whereas the similar code for zoom works fine.

Code for Zoom:

def zoom(self, to_loc):
    window_size = self.driver.get_window_size()
    xx = window_size["width"] / 2
    yy = window_size["height"] / 2
    to = abs(to_loc - yy)
    action1 = TouchAction(self.driver)
    action1.long_press(x=xx, y=yy).move_to(x=0, y=-to).wait(100).release()
    action2 = TouchAction(self.driver)
    action2.long_press(x=xx, y=yy).move_to(x=0, y=to).wait(100).release()
    m_action = MultiAction(self.driver)
    m_action.add(action1, action2)
    m_action.perform()

Any idea why multiaction is failing for pinch but works fine for zoom. The appium logs seem fine though!!!!!!!

vks
  • 67,027
  • 10
  • 91
  • 124

0 Answers0