Appium-ios Summary of various issues
Author: Max.bai
Time: 2014/10
Appium-ios Summary of various issues
1. Appium Slide:
There are three ways of swipe:
The first type: swipe
Javascriptexecutor js = (javascriptexecutor) driver;
hashmap<string, double> swipeobject = new hashmap<string, double> ();
Swipeobject.put ("StartX", StartX);
Swipeobject.put ("Starty", starty);
Swipeobject.put ("EndX", EndX);
Swipebject.put ("EndY", EndY);
Swipeobject.put ("duration", duration);
Swipeobject.put ("element", Double.valueof ((remotewebelement) Element). GetId ());
Js.executescript ("Mobile:swipe", swipeobject);
X, Y can be coordinator or percent,duration units in seconds, and Android can set 0.1-60,ios settings 0.5-60
You can specify an element, or you can specify no
The second kind: flick Difference swipe is no duration
Javascriptexecutor js = (javascriptexecutor) driver;
hashmap<string, double> flickobject = new hashmap<string, double> ();
Flickobject.put ("StartX", 0.8);
Flickobject.put ("Starty", 0.5);
Flickobject.put ("EndX", 0.2);
Flickobject.put ("EndY", 0.5);
Flickobject.put ("element", Double.valueof ((remotewebelement) Element). GetId ());
Js.executescript ("Mobile:flick", flickobject););
Third type: Scroll only for IOS ScrollView
Scroll direction Slide:
Javascriptexecutor js = (javascriptexecutor) _driver;
hashmap<string, string> scrollobject = new hashmap<string, string> ();
Scrollobject.put ("direction", sdrection);
Js.executescript ("Mobile:scroll", scrollobject);
Direction accept parameters: Right, left, up, down
Scroll Object slide:
Javascriptexecutor js = (javascriptexecutor) driver;
webelement element = Driver.findelementbyxpath ("XPath of elements in ScrollView");
hashmap<string, string> scrollobject = new hashmap<string, string> ();
Scrollobject.put ("Element", (remotewebelement) Element). GetId ());
Js.executescript ("Mobile:scroll", scrollobject);
2. Hide Keyboard Hidekeyboard ()
To avoid keyboard occlusion controls after entering the input box, you need to hide the keyboard
Android can set the following cap to input Chinese, but also to achieve the effect of the hidden keyboard, but this setting only for Android.
Capabilities.setcapability ("Unicodekeyboard", true);
Capabilities.setcapability ("Resetkeyboard", true);
IOS must be dropped using the method Hidekeyboard ()
The default is the point non-input box where the keyboard is automatically hidden, if not effective (development does not do this effect), you need to use other methods, such as: by clicking "Done" to hide the keyboard
Hidekeyboard (Hidekeyboardstrategy.press_key, "done")
3. Xcode version
Appium 1.2.* Correspondence Xcode5.0
Appium 1.3 corresponds to Xcode6.0
Errors may occur:
Error:could not find Automation.tracetemplate
Error:could not find iOS simulator binary at/application/xcode.app/contents/developer/platforms/iphonesimulator
4. Sendkeys vs SetValue
Sendkeys iOS cannot be entered
You can try SetValue instead
((Mobileelement) _driver.findelement (by)). SetValue (Stext);
5. Isappinstalled/removeapp/installapp
Isappinstalled This method can be used in Android (both simulator and real machine have tried)
But in iOS, using the simulator return value is always false, there is no error message, and then view source code discovery
CB (New Error ("You can not call isInstalled for the IOS simulator!");
The same Removeapp/installapp are
6. APP Path Settings
website says you can use the remote URL to set the CAP app
The official website is described below:
App the absolute local path or remote HTTP URL to an. IPA or. apk file, or a. zip containing one of these. Appium'll attempt to install this app binary on the appropriate device first. e.g.:/abs/path/to/my.apk or Http://myapp.com/app.ipa
I used http://sssss/x.zip for the convenience of centrally managing the installer
The problem of the pit Dad, Android is not supported, error can not find the app provided
IOS is OK, can be installed, but the test found a lot of controls and put on the local completely not an effect ...
So let's just use the local settings.
PS: Seemingly 1.3 solved the problem of Android HTTP, has not yet verified
7. Sudo does not boot after installing Appium
sudo npm install-g appium Consequences
Appium if used or installed with sudo
There is an expert on the Internet to solve this problem
The process is as follows:
Step 1. Change the owner of node
Cd/usr/local/lib
sudo chown-r Bixiaopeng node_modules
Step 2. Uninstalling Appium
NPM Uninstall Appium-g
Step 3. Reinstall Appium
NPM install-g Appium
Step 4. Start
Appium
Original link: http://blog.csdn.net/wirelessqa/article/details/29188665
Appium-ios Summary of various issues