activities
latest
false
重要 :
请注意,此内容已使用机器翻译进行了部分本地化。 新发布内容的本地化可能需要 1-2 周的时间才能完成。
UiPath logo, featuring letters U and I in white

用户界面自动化活动

上次更新日期 2025年11月25日

本地 iOS 设备

设置本地 iOS 设备

要设置本地设备以使用“移动自动化”活动,您需要运行 Appium 的本地实例,并拥有自动化 iOS 设备的必要工具。

您可以自动化两种类型的本地 iOS 设备:

  • 物理 设备 - 可以通过 USB 数据线连接到本地计算机的物理 iOS 设备。
  • 模拟器 - 用于本地存储的 iOS 设备的模拟器。

最常用的 Appium 命令

下表介绍了在移动设备自动化上下文中设置 Appium 时最常用的命令(推荐用于 Appium 2.0):

  • 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 物理设备

架构

When working with iOS Physical Devices, you require the following infrastructure:

  1. WindowsOS Device
    • UiPath Studio (Hardware/Software) – installation guide
  2. macOS Device
    • Appium Server
      • Homebrew
      • NodeJS
    • Xcode
      • Required to install Appium Driver on iOS device
  3. iOS Device
    • Appium WebDriver
Figure 1. Architecture for IOS Local Physical Devices

先决条件

  1. macOS 13+ (Ventura or later)
  2. Apple ID (for Xcode and provisioning)
  3. Physical iOS device (iPhone/iPad)
  4. UiPath Studio 2023.10 (or higher)
  5. USB cable to connect the device

Configuring Local Physical iOS Device

  1. Install Homebrew.
    1. Open Terminal (select Command+Space).
    2. 运行以下命令:
      /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)" 
      Figure 2. Homebrew installation - command line

    3. If prompted, run the following command to add Homebrew to your PATH environment variable:
      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)"
    4. Verify.
      brew -versionbrew -version
  2. Install Xcode and Command Line Tools.
    • Install Xcode via App Store and open it once.
    • From Terminal, run the following:
      1. xcode-select –installxcode-select –install
      2. sudo xcodebuild -license acceptsudo xcodebuild -license accept
      3. Verify:
        xcodebuild -versionxcodebuild -version
  3. Enable Developer mode on iOS Device.
    1. On your iPhone or iPad, go to Settings > Privacy & Security > Developer Mode.
      Figure 3. Developer mode on IOS device

    2. Toggle on and restart.
    3. After restart, approve the popup.
    4. Connect via USB and trust the computer.
      Figure 4. Enable iOS device trust

  4. Install Node.js.
    1. 运行以下命令:
      brew install nodebrew install node
      Figure 5. Node.js installation

    2. Verify.
      node -vnode -v
      npm -vnpm -v
  5. Install Appium v3.
    1. 运行以下命令:
      npm install -g appium@3npm install -g appium@3
      Figure 6. Appium installation

    2. Verify.
      appium -vappium -v
      Figure 7. Appium verification

  6. Install Appium Drivers and Plugins.
    1. Install iOS driver.
      appium driver install xcuitestappium driver install xcuitest
      Figure 8. Appium xcuitest

    2. (Optional) Configure Android option.
      appium driver install uiautomator2appium driver install uiautomator2
    3. List drivers.
      appium driver listappium driver list
      Figure 9. Appium drivers

  7. Set up WebDriverAgent.
    1. Install Carthage.
    2. Set up WebDriverAgent.
      1. Navigate to the appium-webdriveragent folder, using the following path: /Usetrs/<username>/appium2/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent, and open the xcodeproj file.
        Figure 10. WebDriverAgent folder

      2. Select WebDriverAgent, and, under the Targets section, open WebDriverAgentRunner.
        Figure 11. WebDriverAgent runner

      3. 切换到“ 签名和功能” 选项卡,选择“ 自动管理签名” ,然后从“ 团队” 下拉列表中选择用户帐户。
      4. 捆绑包标识符 更改为唯一值。
        Figure 12. WebDriverAgent Bundle Identifier

      5. Copy and save this Bundle Identifier, which you will use to add your Application inside Mobile Device Manager (Bundle Id).
      Trouble: A common issue that you may encounter is an Untrusted Developer Certificate. To fix the issue, follow the instructions oin the popup.
      Figure 13. WebDriverAgent troubleshooting

  8. Verify Physical Device access.
    1. Confirm that the IntegrationApp is installed on your physical device.
      Figure 14. IntegrationApp on physical device

    2. 运行 xcrun xctrace list devices
    3. Ensure your iPhone appears in the list. If not, verify Developer Mode and Trust settings. You will need the UDID or information in the parenthesis after your device name.
      Figure 15. Physical device access

  9. Start the Appium Server.
    1. Open the terminal and enter appium.
      Figure 16. Appium Server start

    2. Copy the appium url (to be used in next step).
      Note: Do not use the 127 location.
  10. Connect UiPath to Appium.
    1. Open UiPath Studio and install Mobile Automation Activities.
    2. Open Mobile Device Manager, and select Add device.



Add the configurated local physical iOS device in Mobile Device Manager, using the Adding iOS Device in Mobile Device Manager procedure.

在移动设备管理器中添加本地 iOS 设备

  1. 从 Studio 打开移动设备管理器。
  2. 在左侧导航面板中,转到“设备”。
  3. 按如下方式配置您的设备:
    • 名称 - 在“设备”选项卡中输入用于标识设备的名称。
    • “Appium URL ” - 使用以下格式输入您之前复制的 Appium URL: http://<ipaddress>:8001
    • 平台 - 单击字段以从下拉列表中选择“iOS”。
    • 设备名称 - 输入设备名称。
    • 其他所需功能 - 添加以下功能:

      名称

      automationName

      xcuitest (此功能激活 Appium iOS 驱动程序)

      udid

      the Identifier of the connected physical iOS device

  4. (可选)在“日志记录”选项卡中配置日志记录和视频录制详细信息。
  5. (可选)在“开发”选项卡中配置开发流程。
    • 关闭类似选项卡(默认情况下激活): 关闭与类似设备和应用程序运行连接的选项卡。
    • 等待页面更新(默认激活): 等待页面来源检索每个操作的屏幕截图。
  6. 单击“保存并关闭”以添加设备。

    您的设备已添加到“设备”列表中。要添加本地设备,请参阅。

    如果您无法启动设备,请参阅“故障排除:实体设备启动失败”



iOS 上的混合和网页自动化

如果您没有尝试自动化为生产而构建的应用程序,则默认情况下,混合自动化适用于 iOS 设备。在自动化生产应用程序时,WKWebView 托管的内容将不可自动化,但 SFSafariViewController 中托管的任何网页内容也可以在生产应用程序中实现自动化。有关更多信息,请参阅 SFSafariViewController

此页面有帮助吗?

获取您需要的帮助
了解 RPA - 自动化课程
UiPath Community 论坛
Uipath Logo
信任与安全
© 2005-2025 UiPath。保留所有权利。