使用appium访问iOS控制中心

Cha*_*man 13 automation swipe ios appium control-center

我正在尝试使用appium和以下代码打开控制中心:

    int halfWidth = driver.manage().window().getSize().width / 2;
    int screenHeight = driver.manage().window().getSize().height;
    driver.swipe(halfWidth, screenHeight-5, halfWidth, screenHeight-300, 500);  // driver is instance of IOSDriver
Run Code Online (Sandbox Code Playgroud)

应用程序只是从底部向上绘制屏幕(使用坐标输入),而不是打开控制中心.任何人都知道如何使用appium和滑动(或任何其他方式)打开控制中心?

谢谢,查理

Shi*_*ppa 5

我们可以完成这个。我在Appium 1.4.13中尝试过,并且能够更改设置。

我使用以下代码更改了iPadAir2中的设置。

int height = driver.findElementByClassName("UIAWindow").getSize().getHeight();
int width = driver.findElementByClassName("UIAWindow").getSize().getWidth();
driver.swipe(width-100, height, width-100, height-200, 500);
driver.findElementByAccessibilityId("Wi-Fi").click();
Run Code Online (Sandbox Code Playgroud)


Cha*_*man -1

好吧,经过大量调查后,我认为这是不可能的。如果您确实需要此功能,那么我认为像茄子这样的工具可能比较合适。