How to press a button twice using Google UiAutomator?

前端 未结 5 2213
日久生厌
日久生厌 2021-01-05 09:29

I have the following script for typing \'33\' into the Calculator, in Android, using UiAutomator. However, only the first \'3\' is accepted, the second press is entirely ig

5条回答
  •  梦谈多话
    2021-01-05 09:39

    I found a small hack to go around the problem for now. get the boundaries everytime you run the test so its not device centric and will adapt on the fly.

    UiObject obj1 = new UiObject(new UiSelector().text("4"));
    
      Rect four = obj1.getBounds();
    
      getUiDevice().click(four.centerX(), four.centerY());
    

提交回复
热议问题