Friday, 4 August 2017

Page Object - HomePage

package com.test.automation.uiAutomation.uiActions;

import org.apache.log4j.Logger;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;

/**
 * @Blog Name : Selenium Code Example
 * @author Deepak Gupta
 * @Created Date 31-07-2017
 *
 */
public class HomePage {

public static final Logger log = Logger.getLogger(HomePage.class.getName());
WebDriver driver;

@FindBy(linkText = "Sign Up")
private WebElement signUp;

@FindBy(linkText = "Login")
private WebElement login;

@FindBy(id = "contactDtl")
private WebElement contactUs;

@FindBy(id = "aboutDtl")
private WebElement aboutUs;

@FindBy(id = "alertMessageForSuccess")
private WebElement infoMessage;

public HomePage(WebDriver driver) {
PageFactory.initElements(driver, this);
}

public void clickToLogin() {
login.click();
log.info("clicked on login link and object is:- " + login.toString());
}

public void clickToSignUp() {
signUp.click();
log.info("clicked on signUp link and object is:- " + signUp.toString());
}

}

No comments:

Post a Comment

Code Example - File Download By Robot Class In Firefox Browser

Exported from Notepad++ package com . practiceCode ; import java . awt . AWTException ; import java . awt . Robot ; import j...