Android App - Not able to scroll and click on button element

pls find the screen shot for reference. i am not able to scroll down to exact position of “donate now” button of android app. If i try to scroll also then it take me to more down in page and not in exact position of donate now button. Currently tried with function “scrollToText” but it did not worked.

Screen Shot 2018-05-11 at 4.55.55 PM.png

Screen Shot 2018-05-11 at 4.55.32 PM.png

Hi, you can use this keyword for scrolling to button and after that Mobile.tap keyword for tap on the button

import io.appium.java_client.MobileDriver

import io.appium.java_client.MobileElement as MobileElement
import io.appium.java_client.TouchAction
import io.appium.java_client.AppiumDriver as AppiumDriver@Keyworddef scrollToElementWithText(String elementsText, float toTopPosition = 0.8 * Mobile.getDeviceHeight()){ def categoryText = findTestObject(‘ObjectRepositort/textViewEquals’, [(“text”) : elementsText]) // some object in the repository with property text = ${text} condition = equals, detected by class+text AppiumDriver<?> driver = MobileDriverFactory.getDriver()
while (((Mobile.waitForElementPresent(categoryText, 2, FailureHandling.STOP_ON_FAILURE) == true) &&
(Mobile.getElementTopPosition(categoryText, 2, FailureHandling.CONTINUE_ON_FAILURE) <= toTopPosition)) == false) TouchAction ta = new TouchAction(driver), 1430).waitAction().moveTo(5, 1200).release().perform() }}