2016-06-07 40 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); 
相关问题