Monday, 29 January 2018

How To Test a Login Page in Selenium Tool

How To Test a Login Page

In the Topic We Discuss about how to test the Login page(Text box and Button)
 


Login Program.

//Header Files

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver; 


public class login {//Class Name is Login
public static void main(String[] args) {   // Main Method

//Object Creation 
WebDriver f=new FirefoxDriver(); 

//To Maximize the Window,some time the Browser Window it open as Minimize,we want to maximize the Window to write the below code
f.manage().window().maximize();
 //In the get Function mention the URL
 
f.get("URL");

f.findElement(By.id("")).sendKeys(""); //Inside of the SendKeys pass the input to the element
f.findElement(By.id("")).sendKeys("");
f.findElement(By.name("")).click();  // To test the button or link use click operation.
}


Refer the Image how inspect the Element and find the locators

After Inspect the Inspect the Element

Find The Locators
  • id
  • name
  • xpath
  • value
  • classname
  • linktext
  • partiallinktext
  • tagName



No comments:

Post a Comment