- 概述
- 用户界面自动化
- 关于“用户界面自动化”活动包
- 通过用户界面自动化实现自动化的应用程序和技术
- 项目兼容性
- UI-ANA-016 - 拉取打开浏览器 URL
- UI-ANA-017 - 出错时继续 True
- UI-ANA-018 - 列出 OCR/图像活动
- UI-DBP-006 - 容器使用情况
- UI-DBP-013 - Excel 自动化误用
- UI-DBP-030 - 选取器中的禁止变量使用情况
- UI-DBP-031 - 活动验证
- UI-PRR-001 - 模拟单击
- UI-PRR-002 - 模拟键入
- UI-PRR-003 - 打开应用程序误用
- UI-PRR-004 - 硬编码延迟
- UI-REL-001 - 选取器中的大 IDX
- UI-SEC-004 - 选取器电子邮件数据
- UI-SEC-010 - 应用程序/Url 限制
- UI-USG-011 - 不允许的属性
- UX-SEC-010 - 应用程序/Url 限制
- UX-DBP-029 - 使用不安全的密码
- UI-PST-001 - 项目设置中的审核日志级别
- UiPath 浏览器迁移工具
- 剪切区域
- 计算机视觉录制器
- 活动索引
- 激活
- 锚点基准
- 附加浏览器
- 附加窗口
- 阻止用户输入
- 标注
- 选中
- 单击
- 单击图像
- 单击图像触发器
- 单击 OCR 文本
- 单击文本
- 单击触发器
- 关闭应用程序
- 关闭选项卡
- 关闭窗口
- 上下文感知锚点
- 复制选定文本
- 元素属性更改触发器
- 存在元素
- 元素作用域
- 元素状态更改触发器
- 导出用户界面树
- 提取结构化数据
- 查找子元素
- 查找元素
- 查找图像
- 查找图像匹配项
- 查找 OCR 文本位置
- 查找相对元素
- 查找文本位置
- 获取活动窗口
- 获取上级
- 获取属性
- 获取事件信息
- 从剪贴板获取
- 获取全文
- 获取 OCR 文本
- 获取密码
- 获取位置
- 获取源元素
- 获取文本
- 获取可见文本
- 返回
- 前往
- 转至主页
- Google Cloud Vision OCR
- 隐藏窗口
- 高亮显示
- 热键触发器
- 悬停
- 悬停在图像上方
- 悬停在 OCR 文本上方
- 悬停文本
- 存在图像
- 在屏幕上指定
- 注入 .NET 代码
- 插入 Js 脚本
- 调用 ActiveX 方法
- 按键触发器
- 加载图像
- 最大化窗口
- Microsoft Azure 计算机视觉 OCR
- Microsoft OCR
- Microsoft Project Oxford Online OCR
- 最小化窗口
- 监控事件
- 鼠标触发器
- 移动窗口
- 导航至
- 存在 OCR 文本
- 在元素出现时
- 在元素消失时
- 在图像出现时
- 在图像消失时
- 打开应用程序
- 打开浏览器
- 刷新浏览器
- 重播用户事件
- 还原窗口
- 保存图像
- 选择项目
- 选择多个项目
- 发送热键
- 设置剪切区域
- 设置焦点
- 设置文本
- 设置为剪贴板
- 设置网页属性
- 显示窗口
- 启动进程
- 系统触发器
- 截取屏幕截图
- Tesseract OCR
- 存在文本
- 工具提示
- 键入
- 输入安全文本
- 使用前台
- 等待属性
- 等待元素消失
- 等待图像消失
- Computer Vision Local Server
- 移动自动化
- 终端

用户界面自动化活动
本地 iOS 设备
设置本地 iOS 设备
要设置本地设备以使用“移动自动化”活动,您需要运行 Appium 的本地实例,并拥有自动化 iOS 设备的必要工具。
您可以自动化两种类型的本地 iOS 设备:
- Physical - a physical iOS device that you can connect to your local machine, through a USB cable.
- Emulator - an emulator for an iOS device that's stored locally.
最常用的 Appium 命令
下面的列表描述了在移动设备自动化(推荐用于Appium 2.0 )的上下文中设置 Appium 的最常用命令:
xcrun simctl list- 列出可用的设备、设备类型、运行时或设备对。xcrun simctl list devices- 列出可用设备。xcrun simctl list devicetypes- 列出设备类型。xcrun simctl list runtimes- 列出运行时。xcrun simctl list runtimes- 列出设备对。
应用程序存储
您需要将移动应用程序存储在运行 Appium 服务器的同一台计算机上,或者将 IPA 文件上传到 Appium 服务器可匿名访问的 URL(例如Blob 存储)。
无法从 Play 商店或 App Store 安装应用程序,除非您手动自动化这些应用程序以安装特定应用程序。
如果您的应用程序工件使用APP扩展程序,并且您想要将该应用程序上传到公共 URL,则需要创建一个名为Payload的文件夹,将APP放入其中,存档Payload文件夹并进行更改将扩展名改为IPA而不是ZIP。 此外,请确保针对目标架构(模拟器或物理设备)编译您尝试自动化的应用程序。
配置 iOS 物理设备
先决条件
-
安装 Xcode。
-
打开终端并运行以下命令以安装 Homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"-
运行以下命令,将 Homebrew 添加到
PATH环境变量中:echo >> /Users/<username>/.zprofile echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/<username>/.zprofile eval "$(/opt/homebrew/bin/brew shellenv)"echo >> /Users/<username>/.zprofile echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/<username>/.zprofile eval "$(/opt/homebrew/bin/brew shellenv)"
-
-
运行以下命令以安装 NodeJS:
brew install node 4. 安装 Appium:
- For Appium 1.0, run the following command:
npm install -g appium. This automatically installed all drivers needed. - For Appium 2.0, run the following command:
npm install -g appium@next.
Appium 2.0 comes without the drivers installed. Therefore, to install the needed drivers, also run the following command: appium driver install xcuitest.
- We recommend using Appium 2.0 with Mobile Automation version 22.10 or higher.
- 如果要在iOS 物理设备上测试移动端自动化,请安装Appium 2.0 。 1. 打开 Xcode 并允许其安装可能需要的任何其他组件。看到启动画面后,请关闭它。2. 使用以下命令启动 Appium 服务器:
appium --port 8001 --default-capabilities "{\"appium:systemPort\":9001}" --relaxed-security。
配置本地 iOS 物理设备
-
将物理设备连接到 Mac。
-
解锁您的设备,如果弹出警示,请确保允许计算机访问它。
-
获取 Appium URL 并保存以备后用:
- Go to System Settings, then the Network tab, and select the Wi-Fi network that the physical device is connected to.
- 复制设备已连接的 Wi-Fi 网络的IP 地址。Appium URL 的格式为
http://<ipaddress>:8001(8001是启动 Appium 的端口号)。
-
从 XCode 获取已连接到计算机的物理 iOS 设备的 UDID。
- Go to Window > Devices and Simulators > Devices.
- 单击已连接到的 iOS 设备。
- Copy the Identifier. This is the UDID, that you'll later add as an additional desired capability, when adding this iOS physical device to MDM.
-
在 Mac 上使用 XCode 构建WebDriverAgent 。
- 使用以下路径导航到
appium-webdriveragent文件夹:/Users/<username>/appium2/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent,然后打开xcodeproj文件。 - Select WebDriverAgent, and open WebDriverAgentRunner, under the Targets section.
- Switch to the Signing & Capabilities tab, select Automatically manage signing, and choose a user account from the Team dropdown.
- Change the Bundle Identifier to a unique value.
- 复制并保存此捆绑包标识符。您将使用它在 MDM 中添加应用程序(捆绑包 ID )。

- 使用以下路径导航到
-
Install the WebDriverAgent on your iOS physical device.
- Select WebDriverAgentRunner in the WebDriverAgent navigation bar.
- In XCode, go to Product, and click Test. On your connected iOS physical device, you'll see the WebDriverAgent installing.
-
使用“在移动设备管理器中添加 iOS 设备”过程,在移动设备管理器中添加已配置的本地实体 iOS 设备。
在移动设备管理器中添加本地 iOS 设备
-
从 Studio 打开移动设备管理器。
-
在左侧导航面板中,转到“测试用例”。
-
按如下方式配置您的设备:
-
名称 - 在“设备”选项卡中输入用于标识设备的名称。
-
Appium URL - Enter the Appium URL, that you previously copied, using the following format:
http://<ipaddress>:8001. -
平台 - 单击字段以从下拉列表中选择“Android”或“iOS”。
-
设备名称 - 输入设备名称。
-
Additional Desired Capabilities - Add the following capabilities:
名称 值 automationNamexcuitest(此功能激活 Appium iOS 驱动程序)udidthe Identifier of the connected physical iOS device
-
-
(可选)在“日志记录”选项卡中配置日志记录和视频录制详细信息。
-
(可选)在“开发”选项卡中配置开发流程。
- 关闭类似选项卡(默认情况下激活): 关闭与类似设备和应用程序运行连接的选项卡。
- 等待页面更新(默认激活): 等待页面来源检索每个操作的屏幕截图。
-
单击“保存并关闭”以添加设备。
您的设备已添加到“设备”列表中。要添加本地设备,请参阅。如果您无法启动设备,请参阅故障排除:物理设备启动失败。
iOS 上的混合和网页自动化
如果您没有尝试自动化为生产而构建的应用程序,则默认情况下,混合自动化适用于 iOS 设备。在自动化生产应用程序时,WKWebView 托管的内容将不可自动化,但 SFSafariViewController 中托管的任何网页内容也可以在生产应用程序中实现自动化。有关更多信息,请参阅SFSafariViewController。