2016-04-25 14 views
2

は、Appiumが長時間押すと同時にスクリーンショットを撮ることができますか?その後Appuim - ロングプレスと同時にスクリーンショットを撮る

public void press(By by) throws IOException { 
    WebElement el = driver.findElement(by); 
    TouchAction action = new TouchAction(driver); 
    action.longPress(el);} 

私はテイクスクリーンショット

public void screenshot(String filename) throws IOException { 
    File srcFile=driver.getScreenshotAs(OutputType.FILE); 
    File targetFile=new File("./Screenshots/Navigation/" + generateCurrentDate()+ "/"+ filename +".jpg"); 
    FileUtils.copyFile(srcFile,targetFile);} 

を適用する。しかし、それは、長押しを行い、その後、スクリーンショットを取ります。私は基本的に長いプレスとスクリーンショットを同時に必要とします。

すべてのヘルプは、これは私がその

public void pressByElements(By by, int num) throws IOException, InterruptedException { 
    List<WebElement> el = driver.findElements(by); 
    TouchAction action = new TouchAction(driver); 
    action.press(el.get(num)).waitAction(2000).perform(); 

} 

を解決し、あなたが写真を撮ることができる方法である

+0

多分ここで何かが助けになるかもしれません:http://stackoverflow.com/questions/34201207/take-a-screenshot-during-dragging-in-appium – econoMichael

答えて

0

を高く評価しました。しかし、私はその要素を保留から解放したいときだけ、エラーが出ます。今のところ私はそれをリリースする気にしない。今すぐお気軽に

関連する問題