Java is most widely used programming language in Selenium. Other than Java there are other languages too like Python, Pearl, PHP, Ruby, and so on.
Below is an example to login to Facebook using Selenium-java:
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 Email Id");
driver.findElement(By.name("pass")).sendKeys("your password");
driver.findElement(By.id("loginbutton")).click();
}
}