Uiautomator2 not working

I am trying to scroll the screen with below code ,this below code first refresh the screen first then move down and given the exception

MobileElement element1 = (MobileElement) driver.findElement(MobileBy.AndroidUIAutomator
(“new UiScrollable(new UiSelector().scrollable(true).instance(0)).”
+ “scrollIntoView(new UiSelector().text(”" + Text + “”).instance(0))"));

Try choose other ways of scrolling mentioned http://appium.io/docs/en/writing-running-appium/tutorial/swipe-tutorial/

I have try all the option in given article but in all option it refresh then screen first after that it
does not gone down properly and gives error .
and please tell me any approach to scroll through javascriptexecutor

i am using android mobile to test application

appium:-1.17.1
java client:-4.1.2

If you need just scroll screen then first examples without uiscrollable should work.

Give more details of your problem. Does your scroll horizontal or vertical, you need move down or up and so on. Are any other scrollViews visible…

PS did you try incease scroll tries in uiscrollable?

scroll is vertical and i am doing scroll up to down and no scrolling after 2 scroll and getting exception no element found and in appium locator attribute scrollable display false.

how to increase scroll tries in uiscrollable?

See above link: Android ‘UIScrollable’ swipe: Simple example -> “Long view” example

Thanks Aleksi i just try and let you know

i have tried below code and its working but I want scroll will be stop on particulal text .after terminate the code scrolling continuous and it will work only for full text not for textcontains.

MobileElement element = (MobileElement) driver.findElement(MobileBy.AndroidUIAutomator(
“new UiScrollable(new UiSelector().scrollable(true)).setMaxSearchSwipes(30)” +
“.scrollIntoView(new UiSelector().text(“You”))”));

I have tried below code and its working sometimes scroll and sometimes not

MobileElement element = (MobileElement) driver.findElement(MobileBy.AndroidUIAutomator(
“new UiScrollable(new UiSelector().scrollable(true))” +
“.scrollIntoView(new UiSelector().textContains(”@"))"));

what i will do please suggest me

It is pure native uiscrollable search. If it works not reliable switch to simple swipe and check that element needed found.

Please suggest which code should i use and please tell me any java client version issue
and what happen in mycode first it swipe the screen refresh from down to up then scroll down

Give me some idea

In my application, there are multiple social feeds (combined in single page).
I Would like to perform like/comment action on particular feed (on any of either social media platform) e.g. twitter.
I am unable to scroll to highlighted feed which is not visible.
So, i tried many combinations one from which i have already mentioned above.
but whenever script executed, it pulls page down (refresh loader looks for second) and then it just scrolls slightly up.
Also, i can see scrollable property is true for one element in 1st image.
Don’t know where its creating issue.

Could you please help on this?

If i tested such functionality i will make it in following way:

  1. All names are unique
  2. Scroll by name with uiScrollable
  3. If comment needed then i will use small scroll of all screen. See example in above link. Small scroll will move whole item a bit to make 100% comment field visible.

@Aleksei Can u please give the example how we can implement this in our code.So that it will be very use full for me to understand on your given above points

how to use Scroll by name with uiScrollable?

@Aleksei My problem has been resolved .thanks for help

Add your solution for others if it differs from mine.

yes i have just add wait to resolve issue

driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);

and please let me know how to get css in android because css is not working in appium 1.17.1 version i got the error

Css finder working. You just need switch to webView.

can u give me some example So that i can easily understand

First - does your app has webViews?

Our application has native app