I want to scroll to the element and click on it

There is a element which is not visible, but after scrolling it is visible.

Sometimes it appears even before scrolling, sometimes after scrolling.

how to apply the logic,the element should able to click, such that it should even before and after the element is visible.

You could do something like this:

// first try if the element is clickable
try {
} catch (ElementNotFoundException e) {
//if element is not present

// and then try again

or something on these similar lines. There are some deprecated API’s like scrollTo() and scrollToExact(), which you might want to try if it helps.


Put a while or for loop for a while, and scroll down until the element to be appeared.


scroll Action();


thnks you so much, i will try both the code and check which one is working

in case your element located inside scrollable view, you can use following locator:

@AndroidFindBy(uiAutomator = “new UiScrollable(.scrollable(true))” +

check out android documentation about UiScrollable and other uiautomator selectors UiScrollable  |  Android Developers

could u please elabarate on how to mention the id or xpath or the className

could you please spend some time studying the link i provide above?

I went through that link

the following code i wrote but it is not working

@AndroidFindBy(uiAutomator = “new UiScrollable(.scrollable(true))” +
public WebElement StatusOfAssignment1;

public void ClickOnAssignmentButton() throws InterruptedException{


org.openqa.selenium.UnsupportedCommandException: The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 3.90 seconds