tried with your instruction , but shows error, any help
Remove self. From the script.
In Latest Version They Have Said That This Is Deprecated So What Is New Method Or Have You Use It?
Im using
driver.find_element(by=AppiumBy.ANDROID_UIAUTOMATOR,value='new UiScrollable(new UiSelector().scrollable(true).instance(0)).scrollIntoView(text("Desired Text"))')
the problem is the scroll is scrolling up, not scroll down.
Edit:
Solved with https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable#scrollBackward()
This should work.
"
def scroll_down_to_element(element_locator, max_swipes=10):
for _ in range(max_swipes):
try:
element = WebDriverWait(driver, 3).until(EC.presence_of_element_located((By.XPATH, element_locator)))
if element.is_displayed():
break
except Exception as e:
pass # Element not found, continue scrolling
# Swipe up
size = driver.get_window_size()
start_y = size['height'] * 0.8
end_y = size['height'] * 0.2
driver.swipe(size['width'] // 2, start_y, size['width'] // 2, end_y, 1000) "