我正在尝试使用 appium 设置自动化测试环境,但是遇到了麻烦。我看到的问题是 appium 正在提取包含 .app 目录的 zip,但随后声称它找不到 .app。我的平台是mac。确切的错误如下:
info: Unzipping /var/folders/0s/0kz_6kb13f35wxwjxkff9sdw0000gn/T/appium-app113922-2258-1ap6o7i.zip
info: Testing zip archive: /var/folders/0s/0kz_6kb13f35wxwjxkff9sdw0000gn/T/appium-app113922-2258-1ap6o7i.zip
info: Zip archive tested clean
info: Unzip successful
info: Got configuration error, not starting session
error: Failed to start an Appium session, err was: App zip unzipped OK, but we couldn't find a .app bundle in it. Make sure your archive contains the .app package and nothing else
info: Responding to client with error: {"status":6,"value":{"message":"A session is either terminated or not started","origValue":"App zip unzipped OK, but we couldn't find a .app bundle in it. Make sure your archive contains the .app package and nothing else"},"sessionId":null}
我不确定我的代码是否做错了,下面是我的 setup() 方法的内容(基本上是从官方示例中复制的)。
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("device", "8b0949a1d3fe5d7283cc46ca5470acd67d6c5d7b");
File app = new File("/Users/user/path/to/zip");
capabilities.setCapability("version", "7.0");
capabilities.setCapability("app", app.getAbsolutePath());
driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"),
capabilities);
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);