-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFaceBook_Assignment1.java
More file actions
66 lines (35 loc) · 1.65 KB
/
FaceBook_Assignment1.java
File metadata and controls
66 lines (35 loc) · 1.65 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package week2.day2;
import java.time.Duration;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.Select;
import io.github.bonigarcia.wdm.WebDriverManager;
public class FaceBook_Assignment1 {
public static void main(String[] args) {
WebDriverManager.chromedriver().setup(); // configure Browser
ChromeDriver driver = new ChromeDriver(); // Launch Browser
driver.manage().window().maximize(); // Max browser
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(30)); // implicit wait
driver.get("https://en-gb.facebook.com/"); // Launching url
driver.findElement(By.xpath("//a[text()='Create New Account']")).click();
driver.findElement(By.name("firstname")).sendKeys("Aswin"); // Enter the first name
driver.findElement(By.name("lastname")).sendKeys("Kumar"); //Enter Last name
driver.findElement(By.name("reg_email__")).sendKeys("aswinravi5@gmail.com"); //Enter email
driver.findElement(By.name("reg_passwd__")).sendKeys("Aswin@2233"); //Enter Password
//Handling DropDown - DOB using Value,Index and Visible Text
WebElement day = (driver.findElement(By.id("day")));
Select dayDD = new Select(day);
dayDD.selectByVisibleText("22");
WebElement mnth = (driver.findElement(By.id("month")));
Select mnthDD = new Select(mnth);
mnthDD.selectByIndex(3);
WebElement year = (driver.findElement(By.id("year")));
Select yearDD = new Select(year);
yearDD.selectByValue("1994");
//Handling Radio button
driver.findElement(By.xpath("//input[@value='2']")).click();
//Close Browser
driver.close();
}
}