Recent Posts

LightBlog
Responsive Ads Here

Scripts

package emp.user.all.menus;

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

public class EmpUserMyInfoActionsMenus {


WebDriver driver;
@BeforeTest
public void open() {
System.setProperty("webdriver.chrome.driver","C:\\\\HIMANSU\\\\Automation Framework\\\\chromedriver_win32\\\\chromedriver.exe");
driver=new ChromeDriver();
}

@Test(priority=0)
public void login() throws Exception
{
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);

  driver.get("https://app.perkpayroll.com/Login.aspx");
  System.out.println("opened user login page");
  // maximize the browser window
  driver.manage().window().maximize();
  System.out.println("browser maximized");
  driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
  driver.findElement(By.id("Login1_UserName")).clear();
  driver.findElement(By.id("Login1_UserName")).sendKeys("tester@perktest.com");
  driver.findElement(By.id("Login1_Password")).clear();
  driver.findElement(By.id("Login1_Password")).sendKeys("open123");
  driver.findElement(By.id("Login1_LoginButton")).click();
  System.out.println("User Logged in Sucessfully ");
  Thread.sleep(2000);
}

@Test(priority=1)
public void checkInOut() throws Throwable {
//code for clicking main menu
  driver.findElement(By.xpath("//*[@id=\"ctl00_Menu_menuContainer\"]/li[2]/a/span")).click();
  System.out.println("clicking Main menu");
//code for clicking checkout sub menu
  driver.findElement(By.xpath("//*[@id=\"ctl00_Menu_menuContainer\"]/li[2]/ul/ul/li[1]/a")).click();
  System.out.println("clicking checkout sub menu");
 
//driver.get("https://app.perkpayroll.com/CheckInOut.aspx");
System.out.println("Check In/Out Timing page opened ");
WebElement checkin=driver.findElement(By.id("ctl00_cplMain_btnCheckIn"));
if (checkin.isEnabled()) {
  checkin.click();
  System.out.println("yes it is enabled and i just checkin it");
} else {
   System.out.println("No it is not enabled its in disable mode");
}

System.out.println("checkin suceesfully");


String shiftdate= driver.findElement(By.xpath("//span[contains(@class,'date")).getText();
System.out.println("shiftdate "+ shiftdate);
String Checkin= driver.findElement(By.xpath("//span[contains(@class,'{4}')]")).getText();
System.out.println("Checkin time "+ Checkin);
//driver.findElement(By.xpath("//ul[contains(@id,'tblCheckInOut')]//tbody//tr[1]//td[1]//span")).getText();
//System.out.println("tblCheckInOut");
Thread.sleep(2000);
}

@Test(priority=2)
public void employeeTimeEntries() throws Exception {

//code for clicking Employee Time Entries
  driver.findElement(By.xpath("//*[@id=\"ctl00_Menu_menuContainer\"]/li[2]/ul/ul/li[2]/a")).click();
  System.out.println("clicking Employee Time Entries sub menu");
//driver.get("https://app.perkpayroll.com/EmployeeTimeEntries.aspx");
System.out.println("EmployeeTimeEntries page opened");
WebElement from=driver.findElement(By.xpath("//*[@id=\"ctl00_cplMain_txtStartDate\"]"));
from.clear();
from.sendKeys("01/08/2018 09:00:00 AM");
WebElement to=driver.findElement(By.xpath("//*[@id=\"ctl00_cplMain_txtEndDate\"]"));
to.clear();
to.sendKeys("30/08/2018 10:50:00 PM");
driver.findElement(By.id("ctl00_cplMain_btnGo")).click();
Thread.sleep(2000);
JavascriptExecutor jse=(JavascriptExecutor)driver;
  jse.executeScript("scroll(0,300);");
  driver.findElement(By.xpath("//*[@id=\"ctl00_cplMain_divPayRollGrid\"]/div[2]/div/div/ul/li[2]/a")).click();
  System.out.println("EmployeeTimeEntries list details opened");
}

@Test(priority=3)
public void employeeEmpMonthlyAttendance() throws Exception {

//code for clicking Employee Monthly Attendance sub menu
  driver.findElement(By.xpath("//*[@id=\"ctl00_Menu_menuContainer\"]/li[2]/ul/ul/li[3]/a")).click();
  System.out.println("clicking Employee Monthly Attendance sub menu");
 
//driver.get("https://app.perkpayroll.com/EmpMonthlyAttendance.aspx");
System.out.println("EmpMonthlyAttendance page opened");
WebElement to=driver.findElement(By.xpath("//*[@id=\"ctl00_cplMain_txtStartDate\"]"));
to.clear();
to.sendKeys("01/09/2018");
driver.findElement(By.id("ctl00_cplMain_btnGo")).click();
Thread.sleep(2000);
JavascriptExecutor jse=(JavascriptExecutor)driver;
  jse.executeScript("scroll(0,300);");
  Thread.sleep(2000);
}

@Test(priority=4)
public void employeeApplyLeaves() throws Exception {
//code for clicking ApplyLeaves sub menu
  driver.findElement(By.xpath("//*[@id=\"ctl00_Menu_menuContainer\"]/li[2]/ul/ul/li[4]/a")).click();
  System.out.println("clicking ApplyLeaves sub menu");
 
//driver.get("https://app.perkpayroll.com/ApplyLeaves.aspx");
System.out.println("Apply Leave page opened ");

  System.out.println("Filling on Apply leave form");
 
  JavascriptExecutor js = (JavascriptExecutor) driver;
  js.executeScript("window.scrollBy(0,200)");
  System.out.println("scrolling down the apply leave page");

  driver.findElement(By.xpath("//label[@for=\"ctl00_cplMain_rbtnListTo\"]\r\n")).click();
 
  System.out.println("clicking ");   
  driver.findElement(By.xpath("//*[@id=\"ctl00_cplMain_divTextFields\"]/div[1]/div[2]/div/div/input")).click();
  System.out.println("clicked leaves");
 
  //sending through keyboard
  driver.findElement(By.xpath("//*[@id=\"ctl00_cplMain_divTextFields\"]/div[1]/div[2]/div/div/input")).sendKeys(Keys.ARROW_DOWN);
  driver.findElement(By.xpath("//*[@id=\"ctl00_cplMain_divTextFields\"]/div[1]/div[2]/div/div/input")).sendKeys(Keys.ARROW_DOWN);
  driver.findElement(By.xpath("//*[@id=\"ctl00_cplMain_divTextFields\"]/div[1]/div[2]/div/div/input")).sendKeys(Keys.ENTER);
 
  System.out.println("leave selected");
  driver.findElement(By.xpath("//*[@id=\"ddlLevFromShift\"]/div/input")).click();
  driver.findElement(By.xpath("//*[@id=\"ddlLevFromShift\"]/div/input")).sendKeys(Keys.ARROW_DOWN);
  driver.findElement(By.xpath("//*[@id=\"ddlLevFromShift\"]/div/input")).sendKeys(Keys.ENTER);

  System.out.println("clicked halfday");
 
 
  driver.findElement(By.xpath("//*[@id=\"ctl00_cplMain_txtLevReqFrom\"]")).sendKeys("15/10/2018");
  System.out.println("from date entered");
 
  driver.findElement(By.xpath("//*[@id=\"ctl00_cplMain_txtLevReqTo\"]")).sendKeys("15/10/2018");
  System.out.println("to date entered");
 
  driver.findElement(By.xpath("//*[@id=\"ctl00_cplMain_txtreason\"]")).sendKeys("Going to home town for weekend");
  System.out.println("reason entered");
 
  driver.findElement(By.xpath("//*[@id=\"ctl00_cplMain_txtConAddr\"]")).sendKeys("7788961200 himansu");
  System.out.println("contact details filled");
 
  driver.findElement(By.xpath("//*[@id=\"ctl00_cplMain_EmpName\"]")).sendKeys("Krishna Babu - PERK001");
  System.out.println("Reliever information added");
 
  driver.findElement(By.xpath("//*[@id=\"ctl00_cplMain_btnApply\"]")).click();
  System.out.println("clicked next button");
 
  driver.findElement(By.xpath("//*[@id=\"ctl00_cplMain_Button3\"]")).click();
  System.out.println("clicked on confirmation button ");
 
  driver.get("https://app.perkpayroll.com/MyRequests.aspx");
  System.out.println("my request page opened");
 
  driver.findElement(By.xpath("//*[@id=\"ctl00_cplMain_grvWorkFlowDetails_ctl02_imgbtnDetails\"]")).click();
  System.out.println("clicked on appled leave details button");
  Thread.sleep(1000);
  JavascriptExecutor js1 = (JavascriptExecutor) driver;
  js1.executeScript("window.scrollBy(0,400)");
  System.out.println("scrolling down the apply leave page");
  Thread.sleep(5);
   driver.findElement(By.xpath("//*[@id=\"ctl00_cplMain_WorkFlowControl1_wfctxtComments\"]")).sendKeys("Need to go urgent please sir accept my leave ");
  System.out.println("comment added");
 
  driver.findElement(By.xpath("//*[@id=\"ctl00_cplMain_WorkFlowControl1_wfcbtnRemindLev\"]")).click();
  System.out.println("sucessfully remindation sent");
 
  Thread.sleep(1000);

}
@Test(priority=5)
public void employeeLeaveRequisition() throws Exception {
/*/login first
//driver.get("https://app.perkpayroll.com/Login.aspx");
  System.out.println("opened user login page");
  // maximize the browser window
 
  driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
  driver.findElement(By.id("Login1_UserName")).clear();
  driver.findElement(By.id("Login1_UserName")).sendKeys("tester@perktest.com");
  driver.findElement(By.id("Login1_Password")).clear();
  driver.findElement(By.id("Login1_Password")).sendKeys("open123");
  driver.findElement(By.id("Login1_LoginButton")).click();
  System.out.println("User Logged in Sucessfully ");
  Thread.sleep(2000);
  */
//LeaveRequisition start
//driver.get("https://app.perkpayroll.com/LeaveRequisition.aspx");
//code for clicking Leave Requisition sub menu
  driver.findElement(By.xpath("//*[@id=\"ctl00_Menu_menuContainer\"]/li[2]/ul/ul/li[5]/a")).click();
  System.out.println("clicking Leave Requisition sub menu");
  //code for clicking pagination 2 next button
driver.findElement(By.xpath("//*[@id=\"ctl00_cplMain_divLeaveRequisitionGrid\"]/div[2]/div/div/ul/li[2]/a")).click();
System.out.println("LeaveRequisition page opened");
driver.findElement(By.xpath("//*[@id=\"ctl00_cplMain_grvLevReq_ctl02_imgbtnDetails\"]")).click();
System.out.println("LeaveRequisition details button clicked");
Thread.sleep(2000);
JavascriptExecutor jsed=(JavascriptExecutor)driver;
  jsed.executeScript("scroll(0,300);");
  Thread.sleep(2000);

}

@Test(priority=6)
public void employeeMyRequests() throws Exception {
//code for clicking Request Details sub menu
  driver.findElement(By.xpath("//*[@id=\"ctl00_Menu_menuContainer\"]/li[2]/ul/ul/li[6]/a")).click();
  System.out.println("clicking Request Details sub menu");
 
//driver.get("https://app.perkpayroll.com/MyRequests.aspx");
driver.findElement(By.xpath("//*[@id=\"ctl00_cplMain_divLeaveRequestGrid\"]/div[2]/div/div/ul/li[2]/a")).click();
System.out.println("MyRequests page opened");
driver.findElement(By.xpath("//*[@id=\"ctl00_cplMain_grvWorkFlowDetails_ctl02_imgbtnDetails\"]")).click();
System.out.println("MyRequests details button clicked");
Thread.sleep(2000);
JavascriptExecutor jsed=(JavascriptExecutor)driver;
  jsed.executeScript("scroll(0,300);");
  Thread.sleep(2000);

}
@Test(priority=7)
public void employeeMyApprovals() throws Exception {

  //code for clicking Approvals Details sub menu
  driver.findElement(By.xpath("//*[@id=\"ctl00_Menu_menuContainer\"]/li[2]/ul/ul/li[7]/a")).click();
  System.out.println("clicking Approvals Details sub menu");
 
//driver.get("https://app.perkpayroll.com/MyApprovals.aspx");
System.out.println("Fliter  selected");
  driver.findElement(By.xpath("//*[@id=\"ctl00_cplMain_divFilter\"]/div[2]/div/input")).click();
  driver.findElement(By.xpath("//*[@id=\"ctl00_cplMain_divFilter\"]/div[2]/div/input")).sendKeys(Keys.ARROW_DOWN);
  driver.findElement(By.xpath("//*[@id=\"ctl00_cplMain_divFilter\"]/div[2]/div/input")).sendKeys(Keys.ENTER);
  System.out.println("status selected");
  driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
  WebElement date=driver.findElement(By.id("ctl00_cplMain_txtFilterValue"));
  date.clear();
  date.sendKeys("10/09/2018");
  driver.findElement(By.id("ctl00_cplMain_imgFilter")).click();
  System.out.println("Approvals Details Sucessfully ");
  Thread.sleep(2000);

}
@Test(priority=8)
public void employeeMyPaySlip() throws Exception {

  //code for clicking Pay slip sub menu
  driver.findElement(By.xpath("//*[@id=\"ctl00_Menu_menuContainer\"]/li[2]/ul/ul/li[8]/a")).click();
  System.out.println("clicking Pay slip sub menu");

//driver.get("https://app.perkpayroll.com/MyPaySlip.aspx");
System.out.println("Payslip page opened");
  driver.findElement(By.xpath("//*[@id=\"ctl00_updPanel\"]/div/section[1]/div/div/div/div/div[1]/div/input")).click();
  driver.findElement(By.xpath("//*[@id=\"ctl00_updPanel\"]/div/section[1]/div/div/div/div/div[1]/div/input")).sendKeys(Keys.ARROW_DOWN);
  driver.findElement(By.xpath("//*[@id=\"ctl00_updPanel\"]/div/section[1]/div/div/div/div/div[1]/div/input")).sendKeys(Keys.ENTER);
  System.out.println("Pay Period selected");
  driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
 
  driver.findElement(By.id("ctl00_cplMain_btnGo")).click();
  System.out.println("Payslip Payslip for the period showing ");
  Thread.sleep(2000);
  Thread.sleep(1000);
JavascriptExecutor jsed=(JavascriptExecutor)driver;
  jsed.executeScript("scroll(0,300);");
  Thread.sleep(2000);

}

@Test(priority=9)
public void employeeTaxDeclarationForm() throws Exception {
//code for clicking Tax Declaration sub menu
  driver.findElement(By.xpath("//*[@id=\"ctl00_Menu_menuContainer\"]/li[2]/ul/ul/li[9]/a")).click();
  System.out.println("clicking Tax Declaration sub menu");
/*
//driver.get("https://app.perkpayroll.com/TaxDeclarationForm.aspx");
System.out.println("TaxDeclarationForm page opened");
  driver.findElement(By.xpath("//*[@id=\"ctl00_updPanel\"]/div/section[1]/div/div/div/div/div[1]/div/input")).click();
  driver.findElement(By.xpath("//*[@id=\"ctl00_updPanel\"]/div/section[1]/div/div/div/div/div[1]/div/input")).sendKeys(Keys.ARROW_DOWN);
  driver.findElement(By.xpath("//*[@id=\"ctl00_updPanel\"]/div/section[1]/div/div/div/div/div[1]/div/input")).sendKeys(Keys.ENTER);
  System.out.println("TaxDeclarationForm Financial Year selected");
  //driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
 
  driver.findElement(By.id("btnPrint")).click();
  System.out.println("TaxDeclaration Employee Details for the period showing ");
  //Thread.sleep(20 );
  //Thread.sleep(10);
JavascriptExecutor jsed=(JavascriptExecutor)driver;
  jsed.executeScript("scroll(0,1200);");
  Thread.sleep(1000);
*/
}
@Test(priority=10)
public void employeeYearToTillDate() throws Exception {
//code for clicking Year To Till Date Salary sub menu
  driver.findElement(By.xpath("//*[@id=\"ctl00_Menu_menuContainer\"]/li[2]/ul/ul/li[10]/a")).click();
  System.out.println("clicking Year To Till Date Salary sub menu");

//driver.get("https://app.perkpayroll.com/YearToTillDate.aspx");
System.out.println("YearToTillDate page opened");
  driver.findElement(By.xpath("//*[@id=\"ctl00_cplMain_divFinYear\"]/div/input")).click();
  driver.findElement(By.xpath("//*[@id=\"ctl00_cplMain_divFinYear\"]/div/input")).sendKeys(Keys.ARROW_DOWN);
  driver.findElement(By.xpath("//*[@id=\"ctl00_cplMain_divFinYear\"]/div/input")).sendKeys(Keys.ENTER);
  System.out.println("YearToTillDateForm Financial Year selected");
  driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
 
  driver.findElement(By.id("ctl00_cplMain_btnReport")).click();
  System.out.println("YearToTillDate Employee Details for the period showing ");
// Thread.sleep(2000);
  //Thread.sleep(1000);
JavascriptExecutor jsed=(JavascriptExecutor)driver;
  jsed.executeScript("scroll(0,1300);");
  //logged out emp
  driver.findElement(By.xpath("//*[@id=\"ctl00_empImage\"]")).click();
  System.out.println("clicking on logout buuton");
 
  driver.findElement(By.xpath("//*[@id=\"ctl00_lblMenu\"]/li[3]")).click();
  System.out.println("sucessfully logged out");

}

@Test(priority=11)
public void employeeOrganizations() throws Exception {
driver.findElement(By.id("Login1_UserName")).sendKeys("tester@perktest.com");
  //driver.findElement(By.id("Login1_Password")).clear();
  driver.findElement(By.id("Login1_Password")).sendKeys("open123");
  driver.findElement(By.id("Login1_LoginButton")).click();
  System.out.println("user Login sucess ");
//code for clicking Organizations menu
  driver.findElement(By.xpath("//*[@id=\"ctl00_Menu_menuContainer\"]/li[3]/a/span")).click();
  System.out.println("clicking Organizations menu");

//driver.get("https://app.perkpayroll.com/YearToTillDate.aspx");

  driver.findElement(By.xpath("//*[@id=\"ctl00_Menu_menuContainer\"]/li[3]/ul/ul/li[1]/a")).click();
  System.out.println("Organizations page opened");
  Thread.sleep(2000);
  Thread.sleep(1000);
JavascriptExecutor jsed=(JavascriptExecutor)driver;
  jsed.executeScript("scroll(0,1300);");
  Thread.sleep(1000);
  //logged out emp
 
  driver.findElement(By.id("ctl00_cplMain_grvOrg_ctl02_imgbtnDetails")).click();
  System.out.println("clicked details button");
  Thread.sleep(1000);
  //open employee
  driver.findElement(By.xpath("//*[@id=\"ctl00_Menu_menuContainer\"]/li[4]/a/span")).click();
  //click emp details button
  driver.findElement(By.id("ctl00_cplMain_grvEmpList_ctl02_imgbtnDetails")).click();
  System.out.println("Employee Info page opened");
  JavascriptExecutor jsedw=(JavascriptExecutor)driver;
  jsedw.executeScript("scroll(0,1300);");
// Thread.sleep(1000);
  //open perk app
  driver.findElement(By.xpath("//*[@id=\"ctl00_Menu_menuContainer\"]/li[5]/ul/ul/li/a")).click();
  System.out.println("Perk Mobile App code open");


}



}







Subject : Leave for Going to Village
Dear Sir,
 I Deepak humbly request you that I have to visit my native place in where a ceremonial festival is being celebrated at Kantabania from 12 September for 7 days.
 Being native of the place, this festival stand as a must for me to attend along with family and other natives as a ritual .
 Now I want to go to Home to meet my parents, siblings and friends in third week of September. My leave would start from September 10, 2018.
 My parents are calling me again and again and I can’t refuse them.
  Kindly allow me a week long leave, So that I can go to my village, meet my family and settle down a few important matters too within 11 days.
I request you to please grant me 11 days leave from 10 September to 21th September 2018. I shall be very grateful.
   Thanking you and looking for approval.-

Yours sincerely,
 Deepak Kumar Satapathy
 04/09/2018

No comments:

Post a Comment