Hey @user, you can simply use findelements and the locator ID to get this done. In facebook they have a locator ID for each of the textbox and the buttons.
Here is the code I used to do this:
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class Handsonsel {
public static void main(String[] args) throws InterruptedException
{
System.setProperty("webdriver.chrome.driver","Yourpath\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get("https://www.facebook.com");
driver.findElement(By.id("email")).sendKeys("yourusername@gmail.com");
driver.findElement(By.id("pass")).sendKeys("password");
Thread.sleep(5000);
driver.findElement(By.id("u_0_2")).click();
Thread.sleep(7000);
}
}
Hope this helps.