繁体   English   中英

使用Appium无法从底部滑动到顶部打开控制中心 iOS 15

[英]Using Appium unable to swipe from the bottom to the top to open control centre with iOS 15

我想使用iOS 15.1 使用 appium 1.22打开 iOS 控制中心(激活飞行模式)。 我使用的代码适用于iOS 14.8 我尝试使用 TouchAction 和 PointerInput Actions,结果相同。 屏幕在 15.1 上向上滚动,但控制中心没有出现。 任何帮助将不胜感激,我被 iOS 15 上的自动测试阻止了。

环境:
iOS 15
苹果 1.22

我的代码:

        Dimension d = driver.manage().window().getSize();
        int width = d.getWidth();
        int height = d.getHeight();

        int w = (int) (.5 * width);
        int swipeTo = (int) (height * 0.2);

        PointerInput finger = new PointerInput(PointerInput.Kind.TOUCH, "finger");
        Sequence swipeUpForControlCentre = new Sequence(finger, 1);
        swipeUpForControlCentre.addAction(finger.createPointerMove(Duration.ofMillis(0), PointerInput.Origin.viewport(), w, height));
        swipeUpForControlCentre.addAction(finger.createPointerDown(0));
        swipeUpForControlCentre.addAction(finger.createPointerMove(Duration.ofMillis(700),
                PointerInput.Origin.viewport(),w, swipeTo));
        swipeUpForControlCentre.addAction(finger.createPointerUp(0));
        driver.perform(Arrays.asList(swipeUpForControlCentre));

我最终做的是使用 driver.activateApp() 切换到 iOS 设置应用程序,然后切换回我正在测试的应用程序。 所以问题至少不再阻止我了。 我喜欢使用控制中心来做各种事情。 那好吧...

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM