Appium's iOS environment setup

Source: Internet
Author: User
Tags install homebrew install node node server appium

Name of the operating system: MAC OS X
Version of operating system: 10.13.3

Xcode version: 9.2

Java version: java8_161

Appium destop Version: 1.7.3

Next we started to set up the road to build Appium+java+ios, this article only say a probably, after all, the machine has been installed, I do not toss, and spent a few days to get it done.

One: Install java. Configuring Environment variables

Can be configured in/etc/profile

Export Java_home=/library/java/javavirtualmachines/jdk1.8.0_144.jdk/contents/home
Export path= $JAVA _home/bin: $PATH

Re-enter the name Source/etc/profile to take effect

Two: Install Appium

1. The author system installed Appium destop version: 1.7.2, personally feel destop version is more convenient.

Three: Install homebrew

First look at what homebrew is, homebrew is the equivalent of the Linux yum. Official website Https://brew.sh/index_zh-cn.html,Homebrew What can I do? Install Apple without preinstalled but what you need with Homebrew. Homebrew installs the package to a stand-alone directory and soft-links its files to/usr/local. Homebrew does not install files outside of its own directory, so you can install Homebrew anywhere. Create your own Homebrew package with ease. Completely based on git and Ruby, so you can easily undo your changes or merge with upstream updates while you're free to modify them. Homebrew's recipes are simple Ruby scripts that Homebrew make MacOS more complete. Use Gems to install GEMS, and brew to install those dependent packages. More introduction please officer net.

1. Installation:/usr/bin/ruby-e "$ (curl-fssl https://raw.githubusercontent.com/Homebrew/install/master/install)"

2. Check whether the installation succeeded: Brew-v, the author system installs the version number is:1.3.2

Four: Install node (Appium needs to use node server)

1. Install: Terminal execution: Brew install node.

2. Check whether the installation is successful: terminal input node-v, if the display version number indicates that the installation was successful, the author installs the version:v6.11.3

V: Install Ideviceinstaller

1. Description: cross-platform libraries and tools for communicating with iOS devices to install uninstall apps or backup apps for iOS devices. The tool is based on Libmobiledevice, so the first step is to complete the Libmobiledevice compilation installation.

2. Terminal execution: Brew install Ideviceinstaller

3. If step 2 performs an error, it is possible that the Carthage is not installed and the terminal executes the brew install Carthage

4. Check if the installation is successful and if it appears, the installation is successful.

The usefulness of Ideviceinstaller

1. Command idevice_id-l can get Udid

2. Name Ideviceinstaller-l to get bundle ID

The usefulness of Carthage

Found in the framework of the Webdriver agent need to use a package in the Carthage

VI: Install Appium-doctor

NPM install-g Appium-doctor

Appium-doctor check below, tick is check normal, hit the fork is not normal. I have a fork here because I don't have an Android environment, no impact on my iOS

Seven: Install Xcode

1. Install: can open in AppStore and download

2. Check if the installation is successful: Terminal execution Xcodebuild-version, author installed version: Xcode 9.2

Eight: Install Xcode Command line Tools

After the 1.Xcode installation is complete, start the terminal and enter the terminal Xcode-select--install

Nine: Mobile terminal installation Webdriveragent

The new version of Xcode for iOS testing requires the use of webdriveragent, a simple explanation, you need to use Xcode to install a signing certificate on the real machine before testing, you can see the test device will install a webdriveragent app and then through the app To test the app being tested. Specific people can search webdriveragent to understand.

1. Install iOS (webdriver) steps

Installing Appium-xcuitest-driver
NPM install-g Ios-deploy (Ios-deploy required for real-machine testing )
Cd/usr/local/lib/node_modules/appium
NPM Uninstall Appium-xcuitest-driver
NPM install [email protected]
Note: Appium comes with a appium-xcuitest-driver version that is too low to be reinstalled

2. Configure Webdriveragent Environment
Cd/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/webdriveragent
Mkdir-p Resources/webdriveragent.bundle
Sh./scripts/bootstrap.sh-d ( This step is to recompile the webdriveragent file and download the appropriate dependency package to view the problem one )

3. Compile webdriveragent, double-click Webdriveragent.xcodeproj or execute the following command, the system will automatically open with Xcode

open/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/webdriveragent/ Webdriveragent.xcodeproj

On the web about webdriveragent compilation process generally write more complex, I write a simple point here, two steps for everyone to refer to, first look at the following two pictures

1. The targets file listed on the left side of the project each to do the right operation, the operation is to configure your Apple ID in genaral tab, in the Build Settings page to change the bundle ID to unique.

2. Add the following two frameworks to Build phases, Webdriveragentrunner

The following figure from the network, you can refer to the above two steps of the content, a lot of parts do not see

(1). Compiling webdriveragentlib

    

(2). Compiling Webdriveragentrunner

    

    

(3). In the end terminal input: Xcodebuild-project webdriveragent.xcodeproj-scheme webdriveragentrunner-destination ' id=udid ' test, Webdriveragent will be installed on the phone after the completion of the execution.

Issue One: Webdriveragent compile error, unable to find RoutingHttpServer.h header file

Cause: On the Webdriveragentrunner page of the Webdriveragent project in Xcode, on the Copy Frameworks option on the Build Phase tab, you need to configure the two framework, One of them is Carthage, and this one is not configured.

Workaround: 1. First install Carthage

2. Compile the sh./scripts/bootstrap.sh-d once again.

Issue two: Could not determine Xcode version:could not get Xcode version. /library/developer/info.plist does not exist on disk.

Cause: One of Xcode's path configuration to change, modify the command as follows

Workaround:sudo xcode-select --switch /Applications/Xcode.app

  

Appium's iOS environment setup

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.