如何使用selenium自动从app介绍页面切换到appium的主页

问题描述 投票:0回答:1

我是appium-android的新手。为一个应用程序编写脚本。我必须将App介绍页面切换到主要登录活动。怎么做?

appium appium-android
1个回答
0
投票

您可以开始新活动,如下所示

1.创建Activity类对象

   Activity activity = new Activity("app package goes here", "app activity goes here");

2.将对象传递给startActivity方法

    driver.startActivity(activity);

3.如果需要,您可以根据appPackage和appActivity名称添加等待

       activity.setWaitAppPackage("app wait package goes here");
       activity.setWatAppActivity("app wait activity goes here");
  1. 用作测试方法 @Test public void startActivityInThisAppTestCase() { Activity activity = new Activity("app package goes here", "app activity goes here"); driver.startActivity(activity); assertEquals(driver.currentActivity(), "app switched activity goes here"); }

如果您想查看更多Activity类的测试用例,请按照此link进行操作

如果您想查看startActivity方法的库详细信息,请遵循此link

© www.soinside.com 2019 - 2024. All rights reserved.