Perform action is not worked for me too. I found the way with custom method. That my example in Python.
def scroll_to_element(self, locator: str, timeout=2):
by = get_locator_by_string(locator)
def elem_none():
try:
WebDriverWait(self._driver, timeout).until(
ex_cond.invisibility_of_element_located(by), ' : '.join(by))
return True
except TimeoutException:
return False
for _ in range(10):
if elem_none() is True:
size = self._driver.get_window_size()
startx, starty = int(size['width']) * 0.5, int(size['height']) * 0.8
endx, endy = int(size['width']) * 0.5, int(size['height']) * 0.2
self._driver.swipe(startx, starty, endx, endy, 1000)
if elem_none() is False:
break
else:
continue
My method is swiping 10 times. You can changed it to while
but it is a bad way - test won't be ended if element won't be found.
This way works for me all times and it is enough for me. Hope it will be helpful for you!