How to get an instance of a loaded FirefoxDriver?

I am testing a heavy web application on gwt. The test creates a new instance webdriverat each start, opens the browser and loads the page.

After a while, the test is transferred. I do not close the browser after the test, but when I test again, it initializes the browser again. Is there a way to get an instance of a downloaded browser and load a page on it?

UPD:

I've tried:

public class BaseTest {
    protected static ApplicationManager app;

    @Before
    public void setUp() throws Exception {
        if (app == null) {
            app = new ApplicationManager();
            app.getLoginHelper().login();
        }
    }
}

And for each run it is zero.

UPD2:

I need something like:

initializating new web driver
running test1
running test2
running test3
...
all test are finished

and after restarting:

using previosly launched driver
running test1
running test2
running test3
...
all test are finished
+4
source share
2 answers

. ( ). , .

public class Context{
    protected static WebDriver driver;
    static {
        driver = new FirefoxDriver();
        //Do whatever you want.
    }
}

public class MyTestClass extends Context{
    @Test
    public void test1(){
        driver.something();
    }
}
0
public class DriverBuilder {
    private WebDriver driver;
        DriverBuilder() {
        try {
            driver = new FirefoxDriver();
        } catch (Exception e) {
            throw new ExceptionInInitializerError(e);
        }
    }   
    public WebDriver getDriver() 
    {
        return driver;
    }
}

WebDriver, :

WebDriver driver = DriverBuilder.getDriver();
0

Source: https://habr.com/ru/post/1620331/


All Articles