I am using Below script:
Dimension ScreenSize = driver.manage().window().getSize();
// System.out.println(ScreenSize);
// Current device size (720, 1465)//
<code>//Finding Starting point/mid of the screen size
int Xaxis = ScreenSize.getWidth() / 2;
int Yaxis = ScreenSize.getHeight() / 2;
//Finding End Point of the finger swipe
//In this we assumpting the size of 1000 and diving in 4 sides. So, 250 1 4th of the screen size
int Xend = Xaxis;
int Yend = (int) (ScreenSize.getHeight() * 0.25);
//Adding the pointer then using to create a Sequence
PointerInput Touch = new PointerInput(PointerInput.Kind.TOUCH, "Touch");
//Adding the Sequence of Action
</code>
<code>//Finding Starting point/mid of the screen size
int Xaxis = ScreenSize.getWidth() / 2;
int Yaxis = ScreenSize.getHeight() / 2;
//Finding End Point of the finger swipe
//In this we assumpting the size of 1000 and diving in 4 sides. So, 250 1 4th of the screen size
int Xend = Xaxis;
int Yend = (int) (ScreenSize.getHeight() * 0.25);
//Adding the pointer then using to create a Sequence
PointerInput Touch = new PointerInput(PointerInput.Kind.TOUCH, "Touch");
//Adding the Sequence of Action
</code>
//Finding Starting point/mid of the screen size
int Xaxis = ScreenSize.getWidth() / 2;
int Yaxis = ScreenSize.getHeight() / 2;
//Finding End Point of the finger swipe
//In this we assumpting the size of 1000 and diving in 4 sides. So, 250 1 4th of the screen size
int Xend = Xaxis;
int Yend = (int) (ScreenSize.getHeight() * 0.25);
//Adding the pointer then using to create a Sequence
PointerInput Touch = new PointerInput(PointerInput.Kind.TOUCH, "Touch");
//Adding the Sequence of Action
<code>
````` `` `````
`Sequence Action = new Sequence(Touch, 0);`
`for (int i = 0; i < 5; i++) {`
`Action.addAction(Touch.createPointerMove(Duration.ZERO, PointerInput.Origin.viewport(), Xaxis, Yaxis))`
`.addAction(Touch.createPointerDown(PointerInput.MouseButton.LEFT.asArg()))`
`.addAction(new Pause(Touch, Duration.ofSeconds(1)))`
`.addAction(Touch.createPointerMove(Duration.ofMillis(1000), PointerInput.Origin.viewport(), Xend, Yend))`
`.addAction(Touch.createPointerUp(PointerInput.MouseButton.LEFT.asArg()));`
</code>
<code>
````` `` `````
`Sequence Action = new Sequence(Touch, 0);`
`for (int i = 0; i < 5; i++) {`
`Action.addAction(Touch.createPointerMove(Duration.ZERO, PointerInput.Origin.viewport(), Xaxis, Yaxis))`
`.addAction(Touch.createPointerDown(PointerInput.MouseButton.LEFT.asArg()))`
`.addAction(new Pause(Touch, Duration.ofSeconds(1)))`
`.addAction(Touch.createPointerMove(Duration.ofMillis(1000), PointerInput.Origin.viewport(), Xend, Yend))`
`.addAction(Touch.createPointerUp(PointerInput.MouseButton.LEFT.asArg()));`
</code>
````` `` `````
`Sequence Action = new Sequence(Touch, 0);`
`for (int i = 0; i < 5; i++) {`
`Action.addAction(Touch.createPointerMove(Duration.ZERO, PointerInput.Origin.viewport(), Xaxis, Yaxis))`
`.addAction(Touch.createPointerDown(PointerInput.MouseButton.LEFT.asArg()))`
`.addAction(new Pause(Touch, Duration.ofSeconds(1)))`
`.addAction(Touch.createPointerMove(Duration.ofMillis(1000), PointerInput.Origin.viewport(), Xend, Yend))`
`.addAction(Touch.createPointerUp(PointerInput.MouseButton.LEFT.asArg()));`
<code> try {
driver.perform(Collections.singletonList(Action));
Thread.sleep(1000); // Pause between scrolls
} catch (Exception e) {
e.printStackTrace();
// Handle or log the exception as needed
}
}
Thread.sleep(3000); // Wait at the end
</code>
<code> try {
driver.perform(Collections.singletonList(Action));
Thread.sleep(1000); // Pause between scrolls
} catch (Exception e) {
e.printStackTrace();
// Handle or log the exception as needed
}
}
Thread.sleep(3000); // Wait at the end
</code>
try {
driver.perform(Collections.singletonList(Action));
Thread.sleep(1000); // Pause between scrolls
} catch (Exception e) {
e.printStackTrace();
// Handle or log the exception as needed
}
}
Thread.sleep(3000); // Wait at the end
}
To Scroll until it exist from the loop but the problem i am facing is during the scrolling, it clicking on the element and scrolling on that element page.
And i am unable to understand what this happening !`
`Explored, changed script, add the thread.sleep and many thing but no result