滑动方法不适用于创建的Android模拟器

时间:2020-05-06 16:58:23

标签: android automation android-emulator android-espresso avd

我在创建仿真器然后运行涉及滚动的自动化测试时遇到问题。我正在通过外壳程序脚本创建模拟器,将其启动,然后在我安装的应用程序上运行一组自动化测试。如果我通过Android Studio的AVD管理器手动创建仿真器并通过脚本启动该仿真器,则它运行良好,但是如果我通过命令脚本创建了AVD并按以下方式启动它:

echo "no" | avdmanager create avd -n automation -k "system-images;android-29;google_apis_playstore;x86" --abi google_apis_playstore/x86 -d "pixel" -f
emulator -avd automation -skin pixel_2 -skindir "$ANDROID_HOME/skins" -no-audio &

模拟器将启动并运行,直到我需要滚动屏幕为止。我尝试过多种方法来使屏幕滑动,例如:

element.perform(ViewActions.swipeUp());
public static ViewAction swipeUpAttempt() {
        return new GeneralSwipeAction(Swipe.FAST, GeneralLocation.BOTTOM_CENTER,
                GeneralLocation.TOP_CENTER, Press.FINGER);
    }

这些工作可在通过Android Studio中的AVD管理器手动创建的任何仿真器上进行,但对我通过命令脚本创建的任何仿真器均不执行。我使用Espresso作为驱动程序,如果可能的话,只希望使用该驱动程序。我是否缺少或不正确使用了硬件配置文件的某些部分或一部分avdmanager create命令?

0 个答案:

没有答案
相关问题