Concepts of OOPS in Selenium Automation Framework
Concepts of OOPS in Selenium Automation Framework
Framework
Q). how You used or applied OOPs concepts in your project or Automation Framework.
ANS-
ABSTRACTION-
In Page Object Model design pattern, we write locators (such as id, name, xpath etc.,) and
the methods in a Page Class. We utilize these locators in tests but we can’t see the
implementation of the methods. Literally we hide the implementations of the locators from
the tests.
In Java, abstraction is achieved by interfaces and abstract classes. Using interfaces, we can
achieve 100% abstraction
INTERFACE-
An interface in Java looks similar to a class but both the interface and class are two
different concepts. An interface can have methods and variables just like the class but the
methods declared in interface are by default abstract.
We can achieve 100% abstraction and multiple inheritance in Java with Interface.
INHERITANCE-
We extend the Base Class in other classes such as Tests and Utility Class.
Here we extend one class (Base Class like WebDriver Interface) into other class (like Tests,
Utility Class) is known as Inheritance
POLYMORPHISM-
1) METHOD OVERLOADING
2) METHOD OVERRIDING-
ENCAPSULATION-
All the classes in a framework are an example of Encapsulation. In POM classes, we declare
the data members as private using @FindBy and initialization of data members will be
done using Constructor to utilize those in methods.