page object model

Solutions on MaxInterview for page object model by the best coders in the world

showing results for - "page object model"
Alex
15 May 2018
1Pom basically Creating java classes
2for the each page of our application,
3and storing related webelements,
4and methods in their respective classes.
5    
6Advantages of POM =
7First of all, it makes our code REUSABLE.
8I don't have to repeatedly locate web elements
9in every single other class.
10Secondly it is EASY TO MAINTAIN. I store one
11webelement in one class and it is a lot easier to
12fix any issue with that web element because I know
13exactly where everything is stored.
14Thirdly is seperating webelements and our test cases.
15Our test cases will be cleaner therefore 
16easy to manage overall.
17
18HOW I CREATE POM =  
19#1-I Create constructor, 
20and pass PageFactory.initElements(objectOfClass, Driver)
21#2- I use @FindBy annotation to locate web elements
22            - FindBy annotation comes from Selenium.
Max
07 Jul 2017
1Pom basically Creating java classes
2for the each page of our application,
3In my framework, I stored web elements and methods
4related to that Page into its own classes.
5    
6Advantages of POM
7First of all, it makes our code REUSABLE.
8I don't have to repeatedly locate web elements
9in every single other class.
10Secondly it is EASY TO MAINTAIN. I store one
11webelement in one class and it is a lot easier to
12fix any issue with that web element because I know
13exactly where everything is stored.
14Thirdly is seperating webelements and our test cases.
15Our test cases will be cleaner therefore 
16easy to manage overall.
17
18HOW I CREATE POM 
19#1-I Create Public constructor of the class
20and pass PageFactory.initElements(objectOfClass, Driver)
21#2- I use @FindBy annotation to locate web elements
22            - FindBy annotation comes from Selenium.
Jana
14 Oct 2019
1
2	  #1- We initialize the web elements using
3          PageFactory.initElements method
4          
5		- We create connection in between our Driver
6          and the object of current class.
7           
8		- So when we use the object of the class,
9          the object is already initialized with all
10          the web elements and able to use them.
11
12		PageFactory.initElements(Driver.getDriver(), this);
13
14	- #2 - We use @FindBy annotation to locate web elements.
15		@FindBy (xpath = "//something")
16		public WebElement exampleBox;