Abstract class is used in defining a common super
classwhile writing Page Object Model layer of the
framework. We usually create an abstractclassnamed
BasePage to have all common members for every page written
in thisclass example getPageTitle().Then each Page class (HomePage, LoginPage, DashboardPage
etc.) inherit from BasePage.
Sometimes one may need to change the behavior of methods
implemented in superclass. So, subclass has freedom to
override that method where we use polymorphism.This is how we use Abstract class in real projects..In my framework I have created my
BasePage classas super
class of the all page classes.
I have collected all common elements
and functions into PageBase classand
all other page classes extent PageBase class.
By doing so, I don't have to locate very
common WebElements and it provides
reusability in my framework.
Also
1)Abstract classes cannot be instantiated
2)Abstract class meant to be inherited
so can not be final,staticandprivate2)An abstarct classes contains abstract method,
concrete methods or both.3)Any class which extends abstarct classmust
override all methods of abstract class4)An abstarct class can contain either
0or more abstract method.
Posted by: Guest
on May-28-2021
Code answers related to "how to create an object of abstract class"
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems
resetting your password contact us
Check Your Email and Click on the link sent to your email