How to get total count of visible and non visible element in list

How to count all element in list as I am only getting count of visible element on screen there is a scrollable list having same ID for a element I want to get all count from list but only getting count which is visible on screen at that time. So for now I can only perform some action for visible element on screen.

Regards,
Vaibhav

Does this scrollable list have an end?
It could be endlessly scrollable, isn’t it?
If it is endless, how can we count the number of undetermined number of elements in it? — No, you can’t.
I guess, you should try alternative way of processing without knowing total count.

For example, you can use the programming concept of “Generator”. Taking an “Generator” example from Generators with Java 8 | The Canny Coder, you can copy & paste the following code into a blank Test Case in Katalon Studio, and run it.

public class Squares2 {
	private int i = 1;
	public int next() {
		int thisOne = i++;
		return thisOne * thisOne;
	}
	public List<Integer> nextN(int n) {
		List<Integer> l = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			l.add(next());
		}
		return l;
	}
}

Squares2 squareGenerator = new Squares2()
squareGenerator.nextN(10).forEach { entry -> println entry}
squareGenerator.nextN(10).forEach { entry -> println entry}
squareGenerator.nextN(10).forEach { entry -> println entry}
// and more repeats

Please note that this code does not assume to know the total count of entries of data to process. This code generates 10 entries from the source per each call of nextN(10), and process the returned List. When finished, you can continue to the next set. When finished, you can continue to the next set. … you can continue as many times as you want. You need not to know the total number of entries at all. The “Generator” concept will apply to the list of entries from the eternally scrollable UI widget.