简体   繁体   English

使用模拟器进行iOS应用自动化

[英]Ios app automation using a simulator

public static AppiumDriver wd;
public static void main(String[] args) throws IOException {
    // TODO Auto-generated method stub
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability("appium-version", "1.0");
    capabilities.setCapability("platformName", "iOS");
    capabilities.setCapability("platformversion", "8.3");
    capabilities.setCapability("deviceName", "iPhone5");
    // capabilities.setCapability("app", "CustomFurnish");
    File appDir = new File("\\Users\\cloudgust\\dev\\bluebox\\iphone-app\\CustomFurnish.xcodeproj");
    File app = new File(appDir, "CustomFurnish.xcodeproj");
    //File file = new File("/Users/cloudgust/dev/bluebox/iphone-app/CustomFurnish.xcodeproj");
    capabilities.setCapability("app", app.getAbsolutePath());
    wd = new IOSDriver(new URL("http://127.0.0.1:4723/wd/hub"),capabilities);

When I give the above and run the project my console shows an error 当我给出以上内容并运行项目时,控制台显示错误

Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: A new session could not be created. 线程“主”中的异常org.openqa.selenium.SessionNotCreatedException:无法创建新的会话。 (Original error: Bad app: /Users/cloudgust/Documents/workspace/iosautomation/\\Users\\cloudgust\\dev\\bluebox\\iphone-app\\CustomFurnish.xcodeproj/CustomFurnish.xcodeproj. App paths need to be absolute, or relative to the appium server install dir, or a URL to compressed file, or a special app name. cause: Error: Using local app, but didn't end in .zip, .ipa or .app) (WARNING: The server did not provide any stacktrace information). (原始错误:错误的应用程序:/ Users / cloudgust / Documents / workspace / iosautomation / \\ Users \\ cloudgust \\ dev \\ bluebox \\ iphone-app \\ CustomFurnish.xcodeproj / CustomFurnish.xcodeproj。应用程序路径必须是绝对路径,或相对于appium服务器安装目录,压缩文件的URL或特殊的应用程序名称原因:错误:使用本地应用程序,但未以.zip,.ipa或.app结尾(警告:服务器未提供任何内容stacktrace信息)。

Basically what I'm trying to do is I have app written in xcode on a mac , I want to run it in automated tests using appium . 基本上,我想做的是在Mac上用xcode编写应用程序,我想使用appium在自动化测试中运行它。 but when im doing it I encounter with tat error. 但是当我这样做时,我遇到了tat错误。 can someone please help . 有人可以帮忙吗?

TIA, Sampath TIA,Sampath

This might be because the path of the ios app you provided in File appDir doesn't end with .app or .ipa extension. 这可能是因为您在File appDir中提供的ios应用程序的路径未以.app或.ipa扩展名结尾。 It must contain the path up to the application code with extension .ipa or .app. 它必须包含扩展名为.ipa或.app的应用程序代码的路径。

You must build the project and generate a .app file, then point appium to that path. 您必须构建项目并生成一个.app文件,然后将appium指向该路径。

To build on command line you can use xcodebuild 要在命令行上构建,您可以使用xcodebuild

Here are some example of command like arguments and such: Apple xcodebuild 以下是一些类似参数的命令示例: Apple xcodebuild

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

相关问题 如何使用Java中的iOS模拟器自动为iOS移动应用程序滑动手势? - How to automate swipe gestures for iOS mobile app using iOS simulator in java? 应用程序在ios中启动和关闭以实现appium自动化 - App launches and closes in ios for appium automation 我们可以通过使用resource-id / ID uisng appium来进行ios webview应用自动化吗 - can we do ios webview app automation by using resource-id/ID uisng appium 如何使用适用于iOS appium的UI自动化JavaScript参考获取本机应用程序字体类型或样式 - how to get the native app font type or style using UI Automation JavaScript Reference for iOS appium 无论如何,是否可以使用 selenium 在单个脚本中混合 ios 自动化和 Web 自动化 - Is there anyway to mix ios automation and web automation in a single script using selenium 使用Java的Appium iOS自动化:使用可访问性ID获取元素? - Appium iOS automation using Java : get element using accessibility Id? 使用Java的Appium iOS自动化:具有辅助功能ID的所有元素 - Appium iOS automation using Java: All Elements that have Accessibility ID 使用Selenium / Appium在iOS模拟器上启用/禁用Wifi - Enable/Disable Wifi on iOS simulator using selenium/Appium 如何在模拟器上使用 Appium 1.21.0 单击 IOS 警报框上的“确定”? - How to click "OK"on IOS alert box using Appium 1.21.0 on Simulator? iOS 界面自动化测试 - iOS UI automation testing
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM