document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. package grid;
  2.  
  3. import java.net.MalformedURLException;
  4. import java.net.URL;
  5.  
  6. import org.openqa.selenium.By;
  7. import org.openqa.selenium.WebDriver;
  8. import org.openqa.selenium.remote.DesiredCapabilities;
  9. import org.openqa.selenium.remote.RemoteWebDriver;
  10. import org.testng.annotations.AfterClass;
  11. import org.testng.annotations.BeforeClass;
  12. import org.testng.annotations.Test;
  13.  
  14. public class Facebook {
  15.     public WebDriver driver;
  16.    
  17.  
  18.     @Test
  19.     public void testFacebook() throws Exception {
  20.         Thread.sleep(5000);
  21.         driver.get("https://www.facebook.com");
  22.         driver.findElement(By.id("email")).sendKeys("WebDriverEventListener");
  23.         driver.findElement(By.id("pass")).sendKeys("Password");
  24.         driver.findElement(By.id("u_0_b")).sendKeys("FirstName");
  25.         driver.findElement(By.id("u_0_d")).sendKeys("LastName");
  26.         driver.findElement(By.id("u_0_f")).sendKeys("1234567890");
  27.         driver.findElement(By.id("u_0_i")).sendKeys("1234567890");
  28.         driver.findElement(By.id("u_0_k")).sendKeys("password");
  29.         Thread.sleep(5000);
  30.     }
  31.    
  32.     @BeforeClass
  33.     public void beforeClass() throws MalformedURLException{
  34.         DesiredCapabilities capability= new DesiredCapabilities();
  35.         capability.setBrowserName("firefox");
  36.         driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"),capability);
  37.  
  38.     }
  39.  
  40.     @AfterClass
  41.     public void afterClass() throws Exception {
  42.         driver.quit();
  43.     }
  44.  
  45. }
');