あなたは以下のように基本calssであなたのドライバを宣言することができます。
public class BaseClass {
static WebDriver driver;
@BeforeSuite
public void setup() throws InterruptedException, IOException {
driver = new FirefoxDriver();
driver.manage().window().maximize();
Properties obj = new Properties();
FileInputStream objfile = new FileInputStream(
System.getProperty("user.dir")
+ "\\src\\com\\provider\\Object.Properties");
obj.load(objfile);
driver.get(obj.getProperty("URL"));
}
}
をそして、あなた、あなたが作成したすべてのクラスで、あなたのドライバを宣言する必要はありませんので、あなただけの、以下のようにあなたのベースクラスを拡張することができます。
public class ProApp extends BaseClass{
@Test(priority=1)
public void clickLoginLink() throws InterruptedException, IOException {
Properties obj = new Properties();
FileInputStream objfile = new FileInputStream(System.getProperty("user.dir") +"\\src\\com\\provider\\Object.Properties");
obj.load(objfile);
driver.findElement(By.xpath(obj.getProperty("ClickOnLoginLink"))).click();
Thread.sleep(1000);
}
}