0

デバイス イベントからの連絡先を許可するアプリがあります。( autoAlertAccept,true) を使用しましたが、うまくいきません。私はappium 1.5.2を使用していますが、その特定の連絡先をスワイプして、その特定の連絡先とチャットしたり通話したりしたいと思っています。私が使用したとき:

driver.manage().timeouts().implicitlyWait(50, TimeUnit.SECONDS); 
driver.findElement(By.className("android.widget.ImageButton")).click();
    size1 = driver.manage().window().getSize();   
    System.out.println(size1);    int x1 = (int) (size1.width * 0.70);

       int x2 = (int) (size1.width * 0.30);

       int starty =size1.height / 2;

       System.out.println(x1 + x2 + starty);

      driver.findElement(By.name("Demo Usr"));   
    driver.swipe(x1,starty,x2,starty,3000);

私はいくつかの例外を見つけました

4

1 に答える 1

0

提供されたコードは、画面を左から右にスワイプします。ただし、要素をある位置から別の位置に移動するには、次のコードを使用します。

WebElement elem = driver.findElement(By.xpath("ur xpath"));//get element locator as ur wish by accesibility id or xpath. 

int startX = elem.getLocation().getX();
int startY = elem.getLocation().getY();

//this will swipe from right to left horizontally
driver.swipe(startX,startY,startX-90,startY,2000);
// use 90 or more according to ur screen position

//this will swipe from left to right horizontally
driver.swipe(startX,startY,startX+90,startY,2000);

//u must have to be sure that this location is within the screen, otherwise u will get an error

問題がある場合はお知らせください。

于 2016-05-30T08:48:07.547 に答える