How to long press until visibility of some element

I was wondering if i can you touch action to perform long press until visibility of some element or element to be clickable …etc

            .withElement(ElementOption.element (selectSFD)))
            .perform ();

could you help me with this

never tried. i believe it not possible to make.


This code won’t work. perform will be always executed only after wait.until is completed (or fail).

1 Like

This kind of UI interaction question comes up so often, I have to wonder what people were thinking when they signed up at this automation job. We need to make app develoeprs responsible for making apps easier to test. I really do feel sorry for you here, this is pretty common as a automation blocker. I really do feel your pain, I used to let this block me in the past.

You could try:

  1. get the developer to export a UI intent that fires the BH you want to validate.
  2. get them to give you another way of testing the same functionality
  3. decide whether your UI has got dissability/acessibility issues and start over
  4. Dont automate this test case in the way you are , but automate the same check in another way/route entirely.

When we automate the GUI, we are not really checking anything. Try and get your team to change their approach to “testing”.

what im saying is completely legit for my scenario, we have a responsive app that doing some action when you long press on some element and long press duration is random, thats why i want to make long press is more smart instead of stating specific long press duration

first you have to know the full scenario that is happening,

You can perform long press and try to find len(new_element) in a loop.

from appium.webdriver.common.touch_action import TouchAction
self.actions = TouchAction(driver)

element = self.driver.find_element_by_xxx('locator')
for i in range(5):
   element1 = self.driver.find_elements_by_xxx('locator1')
   if len(element1):
   take action on new element