We are building a new experience for our SmartBear Community.
This site is now read-only. You can still browse and search as usual. Learn More
This site is now read-only. You can still browse and search as usual. Learn More
Hi, I am unable to press on numpad and also unable to scroll down when trying automation in java code. (Java, server side appium)
I have tried these after searching online but does not work for me.
Numpad
//wd.pressKey(new KeyEvent(AndroidKey.DIGIT_0));
//wd.findElement(MobileBy.AndroidUIAutomator("new UiSelector().text(\"1\")")).click();
//wd.pressKeyCode(8);
//wd.pressKey(new KeyEvent(AndroidKey.NUMPAD_1));
Scroll down
//String targetText = "Measurements";
//wd.findElementByAndroidUIAutomator("new UiScrollable(new UiSelector().scrollable(true).instance(0)).scrollIntoView(new UiSelector().textContains(\""+targetText+"\").instance(0))");));
Thank you.
Suggested approach is:
final var finger = new PointerInput(PointerInput.Kind.TOUCH, "finger");
var start = new Point(188, 563);
var end = new Point (198, 264);
var swipe = new Sequence(finger, 1); swipe.addAction(finger.createPointerMove(Duration.ofMillis(0), PointerInput.Origin.viewport(), start.getX(), start.getY())); swipe.addAction(finger.createPointerDown(PointerInput.MouseButton.LEFT.asArg())); swipe.addAction(finger.createPointerMove(Duration.ofMillis(1000), PointerInput.Origin.viewport(), end.getX(), end.getY())); swipe.addAction(finger.createPointerUp(PointerInput.MouseButton.LEFT.asArg()));
driver.perform(Arrays.asList(swipe));