If else .. Correct me pls | Selenium Forum
M
Posted on 22/11/2016
@Test
public void ChangePasswordloginCredentials(WebDriver driver,ExtentTest logger,ExtentReports extentReports) throws InvalidFormatException, IOException, InterruptedException {

org.apache.poi.ss.usermodel.Sheet sh1 = ReadExcelforNewResumeposting.IJLLoginsheetforChangePassword();
//List<String> ChangePasswordsheet = IJLLoginsheetforChangePassword();

for(int i = 0 ; i <= sh1.getLastRowNum() ;i++ ){

String username = sh1.getRow(i).getCell(0).getStringCellValue();
System.out.println(username);
String password = sh1.getRow(i).getCell(1).getStringCellValue();
System.out.println(password);
logger =extentReports.startTest("loginCredentials");
PageFactory.initElements(driver, this);

logger.log(LogStatus.INFO, "Importing the Login Test data sheet");
Thread.sleep(1200);
JobSeekerLink.click();
UserNametxt.isDisplayed();
logger.log(LogStatus.PASS, "User name field is exist", "Pass");
passwordtxt.isDisplayed();
logger.log(LogStatus.PASS, " Password field is exist", "Pass");
UserNametxt.sendKeys(username);
logger.log(LogStatus.PASS, "User Name entered successfully" , "SUCCESS");
passwordtxt.sendKeys(password);
logger.log(LogStatus.PASS, "Password entered successfully" , "SUCCESS");
Loginbtn.click();
if (Application_Usage_Password.isDisplayed() ) {
Application_Usage_Password.sendKeys("WinsonRules");
Acess_btn.click();
JobSeekerLink.click();
UserNametxt.sendKeys(username);
logger.log(LogStatus.PASS, "User Name entered successfully" , "SUCCESS");
passwordtxt.sendKeys(password);
logger.log(LogStatus.PASS, "Password entered successfully" , "SUCCESS");
Loginbtn.click();
NewPasswordtextbox.sendKeys("password@1");
logger.log(LogStatus.PASS, "Enter the password in New Password text box " , "SUCCESS");
Confirmpasswordtextbox.sendKeys("password@1");
logger.log(LogStatus.PASS, "Enter the password in Confirm password text box" , "SUCCESS");
continuebtn.click();
logger.log(LogStatus.PASS, "Password changed" , "SUCCESS");
Logoutbtn.click();
JobSeekerLink.click();
} else {

NewPasswordtextbox.sendKeys("password@1");
logger.log(LogStatus.PASS, "Enter the password in New Password text box " , "SUCCESS");
Confirmpasswordtextbox.sendKeys("password@1");
logger.log(LogStatus.PASS, "Enter the password in Confirm password text box" , "SUCCESS");
continuebtn.click();
logger.log(LogStatus.PASS, "Password changed" , "SUCCESS");
Logoutbtn.click();
JobSeekerLink.click();
}
}

M
Replied on 22/11/2016

what is problem?