-
Notifications
You must be signed in to change notification settings - Fork 0
/
Lab3.java
37 lines (34 loc) · 1.18 KB
/
Lab3.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package gmailTest;
import org.openqa.selenium.*;
import org.openqa.selenium.edge.*;
import java.util.Scanner;
public class Lab3 {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.setProperty("webdriver.edge.driver","C:\\Users\\Abhishek\\Downloads\\edgedriver_win64\\msedgedriver.exe");
Scanner sc = new Scanner(System.in);
String baseUrl = "https://www.gmail.com";
System.out.print("Enter Title: ");
String expected= sc.nextLine();
WebDriver driver=new EdgeDriver();
driver.get(baseUrl);
if(driver.getTitle().equals(expected)) {
System.out.println("Test Passed : Title Matched");
driver.findElement(By.id("identifierId")).clear();
driver.findElement(By.id("identifierId")).sendKeys("[email protected]");
driver.findElement(By.id("identifierNext")).click();
try {
Thread.sleep(5000);
}
catch(Exception e) {
System.out.println("Exception occured");
}
driver.findElement(By.name("Passwd")).sendKeys("01-09-2002");
driver.findElement(By.id("passwordNext")).click();
}
else
System.out.println("Test Failed : Title Mismatch");
driver.close();
sc.close();
}
}