Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.util.*;
- import org.openqa.selenium.By;
- import org.openqa.selenium.WebDriver;
- imoprt org.openqa.selenium.firefox.FirefoxDriver;
- public class mercury {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- System.setProperty("webdriver.gecko.driver","/home/student/geckodriver");
- System.out.print("Enter the expected title : ");
- String expected = sc.nextLine();
- WebDrvier driver = new FirefoxDriver();
- driver.get("https://www.gmail.com");
- if(driver.getTitle().equals(expected)) {
- System.out.println("Title Match");
- System.out.println(driver.getTitle());
- driver.findElement(By.id("identifierId")).clear();
- driver.findElement(By.id("identifierId")).sendKeys("prabhuravindra1966@gmail.com");
- driver.findElement(By.id("identifierNext")).click();
- try {
- Thread.sleep(5000);
- } catch(Exception e) {
- System.out.println("Exception occured");
- }
- driver.findElement(By.name("password")).sendKeys("4nm18cs124");
- driver.findElement(By.id("passwordNext")).click();
- System.out.println("PASS");
- } else {
- System.out.println("Title Mismatch");
- System.out.println("FAIL");
- }
- }
- }
Add Comment
Please, Sign In to add comment