Notes
![]() ![]() Notes - notes.io |
import java.io.IOException;
import org.openqa.selenium.WebDriver;
import Report.ReportFactory;
import com.relevantcodes.extentreports.ExtentTest;
import com.relevantcodes.extentreports.LogStatus;
import com.standardchartered.s2b.controller.ActionMethods;
import com.standardchartered.s2b.controller.FlowMethods;
import com.standardchartered.s2b.controller.Report;
import com.standardchartered.s2b.controller.WebdriverFactory;
import com.standardchartered.s2b.utility.Constant;
public class LoginPage extends FlowMethods {
private WebDriver driver;
ActionMethods actionMethods;
public LoginPage( ) throws IOException
{
super();
// this.driver=driver; Commented as part of multithreading.
driver = WebdriverFactory.getInstance().getDriver();
actionMethods = new ActionMethods();
}
public void Logout_And_LoginAgain( String context, String context2) throws Exception {
try
{
System.out.println("Loggout and LoginAgain invoked");
String locator_logout = ObjectRepo.getProperty("LoginPage.Logout");
String locator_loginAgain = ObjectRepo.getProperty("LoginPage.Loginagain");
actionMethods.Logout_And_LoginAgain(locator_logout,locator_loginAgain);
Report.getInstance().generateReport(
Thread.currentThread().getStackTrace()[1].getMethodName(),
Constant.statusFlag, driver);
} catch (Exception e) {
// TODO Auto-generated catch block
Report.getInstance().generateReport(
Thread.currentThread().getStackTrace()[1].getMethodName(),
Constant.statusFlag, driver);
throw e;
}
}
/**
* @param args
* @throws IOException
*/
// ActionMethods actionMethods = new ActionMethods();
public void enterusername(String username) throws IOException {
ExtentTest extentTest = ReportFactory.getExtentTest();
try {
// System.out.println("This is the driver at page level ="+ driver);
System.out.println("Method : " + Thread.currentThread().getStackTrace()[1].getMethodName() + " | THread : " + Thread.currentThread().getName() + " | Test Data user name as " + username);
// ActionMethods actionMethods = new ActionMethods(driver);
String locator = ObjectRepo.getProperty("LoginPage.Login");
System.out.println("Inside enterusername = "+ username);
actionMethods.input_MandatoryField(username, ObjectRepo.getProperty("LoginPage.UserID"));
extentTest.log(LogStatus.PASS, Thread.currentThread().getStackTrace()[1].getMethodName(), "<font size="+3+" color='#7CFC00'>"+"Passed" +"</font>"+ " <br />" );
} catch (Exception e) {
e.printStackTrace();
extentTest.log(LogStatus.FAIL, Thread.currentThread().getStackTrace()[1].getMethodName(),"<span title='"+Constant.statusFlag.replaceAll("'", "'")+"'><a href='"+Constant.logsPath+"/automationFramework.log'><font size="+3+" color='#DC143C'>FAILED</font></a></span>"+
extentTest.addBase64ScreenShot(actionMethods.captureScreenshot(driver)) );
throw e;
}
}
public void clickLogin() throws IOException {
ExtentTest extentTest = ReportFactory.getExtentTest();
try{
System.out.println("Method " + Thread.currentThread().getStackTrace()[1].getMethodName() + " | Thread - " + Thread.currentThread().getName());
// ActionMethods actionMethods = new ActionMethods(driver);
String locator = ObjectRepo.getProperty("LoginPage.Login");
actionMethods.click(locator,"");
// Report.getInstance().generateReport(
// Thread.currentThread().getStackTrace()[1].getMethodName(),
// Constant.statusFlag, driver);
extentTest.log(LogStatus.PASS, Thread.currentThread().getStackTrace()[1].getMethodName(), "<font size="+3+" color='#7CFC00'>"+"Passed" +"</font>"+ " <br />" );
} catch (Exception e) {
e.printStackTrace();
// Report.getInstance().generateReport(
// Thread.currentThread().getStackTrace()[1].getMethodName(),
// Constant.statusFlag, driver);
extentTest.log(LogStatus.FAIL, Thread.currentThread().getStackTrace()[1].getMethodName(),"<span title='"+Constant.statusFlag.replaceAll("'", "'")+"'><a href='"+Constant.logsPath+"/automationFramework.log'><font size="+3+" color='#DC143C'>FAILED</font></a></span>"+
extentTest.addBase64ScreenShot(actionMethods.captureScreenshot(driver)) );
throw e;
}
}
public void enterGroupID(String groupID) throws IOException {
ExtentTest extentTest = ReportFactory.getExtentTest();
try{
// ActionMethods actionMethods = new ActionMethods(driver);
String locator = ObjectRepo.getProperty("LoginPage.GroupID");
System.out.println(Thread.currentThread().getStackTrace()[1].getMethodName() + " Thread | Method " + Thread.currentThread().getName() + " with group ID as " + groupID);
actionMethods.input_MandatoryField(groupID, locator);
// Report.getInstance().generateReport(
// Thread.currentThread().getStackTrace()[1].getMethodName(),
// Constant.statusFlag, driver);
extentTest.log(LogStatus.PASS, Thread.currentThread().getStackTrace()[1].getMethodName(), "<font size="+3+" color='#7CFC00'>"+"Passed" +"</font>"+ " <br />" );
} catch (Exception e) {
e.printStackTrace();
// Report.getInstance().generateReport(
// Thread.currentThread().getStackTrace()[1].getMethodName(),
// Constant.statusFlag, driver);
extentTest.log(LogStatus.FAIL, Thread.currentThread().getStackTrace()[1].getMethodName(),"<span title='"+Constant.statusFlag.replaceAll("'", "'")+"'><a href='"+Constant.logsPath+"/automationFramework.log'><font size="+3+" color='#DC143C'>FAILED</font></a></span>"+
extentTest.addBase64ScreenShot(actionMethods.captureScreenshot(driver)) );
throw e;
}
}
public void enter2FAType(String twoFAType) {
}
public void enter2FAPassword(String twoFAPassword) throws IOException {
ExtentTest extentTest = ReportFactory.getExtentTest();
try{
// ActionMethods actionMethods = new ActionMethods(driver);
String locator = ObjectRepo.getProperty("LoginPage.2FAPassword");
System.out.println(Thread.currentThread().getStackTrace()[1].getMethodName() + " Thread | Method - " + Thread.currentThread().getName() + " with password as " +twoFAPassword);
actionMethods.input_MandatoryField(twoFAPassword, locator);
// Report.getInstance().generateReport(
// Thread.currentThread().getStackTrace()[1].getMethodName(),
// Constant.statusFlag, driver);
extentTest.log(LogStatus.PASS, Thread.currentThread().getStackTrace()[1].getMethodName(), "<font size="+3+" color='#7CFC00'>"+"Passed" +"</font>"+ " <br />" );
} catch (Exception e) {
e.printStackTrace();
// Report.getInstance().generateReport(
// Thread.currentThread().getStackTrace()[1].getMethodName(),
// Constant.statusFlag, driver);
extentTest.log(LogStatus.FAIL, Thread.currentThread().getStackTrace()[1].getMethodName(),"<span title='"+Constant.statusFlag.replaceAll("'", "'")+"'><a href='"+Constant.logsPath+"/automationFramework.log'><font size="+3+" color='#DC143C'>FAILED</font></a></span>"+
extentTest.addBase64ScreenShot(actionMethods.captureScreenshot(driver)) );
throw e;
}
}
public void clickSubmit() throws IOException {
ExtentTest extentTest = ReportFactory.getExtentTest();
try{
// ActionMethods actionMethods = new ActionMethods(driver);
String locator = ObjectRepo.getProperty("LoginPage.Submit");
System.out.println(Thread.currentThread().getStackTrace()[1].getMethodName() + " - Thread | Method - " + Thread.currentThread().getName() );
actionMethods.click(locator,"");
// Report.getInstance().generateReport(
// Thread.currentThread().getStackTrace()[1].getMethodName(),
// Constant.statusFlag, driver);
extentTest.log(LogStatus.PASS, Thread.currentThread().getStackTrace()[1].getMethodName(), "<font size="+3+" color='#7CFC00'>"+"Passed" +"</font>"+ " <br />" );
} catch (Exception e) {
e.printStackTrace();
// Report.getInstance().generateReport(
// Thread.currentThread().getStackTrace()[1].getMethodName(),
// Constant.statusFlag, driver);
extentTest.log(LogStatus.FAIL, Thread.currentThread().getStackTrace()[1].getMethodName(),"<span title='"+Constant.statusFlag.replaceAll("'", "'")+"'><a href='"+Constant.logsPath+"/automationFramework.log'><font size="+3+" color='#DC143C'>FAILED</font></a></span>"+
extentTest.addBase64ScreenShot(actionMethods.captureScreenshot(driver)) );
throw e;
}
}
}
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team