Appium has two benefits for automated testing:
1. Appium uses standard automation APIs on different platforms, so there is no need to recompile or modify your application when cross-platform.
2. Appium supports all languages supported by selenium Webdriver, such as Java, Object-c, JavaScript, PHP, Python, Ruby, C #, Clojure, or Perl, and can use selenium The Webdriver API. Appium supports any kind of test framework. If you only use Apple's uiautomation, we can only use JavaScript to write test cases, and only use instruction to run test cases. Similarly, if you only use Google's uiautomation, we can only write test cases in Java. Appium enables True cross-platform automation testing.
To use Appium for iOS automation you need to know:
iOS automated testing requires a Mac OS operating system
Mac OS X 10.7 or later, recommended version 10.8.4
Android automated testing can be done on Mac and Linux.
Need to install node and NPM (node version above 0.8)
Mac Xcode (I use)
Apple Developer Tools (iphone emulator SDK, and command line tools)
Installing Appium
Forward a blog here: http://www.cnblogs.com/oscarxie/p/3894559.html
As the environment is ready, I started my first iOS automation script.
Appium settings:
To use a real machine connection, to select the UUID, the real machine's UUID to fill in, select the correct real-computer iOS version, so at the start, will automatically find the linked device.
Discover that setting up inspector,application on a virtual machine must set the app Path, using Bundleid will not start and will report the following error:
Could not start a new session
Be sure the Appium server was running with a application opened by using the ' App Path ' parameter in Appium.app (along wit H package and activity for Android) or by connecting with selenium client and supplying the desired capabilities O Bject.
If you have a inspector boot, please find an article written earlier: http://www.cnblogs.com/llining/p/5040290.html
Display interface after startup:
The following describes the use of the Appium recording script
When you open inspector, you will find a record button on it, click it, and the following window will pop up as follows:
Click on a text box control, tap text, enter the type you want to enter, click Send Keys, the code will generate a new line of code,
In touch, there will be a common action, such as click, Activity, long press, and so on, text, is the operation of the textual, locator is used to check the location of the path of the element is correct, misc is the window pop-up prompt box processing.
When you have finished recording, click Sava to save the code.
The exported code is as follows:
Import Io.appium.java_client. Appiumdriver;
Import org.openqa.selenium.remote.DesiredCapabilities;
Import Java.net.URL;
public class {ScriptName} {
public static void Main (string[] args) {
Desiredcapabilities capabilities = new Desiredcapabilities ();
Capabilities.setcapability ("Appium-version", "1.0");
Capabilities.setcapability ("PlatformName", "IOS"); Indicates that the device to be started is iOS
Capabilities.setcapability ("Platformversion", "9.1"); System version of the boot device
Capabilities.setcapability ("DeviceName", "IPhone 6 Plus"); Start the device name, the virtual machine's write-only device name is ready, the real machine needs to fill the UUID
Capabilities.setcapability ("App", "/users/123/downloads/reserve.ipa"); The package to test
WD = new Appiumdriver (New URL ("Http://127.0.0.1:4723/wd/hub"), capabilities); Appiumserver Connection Address
Wd.manage (). Timeouts (). implicitlywait (Timeunit.seconds);
Wd.findelement (By.xpath ("//uiaapplication[1]/uiawindow[1]/uiascrollview[1]/uiatextfield[1]/uiatextfield[1]")). SendKeys ("156xxxx2606"); Enter text like a text box
Wd.findelement (By.xpath (".//uiascrollview[1]/uiasecuretextfield[1]/uiasecuretextfield[1]")). SendKeys ("111111") ; Enter text like a text box
Wd.findelement (By.xpath ("//uiaapplication[1]/uiawindow[1]/uiascrollview[1]/uiabutton[1]"). Click (); Click the login button
Wd.close ();
}
}
The above script to implement a simple login function.
Initial knowledge of iOS automation (i)