New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close/quit webDriver in future thread #199

Closed
admizh opened this Issue Jul 25, 2015 · 2 comments

Comments

Projects
None yet
2 participants
@admizh
Contributor

admizh commented Jul 25, 2015

Hi Andrey,
Sometimes i have problems with calling driver.close () or driver.quit () method, and test always is suspended too long timeout. I think we should close the driver in hockable thread (in com.codeborne.selenide.impl.WebDriverThreadLocalContainer#closeWebDriver(java.lang.Thread))

private synchronized static void closeWithTimer(WebDriver driver) {
        THREAD_DRIVER_STATE_STORAGE.markDriverIsClose();
        Future<?> future = Executors.newSingleThreadExecutor().submit((Runnable) driver::close);
        try {
            future.get(100, SECONDS);
        } catch (InterruptedException | java.util.concurrent.TimeoutException e) {
            throw new SkipException("Long wait for killing browser", e);
        } catch (ExecutionException e) {
            throw new SkipException("Error on browser kill " + e.getMessage(), e);
        }
    }

@admizh admizh changed the title from Close/quit webDriver to Future to Close/quit webDriver in future thread Jul 25, 2015

@asolntsev

This comment has been minimized.

Show comment
Hide comment
@asolntsev

asolntsev Jul 25, 2015

Member

Nice! Let's do it.
Actually we also experience problems with closing webdrivers, so it will help us too.

Member

asolntsev commented Jul 25, 2015

Nice! Let's do it.
Actually we also experience problems with closing webdrivers, so it will help us too.

@asolntsev

This comment has been minimized.

Show comment
Hide comment
@asolntsev

asolntsev Jul 26, 2015

Member

Done in Selenide 2.20
Timeout is 5 seconds by default. Can be configured via system property selenide.closeBrowserTimeout (default value is 5000).

Member

asolntsev commented Jul 26, 2015

Done in Selenide 2.20
Timeout is 5 seconds by default. Can be configured via system property selenide.closeBrowserTimeout (default value is 5000).

@asolntsev asolntsev closed this Jul 26, 2015

asolntsev added a commit that referenced this issue Jul 26, 2015

@asolntsev asolntsev added this to the 2.20 milestone Jul 28, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment