How can I scroll up and select the year from the calendar

two ways:

  1. scroll to needed value using UiScrollable with providing direction of scroll! (cause needed year could be less or higher) and tap on it. Check examples at: http://appium.io/docs/en/writing-running-appium/tutorial/swipe-tutorial/
  2. in loop tap on element before / after current year and check if needed year appeared. appeared -> tap on it.

I’m trying like this: not work for me

MobileElement element = (MobileElement) driver.findElement(MobileBy.AndroidUIAutomator(
“new UiScrollable(new UiSelector().resourceIdMatches(”.* \n"
+ “android:id/text1\n”
+ “.*”).scrollable(true))" +
“.scrollIntoView(new UiSelector().text(“1991”))”));

your example not clear and wrong.

try:

// scroll to 2000 year
MobileElement element = (MobileElement) driver.findElement(MobileBy.AndroidUIAutomator(
                "new UiScrollable(new UiSelector().scrollable(true).setAsVerticalList()).scrollIntoView(new UiSelector().text(\"2000\"))"));

It’s gave me this error

this is not error. just warning that you do not use element later. you may add below:

element.click();

Now I tried but It’s not scroll till 1991

is it starting scroll? or nothing? you do not say anything = we do not understand you.

no, it’s not scrolling my calender view

Well switch to click and check new values.

I can’t understand please explain more.

for example current value: 1980 we need: 1990

in loop:

  • tap on last textView in above scrollView
  • 1990 text appeared -> tap on it and break

Can you please send me the sample code for it. It’s very appriciated.

It’s not scrolling. it should scroll.

i used below code, but its going till 2011 and again scrolling up to 2020.

driver.findElement(AppiumBy.androidUIAutomator(
“new UiScrollable(new UiSelector().scrollable(true))” +
“.scrollIntoView(new UiSelector().textContains(“1996”))”)).click();