簡體   English   中英

如何使用Appium在iOS設備上執行左鍵滑動

[英]How to perform Swipe left on iOS device using Appium

我想使用appium在特定的xpath上執行滑動。 無論如何我能做到。

在此輸入圖像描述

對於上述場景,請執行以下操作:

WebElement elem = driver.findElementByXPath("//ur elem xpath");
int x = elem.getLocation().getX();
int y = elem.getLocation().getY();

TouchAction action = new TouchAction(driver);
 action.longPress(x+5,y+5).waitAction(3000).moveTo(100,0).perform().release();

讓我知道發生什么事

@noor這對我有用

JavascriptExecutor js = (JavascriptExecutor) driver;
    HashMap<String, Double> swipeObject = new HashMap<String, Double>();
        swipeObject.put("startX", 279.2);
        swipeObject.put("startY", 93.1);
        swipeObject.put("endX", 136.1);
        swipeObject.put("endY", 92.6);
        swipeObject.put("duration", 3.0);
        js.executeScript("mobile: flick", swipeObject);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM