Ads

Page Object Model Framwork Notes

 Annotations:

  1. @FindBy----> used to locate one element

  2. @FindBys---> used to locate particular element with multiple criteria(AND operations)

  3. @FindAll---> used to lcoate particular element with any given critieria( OR operations)

  4. @ FindBy @CacheLookup---> used to locate and store the element in the first time itself,to avoid finding element repeatedly

 

Strategy:

each page has unique java classes in which all Locators will be find and stored by using @findby those tags,initially all webelements stored in private variable,later using getters those will be retrieved as per usage..here we will have constructor,inside PageFactory concept will be used.

@findby and other annotations do set function so no need of setters in encapsulation here

Page factory initialises the web elements

LoginPage(WebDriver driver){

PageFactory.initElements(driver,this);

 

@ FindBy(id=”sangar”)

private WebElement username;

@ FindBys({@FindBy(id=”sangar”),{@FindBy(name=”kumar”)}}

private WebElement password

@ FindAll({@FindBy(id=”sangar”),{@FindBy(name=”kumar”)}}

private WebElement terms;

@ FindBy(id=”singinButn”)

@cacheLookup

private WebElement signInBTN;

 

Comments

Popular posts from this blog

Rest Assured Api Automation

Appium Notes

Jenkins Notes