How to get dynamic element while scrolling

Imagine you need to test youtube timeline preview while scrolling on it. For example you just need to ensure that preview window appears. In terms of appium, you have a driver instance that performs scroll action. And in the same time you need the same driver to check if preview element appears. When scroll is finished, there is no more preview window. The question is: is it really possible? If so, how can i achieve that? I tried to do this by using CompletableFuture and async task of JS, but no luck since there is only one instance of driver. Any thoughts would be appreciated.

Access to the accessibility is single-threaded, so I don’t think there is a simple way to achieve that. What I would do as a possible workaround. Before starting the scrolling - start recording video and finish recording when the scrolling is completed. Then analyze the recorded video and figure out whether the target element is visible using OCR.

thanks for the reply. Yes, without actual automation there are bunch of ways to achieve that. But my goal was to do that without checking it by myself. Even image comparison would not help cause it needs driver to take screenshot. Btw, do you know, maybe there is some other framework that can do such task?

I was talking about analysing a video, not a screenshot.

i get it, but it looks much more like manual testing since there is no result after automation test completed. anyway, thank you!

You could still analyse the video in your automated script. At the end it could be “decompiled” to a sequence of screenshots. Then. the task for the recognition system is to figure out if the destination element is present on one or more of these screenshots, which is not a very complicated challenge, for, let say, OpenCV lib

1 Like

oh this is a great idea! i will try it, thanks!