Appium related Learning (iii) using Webdriver screenshots and app click events

Source: Internet
Author: User
Tags appium

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

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.