Dimension ScreenSize = driver.manage().window().getSize();
// System.out.println(ScreenSize);
// Current device size (720, 1465) //
//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
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()));
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
Чтобы прокручивать до тех пор, пока он не выйдет из цикла, но проблема, с которой я сталкиваюсь, заключается в том, что во время прокрутки он нажимает на элемент и прокручивает страницу этого элемента. И я не могу понять, что это происходит!
Исследовал, менял скрипт, добавлял Thread.sleep и многое другое, но безрезультатно.
Я использую скрипт: [code]Dimension ScreenSize = driver.manage().window().getSize(); // System.out.println(ScreenSize); // Current device size (720, 1465) //
//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 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()));
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] Чтобы прокручивать до тех пор, пока он не выйдет из цикла, но проблема, с которой я сталкиваюсь, заключается в том, что во время прокрутки он нажимает на элемент и прокручивает страницу этого элемента. И я не могу понять, что это происходит! Исследовал, менял скрипт, добавлял Thread.sleep и многое другое, но безрезультатно.
Когда я запускаю скрипт в качестве облачной функции, он может найти имя задания, но когда я запускаю его в облачных заданиях, он не может найти имя задания.
Что именно я делаю неправильно?
httpRequest: {1}
insertId: 8vr1cwfi77fef
jsonPayload: {...
Когда я запускаю скрипт в качестве облачной функции, он может найти имя задания, но когда я запускаю его в облачных заданиях, он не может найти имя задания.
Что именно я делаю неправильно?
httpRequest: {1}
insertId: 8vr1cwfi77fef
jsonPayload: {...
Когда я запускаю скрипт в качестве облачной функции, он может найти имя задания, но когда я запускаю его в облачных заданиях, он не может найти имя задания.
Что именно я делаю неправильно?
httpRequest: {1}
insertId: 8vr1cwfi77fef
jsonPayload: {...