CHECKPOINT VERIFICATION


Every single point under the expected column in manual test case should be present as a check point  in a automation test script in selenium there are four check points

1 Tittle

2 Text

3 URL

4 Element


TITLE CHECK POINT

Comparing the expected tittle with the actual title from the application to get the actual tittle can use

CHECK TITLE


package mypackage;

 

import java.util.concurrent.TimeUnit;

 

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

 

public class TitleCheckPoint {

 

public static void main(String[] args) {

System.setProperty("webdriver.gecko.driver","C:\\Browser\\geckodriver.exe");

WebDriver driver=new FirefoxDriver();

driver.manage().window().maximize();

driver.get("https://demo.actitime.com/login.do");

driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

                   

String actual=driver.getTitle();

String expected="actiTIME - Login";

                   

if (actual.equals(expected)) {

System.out.println("pass");

else {

System.out.println("fail");

}

}

}

 

PRINT TITLE

                                               

package mypackage;

 

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

 

public class Title {

 

public static void main(String[] args) {

System.setProperty("webdriver.gecko.driver","C:\\Browser\\geckodriver.exe");

WebDriver driver=new FirefoxDriver();

driver.manage().window().maximize();

driver.get("https://demo.actitime.com/login.do");

driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

                   

String title=driver.getTitle();

System.out.println(title);

}

}


SHORTCUT

System.out.println(" ActiTIME title : " + driver.getTitle());


URL CHECK POINT 

CHECK URL


package mypackage;

 

import java.util.concurrent.TimeUnit;

 

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

 

public class UrlCheckPoint {

 

public static void main(String[] args) {

System.setProperty("webdriver.gecko.driver","C:\\Browser\\geckodriver.exe");

WebDriver driver=new FirefoxDriver();

driver.manage().window().maximize();

driver.get("https://demo.actitime.com/login.do");

driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

                   

String actual=driver.getCurrentUrl();

String expected="https://demo.actitime.com/login.do";

                   

if (actual.equals(expected)) {

System.out.println("pass");

else {

System.out.println("fail");

}

}

}


PRINT URL

                                                                       

package mypackage;

 

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

 

public class URL {

 

public static void main(String[] args {

System.setProperty("webdriver.gecko.driver","C:\\Browser\\geckodriver.exe");

WebDriver driver=new FirefoxDriver();

driver.manage().window().maximize();

driver.get("https://demo.actitime.com/login.do");

driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

 

String url= driver.getCurrentUrl();

System.out.println(url);

}


SHORTCUT

System.out.println(" ActiTIME url : " +driver.getCurrentUrl());


TEXT CHECK POINT 

Text check point is used to compare any text on the application page

Text will be generally be inside on html tag {span, td, div,) to get the text we have to find the element and use the method

 

CHECK TEXT


Package mypackage;

 

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

 

public class Text {

 

public static void main(String[] args {

System.setProperty("webdriver.gecko.driver","C:\\Browser\\geckodriver.exe");

WebDriver driver=new FirefoxDriver();

driver.manage().window().maximize();

driver.get("https://demo.actitime.com/login.do");

driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

 

driver.findElement(By.id("username")).sendKeys("admin");

                   

driver.findElement(By.name("pwd")).sendKeys("manager");


driver.findElement(By.id("loginButtonContainer")).click();

                                       

String expectedText = "Enter Time-Track";

String actualText=driver.findElement(By.xpath("//td[@class= 'pagetitle']")).getText();

 

                   

if (actualText.equals(expectedText)) {

System.out.println("success");

else {

 System.out.println("fail")

}

}

}

 

PRINT TEXT

 

package mypackage;

 

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

 

public class Text {

 

public static void main(String[] args{

System.setProperty("webdriver.gecko.driver","C:\\Browser\\geckodriver.exe");

WebDriver driver=new FirefoxDriver();

driver.manage().window().maximize();

driver.get("https://demo.actitime.com/login.do");

driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

 

driver.findElement(By.id("username")).sendKeys("admin");

                   

driver.findElement(By.name("pwd")).sendKeys("manager");


driver.findElement(By.id("loginButtonContainer")).click();

 

String text=driver.findElement(By.xpath ("//td[text()=’Enter Time Track’]")).getText();

System.out.println(text);

 }

}

SHORTCUT

System.out.println(driver.findElement(By.xpath ("//td[text()=’Enter Time Track’]")));

 


ELEMENT CHECK POINT 

1. How do you know the weither a checkbox selected or not

2. We can use the driver.findElement()to find the checkbox and use the method isselecte() which will return a Boolean if true checkbox is selected and false if check box is not selected


CHECK BOX 


package mypackage;


import java.util.concurrent.TimeUnit;


import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.firefox.FirefoxDriver;


public class CheckBok {


public static void main(String[] args) {

System.setProperty("webdriver.gecko.driver","C:\\Browser\\geckodriver.exe");

WebDriver driver=new FirefoxDriver();

driver.manage().window().maximize();

driver.get("https://demo.actitime.com/login.do");

driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

driver.findElement(By.id("keepLoggedInCheckBox")).click();

boolean radio=driver.findElement(By.id("keepLoggedInCheckBox")).isSelected();

System.out.println(radio);

driver.findElement(By.id("keepLoggedInCheckBox")).click();

boolean

radio1=driver.findElement(By.id("keepLoggedInCheckBox")).isSelected();

System.out.println(radio1);


driver.findElement(By.id("keepLoggedInCheckBox")).click();

boolean 

radio2=driver.findElement(By.id("keepLoggedInCheckBox")).isSelected();

System.out.println(radio2);

}

}


SHORTCUT

 

package mypackage;

 

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

 

public class CheckBox {

 

public static void main(String[] args) {

System.setProperty("webdriver.gecko.driver","C:\\Browser\\geckodriver.exe");

WebDriver driver =new FirefoxDriver();

driver.manage().window().maximize();

driver.get("https://demo.actitime.com/login.do");

driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

 

driver.findElement(By.id("keepLoggedInCheckBox")).click();

System.out.println(driver.findElement(By.id("keepLoggedInCheckBox")).isSelected());

                   

driver.findElement(By.id("keepLoggedInCheckBox")).click();

        System.out.println(driver.findElement(By.id("keepLoggedInCheckBox")).isSelected());

}

}


RADIO BUTTON 


Package mypackage;

 

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

 

public class RadioButton {

 

public static void main(String[] args) {

System.setProperty("webdriver.gecko.driver","C:\\Browser\\geckodriver.exe");

WebDriver driver=new FirefoxDriver();

driver.manage().window().maximize();

driver.get("https://ssc.nic.in/registration/home");

driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);


driver.findElement(By.id("rbAadharYes")).click();

Boolean 

Radiostatus=driver.findElement(By.id("rbAadharYes")).isSelected();

System.out.println(Radiostatus);

                   

driver.findElement(By.id("rbAadharYes")).click();

boolean 

Radiostatus1=driver.findElement(By.id("rbAadharYes")).isSelected();

System.out.println(Radiostatus1);

                        

driver.findElement(By.id("rbAadharYes")).click();

boolean 

Radiostatus2=driver.findElement(By.id("rbAadharYes")).isSelected();

System.out.println(Radiostatus2);

 }

}

 

SHORTCUT

 

Package mypackage;

 

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

 

public class RadioButton {

 

public static void main(String[] args) {

System.setProperty("webdriver.gecko.driver","C:\\Browser\\geckodriver.exe");

WebDriver driver=new FirefoxDriver();

driver.manage().window().maximize();

driver.get("https://ssc.nic.in/registration/home");

driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

 

driver.findElement(By.id("rbAadharYes")).click();

System.out.println(driver.findElement(By.id("rbAadharYes")).isSelected());

System.out.println(driver.findElement(By.id("rbAadharYes")).isSelected());

}

}


LOGO


Package mypackage;

 

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

 

public class Logo {

 

public static void main(String[] args) {

System.setProperty("webdriver.gecko.driver","C:\\Browser\\geckodriver.exe");

WebDriver driver=new FirefoxDriver();

driver.manage().window().maximize();

driver.get("https://demo.actitime.com/login.do");

driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

 

boolean logostatus=driver.findElement(By.xpath("//div[@class='atLogoImg']")).isDisplayed();

System.out.println("logostatus");

}

}

 

SHORTCUT

 

Package mypackage;

 

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

 

public class Logo {

 

public static void main(String[] args) {

System.setProperty("webdriver.gecko.driver","C:\\Browser\\geckodriver.exe");

WebDriver driver=new FirefoxDriver();

driver.manage().window().maximize();

driver.get("https://demo.actitime.com/login.do");

driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

 

system.out.printin(driver.findElement(By.xpath("//div[@class='atLogoImg']")).isDisplayed());

}

}