简体   繁体   中英

How can I double-click on the coordinates of the points with java, iOS device?

I want to double-tap on the coordinates of the points (672, 282). I tried to use "MultiTouchAction", but no result. This code is not working for me:

    `MultiTouchAction multiTouch = new MultiTouchAction(driver);
    TouchAction action0 = new TouchAction(driver).tap(672, 282);
    TouchAction action1 = new TouchAction(driver).tap(672, 282);
    multiTouch.add(action0).add(action1).perform();`

Agreeing with @Gaurav I would also suggest not to use integral coordinates of the screen to perform action unless nothing else works for you. Its better to do the same using elements on the screen and ideally this should work :

HashMap<String, Object> tapObject = new HashMap<String, Object>(); tapObject.put("tapCount", 2.0); 
// tapObject.put("touchCount", 1.0); 
tapObject.put("duration", 0.0);
// tapObject.put("x", 672.0);
// tapObject.put("y", 282.0); 
tapObject.put("element", <find your element>.getId()); // the id of the element we want to tap
JavascriptExecutor js = (JavascriptExecutor) driver; js.executeScript("mobile: tap", tapObject);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM