Open a Chrome browser.
Navigate to “http://www.facebook.com,"
Verify that the page is redirected to “http://www.facebook.com, by getting the current URL. (use if-else condition to verify this condition or use Assert.assertequals() in case you are familiar with TestNG or JUnit)
Verify that there is a “Create an account” section on the page.
package facebook;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.Test;
import POM.PomDemo;
public class facebooktest {
@Test
public static void PomDemo()
{
System.setProperty("webdriver.chrome.driver","D:\\selenium\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("https://www.facebook.com/");
PomDemo.textbox(driver);
------------------------------------------------
package facebook;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
public class Facebooklogin {
public static WebElement textbox(WebDriver driver) {
WebElement search=driver.findElement(By.name("q"));
search.sendKeys("Google");
search.sendKeys(Keys.ENTER);
return search;
}
public static WebElement searchbutton(WebDriver driver){
search=driver.findElement(By.name("btnk"));
return search;
}
}