My question is as follows: How can I reuse a browser session for tests that are in different java classes? I have the browser open like this:
public class OpenBr
One of the simple way which i figured out recently is to make the webdriver as static under class and reuse the same webdriver in any other test case
For example in testcase1:
public class globallogin {
static WebDriver driver = new ChromeDriver();
}
Now you can call the same webdriver in test case 2 as:
public class skucategory {
static globallogin login = new globallogin();
public static void main(String[] args) {
login.driver.get();
}
}