0

I am using selendroid and python to do automation test on the app, the app is running on Android system and on the SAMSUNG S6, I want to write a script to simulate the long press gesture on an element in the app. i am using TouchAction-> long_press method to do it, but I do not know why the test always stop at this method. it is not crash, no error, it is just stuck at there forever, can somebody help me with that, thank you very much!

Here is the code:

touch_action = TouchActions(self.driver)
element = self.driver.find_element_by_xpath("(//LinearLayout)[1]")
touch_action.long_press(element).perform()
GrIsHu
  • 29,068
  • 10
  • 64
  • 102
user2823793
  • 203
  • 1
  • 2
  • 5
  • Just a question. This long press action is on a new screen? I mean you change the view and you are trying to long click on a new element? – Madis Kangro Jul 17 '15 at 13:42
  • yes, I open a new view, and then try to long_press on one of the element – user2823793 Jul 17 '15 at 17:44
  • Then i think the problem lies here. find_element_by_xpath("(//LinearLayout)[1]"). This element probably exists in the old view also. Which means selendroid is trying to do the long_press on the old view element. You could try a thread sleep before going to a new view. Like 10 seconds just incase or try to find the element with a value, id etc. Example: find_element_by_xpath("//LinearLayout[@value='Example']") – Madis Kangro Jul 17 '15 at 18:04

0 Answers0