2016-06-07 90 views

回答

0

對於上述方案,做到以下:

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(); 

讓我知道發生了什麼

+0

我想做一個特定的領域。有沒有什麼辦法可以用xpath或id做 –

+0

這是什麼問題?你能否更詳細地解釋你的要求? – noor

+0

我已更新上述查詢。我在測試1區域刷卡左邊 –

0

@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);