Hi, I need to open in IOS real device the switcher app while running my appium test.
I try to use AssistiveTouch but i cannot press on it (appium cannot see it)
How can i do it ?
Thanks!
Hi, I need to open in IOS real device the switcher app while running my appium test.
I try to use AssistiveTouch but i cannot press on it (appium cannot see it)
How can i do it ?
Thanks!
Not sure about app switcher, but if you want to open another app use “activate_app”:
https://appium.github.io/appium.io/docs/en/commands/device/app/activate-app/
You’ll need the bundle id of the app you want to open. Here is a list of iOS native bundle id’s:
Example of code to swipe from bottom to centre.
// Java
// java-client: 9.3.0
// iOS version: 18
// find screen element
WebElement el = getDriver().findElement(AppiumBy.className("XCUIElementTypeApplication"));
// calculate coordinates
Rectangle rectangle = el.getRect();
int startX = rectangle.x + (rectangle.width / 2);
int startY = rectangle.y + rectangle.height - 5;
int endX = rectangle.x + (rectangle.width / 2);
int endY = rectangle.y + (rectangle.height / 2);
Logger.log("X: '" + startX + "', Y: '" + startY + ", endX: " + endX + "', endY: '" + endY + "'");
// perform swipe
PointerInput finger = new PointerInput(PointerInput.Kind.TOUCH, "finger");
Sequence tapSeq = new Sequence(finger, 1);
tapSeq.addAction(finger.createPointerMove(Duration.ofMillis(0),
PointerInput.Origin.viewport(), startX, startY));
tapSeq.addAction(finger.createPointerDown(PointerInput.MouseButton.LEFT.asArg()));
tapSeq.addAction(finger.createPointerMove(Duration.ofMillis(200),
PointerInput.Origin.viewport(), endX, startY));
tapSeq.addAction(finger.createPointerMove(Duration.ofMillis(1000), // wait a bit to call Switcher
PointerInput.Origin.viewport(), endX, endY));
tapSeq.addAction(finger.createPointerUp(PointerInput.MouseButton.LEFT.asArg()));
getDriver().perform(Arrays.asList(tapSeq));
Video →
Thanks!!!
ITs help me a lot