1, the use of webdriver execution, you can also customize the file location in this method, you need to move by manipulating file format
// create driver using the driver factory Appiumdriver driver=driverfactory.getdriver (); // Execute, generate the file file, the default save location is under the Temp folder of the system's current account, in the format PNG File File=driver.getscreenshotas (Outputtype.file);
2. Click on the app to click and swipe
Click events are divided into: touchaction multitouchaction can also use Webdriver direct click
Touchaction click Method for tap, there are the following overloaded methods:
Tap (webelement): Click on the element.
Tap (int x,int y): Click fixed coordinates, which is relative to the screen.
Tap (Webelement,int x,int y): Click the button to fix the coordinates.
Webelement weadd=this. Driver.findelementbyname ("Add contact"); // Create Touchaction Touchaction touch=New touchaction (this. driver); // Click the control directly Touch.tap (weadd); // Click Coordinates TOUCH.TAP (weadd.getlocation (). X+1, Weadd.getlocation (). y+1); // Click the coordinates on the control Touch.tap (Weadd,weadd.getlocation (). X+1, Weadd.getlocation (). y+1);
Multitouchacion Multi-Touch
// Add the above click event to multi-touch to perform multitouch.add (Touch). Perform ();
Driver Direct Contact Control
This.driver.tap (int, webelement, int); Multi-touch controls and control of click events
// Touch Point is 1 , click Control is Weadd, touch event is 500msthis. Driver.tap (1, Weadd, 500);
This.driver.tap (arg0, Arg1, arg2, ARG3);
// The touch point is 1, the touch coordinates are x, Y, and the touch event is 500msthis. Driver.tap (1, Weadd.getlocation (). x, Weadd.getlocation (). Y, 500);
Appium related Learning (iii) using Webdriver and app click events