【问题标题】:Using Appium unable to swipe from the bottom to the top to open control centre with iOS 15iOS 15使用Appium无法从下向上滑动打开控制中心
【发布时间】:2022-03-15 18:40:53
【问题描述】:

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

环境:
iOS 15
appium 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));

【问题讨论】:

    标签: java ios appium appium-ios


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2016-10-20
      • 2015-05-13
      • 2015-09-03
      • 2020-08-06
      • 2016-10-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-02-07
      相关资源
      最近更新 更多