Hi Kanak, to test facebook login using an Object Repository, you can use this code snippet:
<span style="font-size: 14pt; font-family: arial, helvetica, sans-serif;">import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.Test;
public class TestFacebookLogin {
@Test
public void TestOR() throws IOException{
File src=new File(".Object_Repo.properties");
FileInputStream fis=new FileInputStream(src);
// Create Properties class object to read properties file
Properties properties =new Properties();
// Load file so we can use into our script
properties.load(fis);
System.out.println("Property class loaded");
WebDriver driver=new FirefoxDriver();
driver.manage().window().maximize();
driver.get("http://www.facebook.com");
driver.findElement(By.xpath(pro.getProperty("facebook.login.username.xpath"))).
sendKeys("anvi.rajawat@gmail.com");
driver.findElement(By.xpath(pro.getProperty("facebook.login.password.xpath"))).
sendKeys("password");
driver.findElement(By.xpath(pro.getProperty("facebook.login.Signup.xpath"))).click();
}
}
</span>