Appium 1.6.3 Experience in Xcode 8 (real machine) test environment construction
About Appium 1.6.3 in Xcode 8, 1 real-world environment build problem more, write this article, for your reference, so that everyone less detours.
before starting the iOS real -world test, be sure to set up the environment for Appium 1.6.3 + Xcode 8 on the iOS simulator, see my previous post: Appium 1.6.3 in Xcode 8, iOS 10.2 (simulator) test environment Experience Summary
If the environment on the iOS simulator is OK, then build it on the real machine, or you should give up.
Go to the Chase:
First of all, above article: Appium 1.6.3 in Xcode 8, IOS 10.2 (simulator) test Environment Building Experience Summary The first, second, third step must end , and then start, be sure!
First, the installation of related dependencies
(1) Installation Ios-deploy
NPM i-g Ios-deploy
Failure to do so will cause an error:
[Xcuitest] Could not initialize Ios-deploy Make sure it's installed and works on your system
[Xcuitest] Error:could not initialize Ios-deploy Make sure it's installed and works on your system
At xcuitestdriver.getideviceobj$ (.. /.. /LIB/DRIVER.JS:685:13)
(2) Installation Libimobiledevice
Brew Install Libimobiledevice--head
Second, install appium-xcuitest-driver (uninstall first reinstall new version 2.5.3)
Cause: Appium default installation of the Appium-xcuitest-driver version is a bit old, seemingly 2.4.0 version, the old version of the problem, run the test will prompt
Debug] [webdriveragent] Device:mar 15:29:21 cheersde-iphone xctrunner[2848] <notice>: Running tests ...
[Debug] [Webdriveragent] Device:mar 15:29:22 Cheersde-iphone xctrunner[2848] <notice>: Continuing to run tests in the background with TAS K ID 1
[Debug] [Xcuitest] Waiting for Webdriveragent server to finish loading ...
The app launch that led to the test not up , has been stuck in [debug][xcuitest] waiting for webdriveragent server to finish loading ... This piece
The new version, Appium-xcuitest-driver 2.5.3, solves this problem.
Installation method:
Cd/usr/local/lib/node_modules/appium
NPM Uninstall Appium-xcuitest-driver Uninstall first
NPM install [email protected] Reinstall 2.5.3
third, compile the Webdriveragentrunner, and install to the real machine (my iphone 5s)
Description:appium is on the phone webdriveragentrunner, to run the test, no this on the real machine no way to test (simulator needs a, but will automatically install)
3.1 Open webdriveragent with Xcode and compile (requires some setup before compiling)
(1) Enter the Webdriveragent folder, you can use the following methods
Directory is/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/webdriveragent
(2) Select the Webdriveragent.xcodeproj file, open with Xcode, and do the settings.
See figure
compile Webdriveragent Click the Compile button , see. Tip Build Success after compilation is complete.
3.2 Install webdriveragent on your phone (both the phone and Mac are in the same network segment)
(1) Connecting mobile phones and Mac computers
(2) terminal enters Webdriveragent folder
Cd/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/webdriveragent
Perform:
Xcodebuild-project webdriveragent.xcodeproj-scheme webdriveragentrunner-destination ' id= real machine udid ' test
At this point, the Webdriveragentrunner app will be installed on your phone.
Please note that if the prompt is a trusted developer, please trust your Apple ID in Settings-general-device management (profile).
Run again
Xcodebuild-project webdriveragent.xcodeproj-scheme webdriveragentrunner-destination ' id= real machine udid ' test
So the Webdriveragentrunner on the phone installed successfully.
Iv. Start Appium
Command line Execution Appium
Five, write a simple test case, Java writing (based on testng):
[Java]View PlainCopy
- <span style="Font-family:simsun;" > Packagecom.cheers.qa;
- Import Io.appium.java_client.ios.IOSDriver;
- Import Io.appium.java_client.remote.MobileCapabilityType;
- Import Org.openqa.selenium.By;
- Import org.openqa.selenium.WebElement;
- Import org.openqa.selenium.remote.DesiredCapabilities;
- Import Org.testng.annotations.Test;
- Import java.net.MalformedURLException;
- Import Java.net.URL;
- Import Java.util.concurrent.TimeUnit;
- Public class Cheers_tc1 {
- private Iosdriver WD;
- Public CHEERS_TC1 () {}
- @Test
- public void Test1 () throws interruptedexception{
- Desiredcapabilities capabilities = new Desiredcapabilities ();
- Capabilities.setcapability ("appium-version", "1.6.3");
- Capabilities.setcapability ("PlatformName", "IOS");
- Capabilities.setcapability ("platformversion", "10.2.1");
- Capabilities.setcapability ("devicename", "IPhone 5s");
- Capabilities.setcapability (Mobilecapabilitytype.automation_name, "xcuitest");
- Capabilities.setcapability (Mobilecapabilitytype.app, "/users/***/documents/workspace/swiftlive_ios_appium/ Ipa_files/swiftlive.ipa ");
- Capabilities.setcapability (Mobilecapabilitytype.udid, "iphone real Machine UDID");
- try {
- WD =New Iosdriver (new URL ("Http://127.0.0.1:4723/wd/hub"), capabilities);
- } catch (Malformedurlexception e) {
- E.printstacktrace ();
- }
- Wd.manage (). Timeouts (). implicitlywait (timeunit.seconds);
- System.out.println ("******************** Cheers Appium iOS true machine Test **************************");
- Wd.close ();
- }
- }</span>
Then right-click Run as testng to see the effect on the real machine
Reference article:
https://testerhome.com/topics/6962
2 Appium 1.6.3 experience in Xcode 8 (real machine) test environment