Professional Documents
Culture Documents
Hierarchical Inheritance Example
Hierarchical Inheritance Example
Class 1:
package hierarchial_inheritance;
import org.openqa.selenium.WebDriver;
import
org.openqa.selenium.chrome.ChromeDriv
er;
System.setProperty("webdriver.chrome.
driver","D://chromedriver.exe");
d=new ChromeDriver();
d.get(url);
d.manage().window().maximize();
}
public void title()
{
System.out.println("page
title :"+d.getTitle());
}
Class :
package hierarchial_inheritance;
import java.util.List;
import org.openqa.selenium.By;
import
org.openqa.selenium.WebElement;
Class 3:
package hierarchial_inheritance;
import java.util.List;
import org.openqa.selenium.By;
import
org.openqa.selenium.WebElement;
System.out.println(drop1.get(i).getTe
xt());
}
}
public void Screenshot()
{
System.out.println("captured
screenshot sucessfully");
}
Class 4:
package hierarchial_inheritance;
}
Multiple inheritance :
class 1:
interface addition
{
Void add()
}
Class subtraction
{
Void sub()
{
int x,y=20,z=30;
z=y-z;
S.o.p();
}
class mul extends subtraction
implements addition
{
Public void add()
{
Int x, y=20,z=40;
X=y+z;
S.o.p(x);
}
Void mul()
{
int x,y=20,z=40;
X=y*z;
S.o.p(x);
}