Please help me with the below code snippet. Supposed to be the below code will delete all the user-created profiles (User created profile has the delete-icon right next to the profile name) and if there's no user-created profile left for deletion, it should go back to the previous screen. The below code delete all the user-created profile which is expected, however it is generating an : "NoElementExceptionFound" for "MobileElement
DELTestProfile = driver.findElement(By.xpath("//android.widget.Image[@text ='icon-delete']"))"
//MANAGE PROFILE
MobileElement manProfile = driver.findElement(By.xpath("//android.view.View[@text = 'Manage Profiles']"));
manProfile.click();
//LOOP - DELETE USE-CREATED PROFILE
try {
while (driver.findElement(By.xpath("//android.widget.Image[@text ='icon-delete']")).isDisplayed()) {
MobileElement DELTestProfile = driver.findElement(By.xpath("//android.widget.Image[@text ='icon-delete']"));
DELTestProfile.click();
Thread.sleep(3000);
//CONFIRMATION TO DELETE
MobileElement ConfirmDELETEProfile = driver.findElement(By.xpath("//android.widget.Button[@text='DELETE']"));
ConfirmDELETEProfile.click();
Thread.sleep(3000);
}
} catch (Exception e){} MobileElement backProfile = driver.findElement(By.xpath("//android.widget.Button[@content-desc = 'back']"));
backProfile.click();