This declaration
WebDriver driver = new FirefoxDriver();
always opens a new instance window of Firefox. It doesn\'t use the already opened
You should instantiate your webdriver only once, when making a test and then pass it as argument for the other classes in constructors. Something like this:
public class Test {
WebDriver driver = new FirefoxDriver();
@Test
public void testHomePage() {
HomePage hp = new HomePage(driver);
//code here }
}
public class HomePage{
private static WebDriver driver;
public HomePage(WebDriver driver) {
this.driver = driver;}
}