/**
 * Created with IntelliJ IDEA.
 * User: jhasmanyquiroz
 * Date: 11/11/15
 * Time: 3:08 PM
 * To change this template use File | Settings | File Templates.
 */
package ui.pages;

import framework.BrowserManager;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import ui.BasePageObject;

public class MainPage extends BasePageObject {
    private BrowserManager browser;
    private WebElement element;

    public MainPage() {
        super();
        browser = BrowserManager.getInstance();
    }

    public void clickLogInButton() {
        element = browser.getDriver().findElement(By.linkText("Log In"));
        element.click();
    }

    public void waitUntilPageObjectIsLoaded() {
        //To change body of implemented methods use File | Settings | File Templates.
    }
}

@@ -186,32 +186,81 @@
 ort 
-framework.BrowserManager
+org.openqa.selenium.WebElement;%0Aimport org.openqa.selenium.support.FindBy
 ;%0Aim
@@ -284,17 +284,34 @@
 elenium.
-B
+support.PageFactor
 y;%0Aimpor
@@ -328,34 +328,53 @@
 qa.selenium.
-WebElement
+support.ui.ExpectedConditions
 ;%0Aimport ui.
@@ -445,39 +445,204 @@
     
-private BrowserManager browser;
+@FindBy(linkText = %22Log In%22)%0A    private WebElement loginButton;%0A%0A    @FindBy(xpath = %22(//input%5B@value=''%5D)%5B2%5D%22)%0A    private  WebElement searchInput;%0A%0A    @FindBy(css = %22i.cif-search.search-icon%22)
 %0A   
@@ -661,23 +661,28 @@
 Element 
-element
+searchButton
 ;%0A%0A    p
@@ -712,61 +712,83 @@
     
-super();%0A        browser = BrowserManager.getInstance
+PageFactory.initElements(driver, this);%0A        waitUntilPageObjectIsLoaded
 ();%0A
@@ -805,20 +805,25 @@
  public 
-void
+LoginPage
  clickLo
@@ -848,244 +848,437 @@
     
-element = browser.getDriver().findElement(By.linkText(%22Log In%22));%0A        element.click();%0A    %7D%0A%0A    public void waitUntilPageObjectIsLoaded() %7B%0A        //To change body of implemented methods use File %7C Settings %7C File Templates.
+loginButton.click();%0A        return new LoginPage();%0A    %7D%0A%0A    public MainPage setSearchCourseInput(String searchCourse) %7B%0A        searchInput.clear();%0A        searchInput.sendKeys(searchCourse);%0A        return this;%0A    %7D%0A%0A    public CoursesPage clickSearchButton() %7B%0A        return new CoursesPage();%0A    %7D%0A%0A    public void waitUntilPageObjectIsLoaded() %7B%0A        wait.until(ExpectedConditions.visibilityOf(loginButton));
 %0A    %7D%0A%7D
 %0A
@@ -1276,9 +1276,8 @@
 %0A    %7D%0A%7D
-%0A

Implement the Page Factory Pattern and methods for login