我有一个应用程序,每次我尝试登录时都可以使用。我必须在登录之前将该设备注册为设备。因此,我必须提供我的LASTNAME和USERID并单击REGISTER。完成此过程后,它将激活码发送到我的GMAIL。因此,在这里我必须调用GMAIL APP“问题1”。 NExt我必须输入主题激活码“问题2”的gmail。并从消息“问题3”中获取激活码。
到目前为止,我已经能够调用以我的姓氏,USER ID和REGISTER注册的第一个应用程序。之后,我无法调用第二个应用程序并检索数据。我是新来的鸦片迷,请帮忙enter image description here
公共类BaseClassTablet {
public static void main(String[] args) throws MalformedURLException, InterruptedException {
// TODO Auto-generated method stub
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability("deviceName", "Galaxy Tab S3");// setting > about
// phone
cap.setCapability("udid", "624258263526a1e8");
// udid is the device name when you press - cmd adb devices
cap.setCapability("platformName", "Android");
cap.setCapability("platformVersion", "8.0.0");
cap.setCapability("appPackage", "com.verizon.launcher.sdnasit");
cap.setCapability("appActivity", "com.verizon.launcher.webview.WebActivity");
// cap.setCapability(MobileCapabilityType.APP, "Apk file location
// C:\\apkfiles\\AndroidUI.apk");
// any application will have app package and app activity
// download apk info from playstore
URL url = new URL("http://127.0.0.1:4723/wd/hub");
AndroidDriver<WebElement> driver = new AndroidDriver<WebElement>(url, cap);
// navigation
// clicking on element
Thread.sleep(5000);
driver.findElement(By.id("iMSSO_Alert1_Continue_button")).click();
Thread.sleep(2000);
driver.findElement(By.id("lastName")).sendKeys("JOMON");
driver.findElement(By.id("USER")).sendKeys("JOMONLI");
driver.findElement(By.id("btnRegister")).click();
Thread.sleep(7000);
driver.findElement(By.id("iMSSO_Alert2_confirm_button"));
// activation
driver.findElement(By.xpath("//android.widget.EditText[@id='lastName'][1]")).sendKeys("JOMON");
driver.findElement(By.id("USER")).sendKeys("JOMONLI");
// HERE I HAVE TO RETRIVE THE CODE FROM GMAIL
driver.findElement(By.id("btnActivate")).click();
// driver.startActivity(com.google.android.gm,
// com.android.email.activity.setup.AccountCredentials);
// identify the element to do drag and drop
// since resource id is matching with other elements
}
}