Hi,
the below code was running fine in Aappium 1.4.16.1 version after uograding to 1.6.3 its not working
I already knew that By.name is no more supported in the latest version, so i modified the code with xpath still unable to run it successfully
the part of code will verify the elements based on it “Name” and “ID”, then it pass one by one in the for loop and verify weather it is present, if yes increment the count and it will say that particular element is present or not
now i am unable to verify the elements based on the element id as well as the name.
Can anyone help on this
driver.findElementByXPath("//android.widget.TextView[@text=‘Login with your test ID’]").click();
Thread.sleep(2000);
getScreenshot(“Main_without_login”);
int count = 0;
//To verify the following elements are present in the login page
String[] myArr = {“test IDs”, “Usage without logging in”, “com.test.mobile.android.mytest:id/body_icon”, “Log in with your test ID”, “Log in with your test ID to access the full features.”, “com.test.mobile.android.mytelstra:id/auth_info_button”};
for(int i =0; i<myArr.length; i++){
try{
if(myArr[i].contains("com.test")){
MobileElement e = driver.findElement(By.id(myArr[i]));
System.out.println(e);
count++;
}
else{
MobileElement e = driver.findElement(By.name(myArr[i]));
//MobileElement e = driver.findElementByXPath("//android.widget.TextView[@text=(myArr[i])]");
System.out.println(e);
count++;
}
}
catch (NoSuchElementException e){
System.out.println(myArr[i] + " not found");
Reporter.log("Screen Element" + " " + myArr[i] + " " + "not found");
getScreenshot("Failed Screenshot/_Skip_Login_MobEle_myLogin Not Found");
}
}