io.magentys.cinnamon.webdriver.EventHandlingWebDriverContainer Maven / Gradle / Ivy
package io.magentys.cinnamon.webdriver;
import io.magentys.cinnamon.eventbus.EventBusContainer;
import io.magentys.cinnamon.events.Attachment;
import io.magentys.cinnamon.webdriver.config.CinnamonWebDriverConfig;
import io.magentys.cinnamon.webdriver.events.handlers.AttachScreenshot;
import io.magentys.cinnamon.webdriver.events.handlers.CloseExtraWindows;
import io.magentys.cinnamon.webdriver.events.handlers.QuitBrowserSession;
import io.magentys.cinnamon.webdriver.events.handlers.TrackWindows;
import io.magentys.cinnamon.webdriver.factory.WebDriverFactory;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriverException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import scala.Option;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
public class EventHandlingWebDriverContainer implements WebDriverContainer {
private final CinnamonWebDriverConfig cinnamonWebDriverConfig = new CinnamonWebDriverConfig();
private final Logger logger = LoggerFactory.getLogger(getClass());
private static final ThreadLocal driver = new ThreadLocal<>();
private static final ThreadLocal tracker = new ThreadLocal<>();
private final List