Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

1. Install WebDriverAgent

WebDriverAgent is a WebDriver server implementation for iOS that can be used to remote control iOS devices. We use it to get details about the elements of a view (label, name, class).

Run the following commands to install WebDriverAgent:

brew update
brew install node
npm install --global appium-webdriveragent

The Xcode project is located in the node_modules directory: [NPM_ROOT_PATH]/appium-webdriveragent/WebDriverAgent.xcodeproj

Replace NPM_ROOT_PATH by the result of the npm root -g command.

Example:

  • Result of the npm root -g command: /opt/homebrew/lib/node_modules

  • Path of the Xcode project: /opt/homebrew/lib/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj

2. Prepare WebDriverAgent on Xcode for first use

  • Open a terminal and go where the project is:

cd [NPM_ROOT_PATH]/appium-webdriveragent/
  • Open the project with the following command:

open WebDriverAgent.xcodeproj
  • Connect the device to the computer via an USB cable

  • Go to Window > Devices and Simulators, and check that the device is connected

  • On Xcode, on the project navigator, click on “WebDriverAgent”

  • Select WebDriverAgentRunner among the targets, and the “Signing & Capabilities” tab

doc_ios_1bis.png
  • Check that the “Automatically manage signing” field is checked

  • Select a development team. We expect an error of bundle identifier (package name) because this one is already used.

doc_ios_2.png
  • Click on the “Build Settings” tab and write a new bundle identifier in the Packaging section

doc_ios_3.png
  • The “Signing & Capabilities” tab is then updated

doc_ios_4.png
  • Select IntegrationApp among the targets and follow the same steps

  • In the target choice on the top of Xcode, choose WebDriverAgentRunner and the right phone

doc_ios_5.png

3. Inspect elements of a view

Steps to follow:

  • Open the WebDriverAgent project on Xcode

  • Connect the device to the computer via an USB cable

  • Go to Window > Devices and Simulators, and check that the device is connected

  • Build the project: Product > Build

  • Run the project: Product > Perform Action > Test Without Building

If it is the first time you run it on the device, you will get an error. In this case, go to Settings > General > Device management and trust WebDriverAgent.

  • Open Appium Server GUI

  • Click on “Start Server”

  • Open Appium Inspector

  • Complete the “Remote Path” field with the following text: /wd/hub

  • Complete the “Json Representation” field with your device properties:

{
  "platformName": "iOS",
  "platformVersion": "15.4",
  "udid": "00008020-000815E82E06002E",
  "bundleId": "com.google.ios.youtube",
  "deviceName": "iPhone de Olivier"
}

You can click on “Saved capabilities sets” to use the saved settings.

  • Click on “Start Session”

On Appium Inspector, the phone screen appears. It is then possible to select elements of the screen to view their information (label, name, class), but also to scroll and click directly. Functions such as clickByText, waitUntilText and setTextByText search for the element label.

appium_inspector.png

If any errors occur, refer to the associated troubleshooting page. : Troubleshooting iOS

  • No labels