搜索
简帛阁>技术文章>Appium翻译篇【 appium/docs/en/drivers/ios-xcuitest.md 】

Appium翻译篇【 appium/docs/en/drivers/ios-xcuitest.md 】

文章目录

  • The XCUITest Driver for iOS (iOS的XCUITest驱动程序)
  • Requirements and Support(需求和支持)
  • Migrating from the UIAutomation Driver(从UIAutomation驱动程序迁移)
  • Usage(用法)
  • Capabilities(功能)
  • Commands(命令)
  • Basic Setup(基本配置)
  • Real Device Setup(真机配置)
  • Optional Setup(其它配置)
  • Files generated by test runs(测试运行生成的文件)
  • Configure keyboards(配置键盘)

The XCUITest Driver for iOS (iOS的XCUITest驱动程序)

Appium’s primary support for automating iOS apps is via the XCUITest driver. (New to Appium? Read our introduction to Appium drivers). This driver leverages Apple’s XCUITest libraries under the hood in order to facilitate automation of your app . This access to XCUITest is mediated by the WebDriverAgent server. WebDriverAgent (also referred to as “WDA”) is a project managed by Facebook, to which the Appium core team contributes heavily. WDA is a WebDriver-compatible server that runs in the context of an iOS simulator or device and exposes the XCUITest API. Appium’s XCUITest driver manages WDA as a subprocess opaque to the Appium user, proxies commands to/from WDA, and provides a host of additional functionality (like simulator management and other methods, for example).

Development of the XCUITest driver happens at the appium-xcuitest-driver repo.

Appium对iOS应用程序的自动化主要是通过XCUITest驱动程序。(刚接触Appium吗?请阅读introduction to Appium drivers)。这个驱动程序利用了苹果的XCUITest库来促进应用程序的自动化。对XCUITest的访问由WebDriverAgent服务器进行代理。WebDriverAgent(也被称为“WDA”)是一个由Facebook管理的项目,Appium的核心团队对此贡献很大。WDA是一个兼容webdriver的服务器,运行在iOS模拟器或真机的上下文中,并暴露XCUITest API。Appium的XCUITest驱动程序将WDA管理为对Appium用户不透明的子进程,代理向WDA发送/发送命令,并提供许多附加功能(例如模拟器管理和其他方法)。

Requirements and Support(需求和支持)

In addition to Appium’s general requirements:

  • Apple’s XCUITest library is only available on iOS simulators and devices that are running iOS 9.3 or higher.
  • A Mac computer with macOS 10.11 or 10.12 is required.
  • Xcode 7 or higher is required.
  • The XCUITest driver was available in Appium starting with Appium 1.6.
  • For correct functioning of the driver, additional system libraries are required (see the Setup sections below).

除了Appium的一般要求以外的需求:

  • 苹果的XCUITest库仅适用于iOS 9.3或更高版本的模拟器和真机。
  • Mac电脑需要macOS 10.11 或 10.12版本。
  • 需要Xcode 7或更高版本。
  • 从Appium 1.6开始,XCUITest驱动程序在Appium中可用。
  • 要使驱动程序正常运行,需要额外的系统库(请参阅下面的安装部分)。

Migrating from the UIAutomation Driver(从UIAutomation驱动程序迁移)

If you are migrating to the XCUITest driver from Appium’s old UIAutomation-based driver, you may wish to consult this migration guide.

如果你要从Appium的旧的基于uiautomous的驱动程序(UIAutomation-based driver)迁移到XCUITest驱动程序,你可以参考这个迁移指南(migration guide)。

Usage(用法)

The way to start a session using the XCUITest driver is to include the automationName capability in your new session request, with the value XCUITest. Of course, you must also include appropriate platformName, platformVersion, deviceName, and app capabilities, at a minimum.

使用XCUITest驱动程序启动会话的方法是在新的会话请求中包含automationName键,值为XCUITest。当然,至少还必须包含适当的platformName, platformVersion, deviceName和APP功能。

The platformName should be iOS for iPhone or iPad. tvOS devices are available if the platformName is tvOS.

iOS设备,platformName应该是 iPhone或iPad。tvOS设备,platformName应该是Apple TV。

  • iOS
{
   "automationName": "XCUITest",
   "platformName": "iOS",
   "platformVersion": "12.2",
   "deviceName": "iPhone 8",
   ...
}
  • tvOS
{
   "automationName": "XCUITest",
   "platformName": "tvOS",
   "platformVersion": "12.2",
   "deviceName": "Apple TV",
   ...
}

Capabilities(功能)

The XCUITest driver supports a number of standard Appium capabilities, but has an additional set of capabilities that modulate the behavior of the driver. These can be found currently at the appium-xcuitest-driver README.

To automate Safari instead of your own application, leave the app capability empty and instead set the browserName capability to Safari.

XCUITest驱动程序支持许多标准Appium功能,但是还有一组额外的功能来调节驱动程序的行为。这些功能可以在appium- xcuest -driver文件中找到。
要想自动化Safari而不是您自己的应用程序,请将app功能设置为空,而将browserName功能设置为Safari。

Commands(命令)

To see the various commands Appium supports, and specifically for information on how the commands map to behaviors for the XCUITest driver, see the API Reference.

要查看Appium支持的各种命令,特别是关于命令如何映射到XCUITest驱动程序的行为的信息,请参阅API参考(API Reference)。

Basic Setup(基本配置)

(We recommend the use of Homebrew for installing system> dependecies)

  1. Ensure that you have Appium’s general dependencies (e.g., Node & NPM) installed and configured.
  2. Install the Carthage dependency manager:

(我们建议使用Homebrew来安装系统依赖项)

  1. 确保已经安装并配置了Appium的一般依赖项(例如,Node & NPM)。
  2. 安装Carthage依赖管理器
 brew install carthage

If you don’t need to automate real devices, you’re done! To automate an app on the simulator, the app capability should be set to an absolute path or url pointing to your .app or .app.zip file, built for the sim.

如果不需要自动化真机,那么就完成了配置!要想在模拟器上自动化应用程序,APP功能应该设置为一个绝对路径或url,指向为sim构建的.app或.app.zip文件。

Real Device Setup(真机配置)

Automating a real device with XCUITest is considerably more complicated, due to Apple’s restrictions around running apps on real devices. Please refer to the XCUITest real device setup doc for instructions.

Once set up, running a session on a real device is> achieved by using the following desired capabilities:

  • app or bundleId - specifies the application (local path or url referencing your signed .ipa file) , or, if it is already installed,
    simply the bundle identifier of the app so that Appium can launch it.
  • udid - the specific id of the device to test on. This can also be set to auto if there is only a single device, in which case Appium
    will determine the device id and use it.

由于苹果对在真机上运行APP的限制,用XCUITest实现真机的自动化要复杂得多。请参考XCUITest real device setup doc以获得指导。
一旦设置好,在真机上运行会话就可以通过使用以下所需的功能来实现:

  • app或bundleId——指定应用程序(引用已签名的.ipa文件的本地路径或url),或者,如果它已经安装,只需应用程序的包标识符,以便Appium可以启动它。
  • udid -要测试的设备的特定id。如果只有一个设备,也可以设置为auto,在这种情况下Appium将确定设备id并使用它。

Optional Setup(其它配置)

  • 安装idb以便更好地处理各种iOS模拟器操作,如:生物识别、地理位置设置和窗口聚焦。
    • 阅读https://github.com/appium/appium-idb#installation来安装必要的库(自Appium 1.14.0开始)
  • 安装AppleSimulatorUtils以使用权限功能( permissions capability)

Files generated by test runs(测试运行生成的文件)

Testing on iOS generates files that can sometimes get large. These include logs, temporary files, and derived data from Xcode runs. Generally the following locations are where they are found, should they need to be deleted:

$HOME/Library/Logs/CoreSimulator/*
$HOME/Library/Developer/Xcode/DerivedData/*

在iOS上测试生成的文件有时会变得很大。这些文件包括日志、临时文件和来自Xcode运行的派生数据。如果需要删除,一般可以在以下位置找到:

Configure keyboards(配置键盘)

Over Appium 1.14.0, Appium configures keyboard preferences by default to make test running more stable. You can change sone of them via settings API.

  • Turn Auto-Correction in Keyboards off
  • Turn Predictive in Keyboards off
  • Mark keyboard tutorial as complete
  • (Only for Simulator) Toggle software keyboard on

在Appium 1.14.0之上,Appium默认配置键盘参数以使测试运行更加稳定。你可以通过设置API来改变。

  • 关闭键盘自动校正功能

  • 关闭键盘自动补全功能

  • 标记键盘教程为完整

  • 打开软键盘(仅适用于模拟器)

文章目录TheXCUITestDriverforiOS(iOSXCUITest驱动程序)RequirementsandSupport(需求和支持)MigratingfromtheUIAutomati
文章目录TheUiAutomator2DriverforAndroidRequirementsandSupportUsageCapabilitiesCommandsBasicSetupEmulator
文章目录AppiumPlatformSupportiOSSupportAndroidSupportWindowsDesktopSupportAppiumPlatformSupportAppiumsup
前言学UI自动化首先就是定位页面元素,玩过android版的appium小伙伴应该都知道,appium的windows版自带的Inspector可以定位app上的元素Mac版的appium16的版本在
比较好的文章:http://www15yancom/story/4GbuTwXQKDU/官网资料:http://appiumio/slate/cn/v120/?pythonappium官方文档中文版:
1、Appium简介是一个移动端的自动化测试框架,可用于测试原生应用,移动网页应用和混合型应用,且是跨平台的。原生的应用是指用android或ios的sdk编写的应用;移动网页应用是指网页应用,类似于
试的时候,被问到appium原理,一点不会,实在尴尬。大家可以直接翻看原作https://blogcsdnnet/jffhy2017/article/details/69220719appium运行
Appium我想大家都不陌生,这是主流的移动自动化工具,但你对它真的了解么?为什么很多同学搭建环境时碰到各种问题也而不知该如何解决。appium为什么英语词典查不到中文含义?appium是一个合成词
一、适用操作系统Win7旗舰版Sp164位操作系统或32位操作系统二、所需软件jdk7u45windowsi586exenodev01028x86msi(32位)下载地址:http://nodejso
言:之前做APP自动化,使用appium框架时,有理清楚过android的工作流程和原理,找了一遍,发现没记录到博客,所以写下一篇appium工作原理来记录。目前Appium框架可以时支持andro