OOPS concepts:-[object oriented program]
It is having below concepts
1) class & objects
2) encapsulation
3) inheritance
4) polymorphism
5) abstraction
These are requested table concepts.
How to develop scripts to a project:-
Package –project-spicejet
Class – module -book a flight
Class -reasonable methods –objects (I,e url,login,logout)
Inheritance:
The process of extending [reversing]the public objects from the parent class to child class is known as “inheritance”.
From, where we are taking the public objects, is known as parent class or super class.
where we are going to use the public objects is known as child class.
At TekSlate, we offer resources that help you in learning various IT courses. We avail both written material and demo video tutorials. To gain in-depth knowledge and be on par with practical experience, then explore Selenium Training in Bangalore.
** write a program to back a holiday in spicejet .com by inheriting the parent class spicejet.popup.
Public class bookaholisday.inheritence extends spicejet-popup {
@test
Public void verifyholiday() throws exception {
Driver .find elements(by.linktext(“holiday”).click();
New select[driver .findelements(by.id(“destination id”))).selectvisibletest(“id”);
}
Thread.sleep(4000);
Driver.find element(by.xpath(“//input[@id=’locator id’]”)).click();
Driver .find element( “” [2] “)).click();
“ “; “ [3])).click();
}
}
polymorphism:-
The ability to define more methods with the same name is known as polymorphism.
It is two types
1) overloading
2) overriding
1) over loading:-
It occurs when more methods with the same name but with different parameters is known as overloading
Public void click(string str) {
Driver .findelements(by.linktext(str)).click();
}
Public void click (srting str, string str1) {
Driver.find elements(by.linktest(str)).click();
Driver.findelements(by.linktest(str1).click();
}
Public static void main(string [] args) {
Google languages
g.open url c;
g.click(“hindi”,”English”);
g.click(“gmail”);
Login into gmail.com by inheriting the class Google languages parameter and override the method click
Learn more about Selenium Interview Questions in this blog post.
2) overriding:-
It occurs when we inherit parent class
àIf we are using the method is behaving in two ways in child class one way was as in parent class in another way
- The updations which we made to the child class method is limited to child class only.
- The memory authorization in proper [same the memory] with over loading and over rising
Encapsulation:-
- The process of holding that operates into a single entity.
Abstraction:-
- The process of word hiding the data and show the accesseential features of the object is known as abstraction.
- We can achieve abstraction by using access modifier by
- Public, protected can be used in child class only.
- Public can be used in child class as well as they’re in the entire project by creating the object.
- Private objects can be used in the current class only
Inclined to build a Profession as Selenium Developer? Enroll here for Free Demo on Selenium Training In Dallas.
Assignment:
A Object Open URL Login Log out | B Compile Upload Send mail | C Register Print text box Print drop down |
RUN:
Open URL Login compare send log out clone Register
print next box
Source: https://tekslate.com