My question is pretty straightforward I have parent class and I have created a new driver object of webdriver class there In my subclass I am able to access the driver object but its value is null I am not able to access the object properties My parent Class is
public class BaseTest {
public static WebDriver driver;
@BeforeTest
@Parameters("browser")
public void VerifyPageTitle(String browser)
{
if(browser.equalsIgnoreCase("chrome")){
System.setProperty("webdriver.chrome.driver","C://chromedriver_win32(1)//chromedriver_win32//chromedriver.exe");
driver = new ChromeDriver();
}
if(browser.equalsIgnoreCase("IE")){
System.setProperty("webdriver.ie.driver","C://IEDriverServer_x64_3.3.0//IEDriverServer.exe");
driver = new InternetExplorerDriver();
}
driver.manage().window().maximize();
}
}
in my sub-class code
public class SignPageTest extends BaseTest{
SignPage obj ;
Boolean stu;
@Test
public void navigateToSignPage(){
obj = new SignPage(driver);
stu = obj.navigateToSignIn();
}
@Test(priority=2)
public void getHandles(){
stu = obj.handlingWindows();
}
}
I am getting null-pointer as my driver is not initialized So please tell me the way to simply access the objects properties of super-class
the moment I make my driver as static I am able to access its properties in all other classes but I don't want it to be static