-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathfacebook.java
More file actions
24 lines (23 loc) · 929 Bytes
/
Copy pathfacebook.java
File metadata and controls
24 lines (23 loc) · 929 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package FacebookDemos;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class FacebookLogin {
public static void main(String[] args) {
// TODO Auto-generated method stub
FacebookLogin obj = new FacebookLogin(); obj.loginBrowser();
}
public void loginBrowser() {
System.setProperty("webdriver.firefox.marionette","D:\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.manage().window().maximize();
driver.manage().deleteAllCookies();
driver.manage().timeouts().pageLoadTimeout(15,TimeUnit.SECONDS);
driver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS);
driver.get("http://www.facebook.com");
driver.findElement(By.name("email")).sendKeys("Your Facebook Email Id");
driver.findElement(By.name("pass")).sendKeys("Your Password");
driver.findElement(By.id("loginbutton")).click();
}
}