2

私はモバイル デバイス (Android) での自動化テスト (Selenium Grid と appium) を初めて使用し、物理的な Android デバイス (Samsung Galaxy S5) での longPress アクションの問題に直面しています。longPress(WebElement el, int x, int y) を呼び出すと、appium はパラメーターとして指定した座標を尊重せず、TextView 要素の中心で長押しを続けているようです。Appium ログでは、座標を取得していることがわかりますが、longPress アクションを実行すると要素の中心になります。

appium インスタンスからのログは次のとおりです。

info: --> POST /wd/hub/session/8db9e619-aabb-4a55-81a8-f7a35e342b4c/touch/perform {"actions":[{"action":"longPress","options":{"element":"15","x":100,"y":0}}]}
info: [debug] Pushing command to appium work queue: ["element:getLocation",{"elementId":"15"}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"element:getLocation","params":{"elementId":"15"}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: getLocation
info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":{"x":102,"y":527}}
info: [debug] Pushing command to appium work queue: ["element:getSize",{"elementId":"15"}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"element:getSize","params":{"elementId":"15"}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: getSize
info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":{"width":876,"height":124}}
info: [debug] Pushing command to appium work queue: ["element:touchLongClick",{"elementId":"15","x":202,"y":527,"duration":1000}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"element:touchLongClick","params":{"elementId":"15","x":202,"y":527,"duration":1000}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: touchLongClick
info: [debug] [BOOTSTRAP] [debug] Performing TouchLongClick using element? true x: 540, y: 589, duration: 1000
info: --> GET /wd/hub/status {}
info: [debug] Responding to client with success: {"status":0,"value":{"build":{"version":"1.4.13","revision":"c75d8adcb66a75818a542fe1891a34260c21f76a"}},"sessionId":"8db9e619-aabb-4a55-81a8-f7a35e342b4c"}
info: <-- GET /wd/hub/status 200 0.698 ms - 156 {"status":0,"value":{"build":{"version":"1.4.13","revision":"c75d8adcb66a75818a542fe1891a34260c21f76a"}},"sessionId":"8db9e619-aabb-4a55-81a8-f7a35e342b4c"}
info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":true}


Appium version: 1.4.13.1
java-client-3.2.0

何か案は?Google検索で関連するものが見つからないため、他の誰もこの問題に直面していないようです. ありがとう!

編集:コードは次のとおりです

public void act_enterSubscriberClearedInput(String subscriber) {

    appiumcontroller().tap(subscriberUIElement);
    appiumcontroller().longPress(subscriberUIElement, 100, 0); 
    appiumcontroller().sendAndroidKeyEvent(AndroidKeyEvent.DEL);  
    appiumcontroller().sendKeys(subscriberUIElement, subscriber); 
    appiumcontroller().tap(BTN_OK);
}    



public MobileController longPress(String locator, int x, int y) {   
  this.performTouchAction(getTouchAction().longPress(waitForMobileElement(Constants.VISIBILITY.get(), locator, appiumDriver),x,y));
        return this;
    }
4

0 に答える 0