-
Notifications
You must be signed in to change notification settings - Fork 0
/
FacebookRegistrationByAutomation
66 lines (51 loc) · 2.17 KB
/
FacebookRegistrationByAutomation
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
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class FacebookRegistration {
public static void main(String args[]) throws InterruptedException{
//WebDriver driver = new FirefoxDriver();
WebDriver driver;
System.setProperty("webdriver.gecko.driver", "G:\\Automation Testing Tools\\geckodriver.exe");
driver =new FirefoxDriver();
driver.get("http://www.facebook.com");
driver.manage().window().maximize();
//Face book registration
//first name
driver.findElement(By.xpath(".//*[@id='u_0_1']")).sendKeys("Mr Rahman");
Thread.sleep(2000);
//surname
driver.findElement(By.xpath(".//*[@id='u_0_3']")).sendKeys("abc");
Thread.sleep(2000);
//mobile no or email address
driver.findElement(By.xpath(".//*[@id='u_0_5']")).sendKeys("[email protected]");
Thread.sleep(2000);
//re-enter mobile no or email
driver.findElement(By.xpath(".//*[@id='u_0_8']")).sendKeys("[email protected]");
Thread.sleep(2000);
//new password
driver.findElement(By.xpath(".//*[@id='u_0_a']")).sendKeys("123456Aa");
Thread.sleep(2000);
//birthday
//Day select
WebElement dayelement = driver.findElement(By.xpath(".//*[@id='day']"));
org.openqa.selenium.support.ui.Select daySelect = new org.openqa.selenium.support.ui.Select(dayelement);
daySelect.selectByIndex(5);
Thread.sleep(2000);
//Month select
WebElement monthelement = driver.findElement(By.xpath(".//*[@id='month']"));
org.openqa.selenium.support.ui.Select monthSelect = new org.openqa.selenium.support.ui.Select(monthelement);
monthSelect.selectByIndex(6);
//Year select
WebElement yearelement = driver.findElement(By.xpath(".//*[@id='year']"));
org.openqa.selenium.support.ui.Select yearSelect = new org.openqa.selenium.support.ui.Select(yearelement);
yearSelect.selectByIndex(15);
Thread.sleep(2000);
//select gender
driver.findElement(By.xpath(".//*[@id='u_0_k']/span[2]/label")).click();
Thread.sleep(2000);
//Create Account button click
driver.findElement(By.xpath(".//*[@id='u_0_e']")).click();
//happy coding....
}
}