Page Object Model Framwork Notes
Annotations:
@FindBy----> used to locate one element
@FindBys---> used to locate particular element with multiple criteria(AND operations)
@FindAll---> used to lcoate particular element with any given critieria( OR operations)
@ 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
Post a Comment