I have defined an object of Web driver in one class as
Static WebDriver driver;
and want to use that instance into another class to automate browser. Is it possible? Or I will have to define drivers every time in each class.
I tried by defining a webdriver in another class as:
Static webDriver AnotherDriver;
and then assigning it the value of other driver as:
AnotherDriver = ClassName.driver; But I am getting nullPointer Exception when I using AnotherDriver.
And If I will have define new driver in each class to do so then I will get stuck as i have defined few methods which I will be using in other class file. and all of them uses the driver defined in that class.
Any kind of suggestion is highly appreciated.