'No valid session ID in Selenium when running multiple tests

I want to run multiple tests but after the first run I get an error: UnhandledPromiseRejectionWarning: NoSuchSessionError: This driver instance does not have a valid session ID (did you call WebDriver.quit()?) and may no longer be used . It seems like that the second run doesn't get session id.

My code looks like this (the main bit):

runTests = async () => {
    for (let i = 0; i < results.length; i++) {
        await subscribe('urlgoeshere');
    }
};
runTests();

async function subscribe(url) {
    try {
        await driver.get(url);
    }
    catch(err) {
        console.error(err);
    }
    finally {
        await driver.quit();
    }
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source